【发布时间】:2010-10-18 16:30:41
【问题描述】:
我有以下:
<html>
<body oncontextmenu="return false;">
<script src="jquery-1.3.2.min.js"></script>
<script>
$(document).ready(function () {
$(document).mousedown(function (e) {
if (e.button == 2) //right click
{
document.body.style.backgroundColor = "green";
}
else //left click
{
document.body.style.backgroundColor = "blue";
}
});
});
</script>
</body>
</html>
如果在按住鼠标左键的同时单击鼠标右键,则预期的行为是背景颜色从蓝色变为绿色。
这在 Firefox 中有效,但我不确定如何在 IE (7) 中使其有效。谢谢!
【问题讨论】:
标签: javascript jquery html internet-explorer