猿问

ASP。NET WEB 编程问题

代码如下:
<div id = "text" style = "position:absolue" onclick = "function" mousemove = "dsdads" .....>
</div>

请问怎么实现这个DIV中的事件呢?(也就是说上面代码中的onclick、mousemove怎么实现????)
最好给我个完整的短小的例子,谢谢大虾们!
慕工程0101907
浏览 424回答 2
2回答

万千封印

onclick, onmousemove 均为客户端的js的事件。在<script/>中写你的处理事件就可以了.<div id = "text" style = "position:absolue" onclick = "doClick()" onmousemove = "doMove()" .....></div>js代码:<script type="text/javascript">function doClick(){alert('click me!');}function doMove(){alert('move me!');}</script>

收到一只叮咚

<script language="javascript" type="text/javascript">function HelloWord(){alert("HelloWord!");}</script><div id = "text" style = "position:absolue" OnClientClick = "HelloWord()" ></div>
随时随地看视频慕课网APP
我要回答