java学习

java学习

 

jquery得到事件类型,href,

<html>
<head>
<script src="../../scripts/jquery-1.3.1.js" type="text/javascript"></script>
 <script>
$(function(){
    $("a").click(function(event) {
      alert(event.type);//获取事件类型
 alert(event.target.href);//获取触发事件的<a>元素的href属性值
 alert("Current mouse position: " + event.pageX + ", " + event.pageY );//获取鼠标当前相对于页面的坐标
alert(e.which)  // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
      return false;//阻止链接跳转
    });
})
  </script>
</head>
<body>
<a href='http://google.com'>click me .</a>
</body>
</html>

posted on 2013-03-19 09:46 杨军威 阅读(601) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜