当前位置: 代码迷 >> ASP.NET >> onclick="parent.location.href='http://www.microsoft.com';"> 在当窗口中打开,小弟我想在框架中的主窗口打开如何做啦
  详细解决方案

onclick="parent.location.href='http://www.microsoft.com';"> 在当窗口中打开,小弟我想在框架中的主窗口打开如何做啦

热度:10093   发布时间:2013-02-25 00:00:00.0
onclick="parent.location.href='http://www.microsoft.com';"> 在当窗口中打开,我想在框架中的主窗口打开怎么做啦!
index.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= "Default.aspx "   name= "mainFrame ">  
</frameset>  
<noframes> <body>  
</body> </noframes>  
</html>

top.htm
<html>  
<head>  
<title> MSDN的示例 </title>  
<script     type= "text/javascript ">  
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; "   OnClick= "richContext();   return   false "     > 55444554. </span>
<div   id= "oContext2 "   style= "display:none ">  
<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 "   onmouseover= "this.style.background= '#ffffff ' "   onmouseout= "this.style.background= '#cccccc ' "   onclick= "parent.location.href= 'http://www.microsoft.com '; ">    
        &nbsp;&nbsp;Search </DIV>  
</div>  
</div>  
</body>  
</html>


onclick= "parent.location.href= 'http://www.microsoft.com '; "> 在当窗口中打开,我想在框架中的主窗口打开怎么做啦!



------解决方案--------------------------------------------------------
try:
onclick= "top.window.location= 'http://www.microsoft.com '; "
------解决方案--------------------------------------------------------
<frameset rows= "92,* " cols= "* " framespacing= "4 " frameborder= "yes " border= "4 ">
<frame src= "top.htm " name= "topFrame " scrolling= "NO " >
  相关解决方案