代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<머리>
<TITLE>팝업对象实现右键菜单</TITLE>
<스크립트 언어="자바스크립트">
var oPopup = window.createPopup();
함수 contextMenu()
{
var left = event.offsetX+10;
var top = event.offsetY+10;
oPopup.document.body.innerHTML = oContext.innerHTML;
oPopup.show(왼쪽, 위쪽, 120, 80, window.document.body);
}
</script>
</head>
<body oncontextmenu="contextMenu(); return false;">
<h1>팝업对象实现右键菜单</h1>
单击鼠标右键查看效果
<div ID="oContext" style="DISPLAY: 없음; 배경: #e4e4e4; ">
<div onmouseover="this.style.Background='금'"
onmouseout="this.style.Background='#e4e4e4'"
<span onclick='parent.location.href=" http://www.zol.com.cn"' >
中关村线</span>
</div>
<div onmouseover="this.style.Background='금'"
onmouseout="this.style.Background='#e4e4e4'"
<span onclick="parent.location.href='http://www.cfan.com.cn'">
电脑爱好者</span>
</div>
<div onmouseover="this.style.Background='금';"
onmouseout="this.style.Background='#e4e4e4';">
<span onclick="parent.location.href='http://www.sina.com.cn'">
새로운 것</span>
</div>
<div onmouseover="this.style.Background='금'"
onmouseout="this.style.Background='#e4e4e4'"
<span onclick="parent.location.href='http://www.xinhuanet.com'">
새로운 것</span>
</div>
</div>
</body>
</html>