惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
D
DataBreaches.Net
腾讯CDC
I
InfoQ
F
Fortinet All Blogs
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
月光博客
月光博客
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog

博客园 - 曲达子

Oralce sys system密码找回 oracle服务丢失的解决办法 JS 实现table 分页 xmlHttp 中乱码处理 C# windows 服务(转) 在oc4j中安装、配置MapViewer 关于PostBack(转) 自定义控件属性的一些特性 oracle 游标使用 (转)实用JaveScript 用.NET 2.0压缩/解压封装的类 (转) ASP.NET 项目中用到的广告效果(转) js 在杂烩 在NHibernate中使用Oracle的sequence主键 window对象详解 asp.net 获取服务器信息 路径问题 刷新父窗口 常见问题与错误小总结
js中一些鼠标事件
曲达子 · 2008-07-03 · via 博客园 - 曲达子

<A href="tencent://message/?uin=16769711&amp;Site=Antu&amp;Menu=yes"
>有事Q我</A>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>马国福 测试关于鼠标事件</title>
</head>
 <script type="text/javascript">
   window.onload=displayDiv;//页面加载时
   document.oncontextmenu=function(){return false;}//屏蔽鼠标右键
   document.onmousedown=muoseRight;
   //鼠标右击时
   function muoseRight()
   {
    if(event.button==2)
    {      
     var oDiv = document.getElementById("div1");    
     oDiv.style.left = event.clientX;//层的左距离坐标
     oDiv.style.top =  event.clientY;//层的右距离坐标
     oDiv.style.display="block";
     //oDiv.innerHTML="没有获取ID";
     divMouseover();     
    }
   }  
   //离开层时 
   function divMouseover()
   {
    var divObj= document.getElementById("div1");
    divObj.onmouseout=MouseOut;    
   }
   
   //动态添加控件鼠标事件
   function displayDiv()
    {              
    var inps=document.getElementsByTagName("input");             
    for(var i =0;i<inps.length;i++)
    {
     var note = inps[i];    
     if(note && note.className=="shijiaos")
     {
      note.onmouseover=MouseOver;
      note.onmouseout=MouseOut;  
     }   
    }
     }
     //鼠标移动到层时
            function MouseOver()
   {  
    var note=this.id;    
                var oDiv = document.getElementById("div1");    
                oDiv.style.left = event.clientX;//层的左距离坐标
                oDiv.style.top =  event.clientY;//层的右距离坐标
    if(note)
    {
     var temp = document.getElementById(note);
     if(temp)
     {
      oDiv.innerHTML=temp.value;
     }
    }
    else
    {
     //oDiv.innerHTML="没有获取ID";
    }
    oDiv.style.display="block";
            }
   //onmouseOut事件
   function MouseOut()
   {
    var oDiv = document.getElementById("div1");
    oDiv.style.display="none";
   }
                                 
        </script>
        <style type="text/css">
            #div1 {
                background-color: red;
                height: 100px;
                width: 200px;
                position: absolute;
            }
        </style>
    </head>
    <body >
        <p>鼠标事件</p>
        <p><div id="div1" style="display:none ">
  <a href="http://www.google.cn" target="_blank">www.google.cn</a>
  </div> </p>       
  <input type="text" value="111" type="text"  id="txtShiJ1" class="shijiaos" />
  <input type="text" value="222" type="text"  id="txtShiJ2" class="shijiaos"  />
    </body>
</html>

posted @ 2008-07-03 17:27  曲达子  阅读(480)  评论()    收藏  举报