<div class="htmlarea"> <textarea id="runcode21133"> <title>Popup对象实现右键菜单</title> <script language="JavaScript"> var oPopup = window.createPopup(); function contextMenu() { var left = event.offsetX+10; var top = event.offsetY+10; oPopup.document.body.innerHTML = oContext.innerHTML; oPopup.show(left, top, 120, 80, window.document.body); } </script> <h1>Popup对象实现右键菜单</h1> 单击鼠标右键查看效果 <div id="oContext" style="DISPLAY: none; BACKGROUND: #e4e4e4; "> <div onmouseover="this.style.background='gold'" onmouseout="this.style.background='#e4e4e4'" onclick='parent.location.href="http://www.zol.com.cn"'> 中关村在线 </div> <div onmouseover="this.style.background='gold'" onmouseout="this.style.background='#e4e4e4'" onclick="parent.location.href='http://www.cfan.com.cn'"> 电脑爱好者 </div> <div onmouseover="this.style.background='gold';" onmouseout="this.style.background='#e4e4e4';"> <span onclick="parent.location.href='http://www.sina.com.cn'"> 新浪网</span> </div> <div onmouseover="this.style.background='gold'" onmouseout="this.style.background='#e4e4e4'" onclick="parent.location.href='http://www.xinhuanet.com'"> 新华网 </div> </div> </textarea><br><input onclick="runEx('runcode21133')" type="button" value="运行代码"> <input onclick="doCopy('runcode21133')" type="button" value="复制代码"> <input onclick="doSave(runcode21133)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>