日期:2014-05-17 浏览次数:20775 次
$(function(){
$(window).mousedown(function(e){
if(e.which == 2) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
alert("1");
return false;//阻止链接跳转
})
return false;
})
$(function() {
$(window).mousedown(function(e) {
if (e.which == 2) { // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
//alert(e.cancelable); //true,说明该事件是可以被取消的
e.preventDefault();
return false; //阻止链接跳转
}
});
return false;
});
<!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">
*{ margin:0; padding:0;}
html,body{ height:100%; width:100%; font-size:12px;}
#picrun{ position:absolute; top:10px; height:100px; left:100px; width:500px; overflow:hidden;}
#picrun li{ list-style:none; float:left; margin-left:12px; text-align:center; background:#FFF; width:100px;}
#picrun img{ width:100px; height:60px; border:none;display:block; padding-bottom:3px;}
</style>
</head>
<body>
<div id="container">
</div>
<div id="picrun">
<ul id="li_img">
<li><a href=""><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif" /></a>1这里哪个厅</li>
<li><a href=""><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif" /></a>2哪个厅这个</li>
<li><a href="http://www.baidu.com"><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif" /></a>3这里哪个厅</li>
<li><a href=""><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif" /></a>4哪个厅这个</li>
<li><a href=""><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif" /></a>5这里哪个厅</li>
<li><a href=""><img src="http://www.baidu.com/img/513_01d1df20e56f282ab5104866d0a718de.gif"