button的onmouseover、onmouseout该如何写 跟onclick是不是冲突啊

解决方案 »

  1.   

     function   changetype(as_type)   
        { 
           if   (as_type== "truck ")
           { 
            document.all( "wy_list ").style.visibility   = "flase "; 
           } 
           else   
           { 
            document.all( "wy_list ").style.visibility   = "true "; 
           } 
       } js里这样写 protected void Page_Load(object sender, EventArgs e)
        {
            wuyi.Attributes.Add("OnmouseOver", "changetype('truck')");
            
        }Page_Load里这样
      

  2.   

    onmouseover是鼠标移动到该控件上时触发的事件
    onmouseout是鼠标移开该控件时就触发的事件
    onclick就不说了,是点击时才触发的。
    触发的时机不同,所以不冲突
      

  3.   

    可能是我写的不对吧就是想鼠标滑过显示 Panel 离开隐藏
      

  4.   

    你可以直接在按钮上添加onmouseover和onmouseout这2个事件的
      

  5.   

    不冲突。复制到HTML里看效果
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title></title>
    <style type="text/css">
          <!--
           #test1{
               width:50%;
               margin:0px auto;
               padding:5px;
           }
           .border1{
               background:#ADE9AE ;
               border:dotted 1px #ff0000;
           }
           .border2{
               background:#ffffff;
               border:solid 1px #00ff00;
           }
          -->
    </style>
    <script type="text/javascript">
     function changeColor(){
      var test;
      test=document.getElementById("test1");
      test.onmouseover=function(){
       test.className='border1';
      }
      test.onmouseout=function(){
       test.className='border2';
      } }
     window.onload=changeColor;
    </script>
    </head>
    <body>
    <div id="test1" class="border2">
    TTTTTTTTTTTTTT
    </div>
    </body>
    </html>
      

  6.   


    服务器控件按钮 可以直接用onmouseover么? 
    我试了 不成功。。
      

  7.   

     function showdiv()
        {
            document.getElementById("wy_list").style.visibility="visible";
        }
        function closediv()
        {
            document.getElementById("wy_list").style.visibility="hidden";
        } function showdiv()
        {
            document.getElementById("wy_list").style.visibility="visible";
        }
        function closediv()
        {
            document.getElementById("wy_list").style.visibility="hidden";
        }这样能实现显示/隐藏的效果了 但是我没法选择弹出的菜单里的东西 移开按钮 菜单就隐藏了...
      

  8.   

    function showdiv()
      {
      document.getElementById("wy_list").style.visibility="visible";
      }
      function closediv()
      {
      document.getElementById("wy_list").style.visibility="hidden";
      }
     <asp:Button ID="wuyi" runat="server" BackColor="#6666FF" Text="五一社区"
                onclick="wuyi_Click" onmouseover="showdiv()" onmouseout="closediv()" />这样子