<html> <head> <script type="text/javascript"> function whichElement(e) { var targ if (!e) var e = window.event if (e.target) targ = e.target else if (e.srcElement) targ = e.srcElement if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode var tname tname=targ.tagName alert("You clicked on a " + tname + " element.") } </script> </head><body onmouseup="whichElement(event)"><h2>This is a header</h2> <p>This is a paragraph</p> <img border="0" src="ball16.gif" alt="Ball"></body> </html>
setting a property that has only a getter [Break on this error] event.which = 3;firebug报的这个错。 通过一般方式自主激发怕是没戏了。
<!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>
<title>Test Page</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css"> </style>
</head> <body><div id="divTest" style="boder: 1px solid red; background-color: blue; width: 100px; height: 100px;">
</div> </body>
<script type="text/javascript" defer>
<!--
//document.getElementById("");var div = document.getElementById("divTest");
div.onmouseup = function() {
if(IsRightButtonPressed()) {
alert("Right button is pressed.");
}
};function IsRightButtonPressed() {
return (event.button == 2);
}
//-->
</script>
</html>
Fires when the user clicks the right mouse button in the client area, opening the context menu.右键只有这么一个事件,似乎办不到
<html>
<body>
<div id="good">
</div>
<script>
document.onclick = function(){
alert();
document.getElementById("good").contextmenu();
}
</script>
</body>
</html>
<head>
<script type="text/javascript">
function whichElement(e)
{
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head><body onmouseup="whichElement(event)"><h2>This is a header</h2>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" alt="Ball"></body>
</html>
[Break on this error] event.which = 3;firebug报的这个错。
通过一般方式自主激发怕是没戏了。