日期:2014-05-18  浏览次数:20423 次

关于在.net 2005 中执行Javascript的问题.
我在.net2005中随便建了个页面为Default.aspx

写入了如下代码:
<%@   Page   Language= "C# "   AutoEventWireup= "true "     CodeFile= "Default.aspx.cs "   Inherits= "_Default "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
        <script   type= "text/javascript "   language= "javascript ">
                function   showMessage()
                {
                        alert( "luxiaodong ");
                }
               
                function   onmousedownHandler()
                {
                        alert( "你按下了鼠标. ");
                }
               
                function   Click()
                {
                        alert( "Click ");
                }
        </script>
</head>
<body   onload= "showMessage() "   onmousedown   = "onmousedownHandler() "   onclick= "Click() ">
        <form   id= "form1 "   runat= "server ">
        <div>
       
        </div>
        </form>
       
</body>
</html>

执行的时候:onLoad事件能够执行,而onmousedown   ,和onclick不能执行。
为什么,知道的朋友告诉一下。

还有我用document.getelementbyId( "元素ID ").事件加载事件也不好用。
为什么,总之就是用document操作事件的方法都不好用。

注意我都是在.net2005中嵌入   写入的javascript代码.

------解决方案--------------------
鼠标没有晃到BODY上没触发事件