用DHTML中的Popup Object实现跨框架显示菜单(from MSDN)

/**frames.htm**//

<html>
<head>
<title>网页跨框架菜单 from MSDN</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<frameset rows="92,*" cols="*" framespacing="4" frameborder="yes" border="4">
  <frame src="top.htm" name="topFrame" scrolling="NO" >
  <frame src="bottom.htm" name="mainFrame">
</frameset>
<noframes><body>

</body></noframes>
</html>

/**top.htm**//

<html>
<head>
<title>MSDN的示例</title>
<script>
var oPopup = window.createPopup();
function richContext()
{
    var lefter2 = event.offsetY+0;
    var topper2 = event.offsetX+15;
    oPopup.document.body.innerHTML = oContext2.innerHTML;
    oPopup.show(topper2, lefter2, 210, 84, contextobox);
}
</script>
</head>
<body>

 

<span id="contextobox" style="  cursor:hand; margin-left:5px; margin-right:10px; background:#e4e4e4; width:300; height:40; padding:20px;" οncοntextmenu="richContext(); return false"  >Right-click inside this box.</span>

<DIV ID="oContext2" STYLE="display:none">
<DIV STYLE="position:relative; top:0; left:0; border:2px solid black;  border-top:2px solid #cccccc; border-left:2px solid #cccccc; background:#666666; height:110px; width:207px;">
  <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" οnmοuseοver="this.style.background='#ffffff'" οnmοuseοut="this.style.background='#cccccc'" οnclick="parent.location.href='http://www.microsoft.com';">
    &nbsp;&nbsp;Home</DIV>
  <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" οnmοuseοver="this.style.background='#ffffff'" οnmοuseοut="this.style.background='#cccccc'" οnclick="parent.location.href='http://search.microsoft.com';">
    &nbsp;&nbsp;Search</DIV>
  <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" οnmοuseοver="this.style.background='#ffffff'" οnmοuseοut="this.style.background='#cccccc'" οnclick="parent.location.href='http://www.microsoft.com/ie';">
    &nbsp;&nbsp;Intenet Explorer</DIV>
  <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" οnmοuseοver="this.style.background='#ffffff'" οnmοuseοut="this.style.background='#cccccc'" οnclick="parent.location.href='http://www.microsoft.com/info/cpyright.htm';">
    &#169;2001 Microsoft Corporation</DIV>
</DIV>

</body>
</html>

/**bottom.htm**//
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
本例是从MSDN中的Using the Popup Object一文中简化而来的.
Popup Object还有很多强大的功能,强烈建议大家都看看Using the Popup Object一文.
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值