首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

parent.mainFrame.onload为什么不好用?该怎么解决

2012-02-16 
parent.mainFrame.onload为什么不好用?!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Frameset//EN http://ww

parent.mainFrame.onload为什么不好用?
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Frameset//EN "   "http://www.w3.org/TR/html4/frameset.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=utf-8 ">
<title> 无标题文档 </title>
</head>

<frameset   rows= "80,* "   frameborder= "NO "   border= "11 "   framespacing= "1 ">
<frame   src= "top.html "   name= "topFrame "   scrolling= "NO "   noresize   title= "topFrame "   id= "topFrame ">
<frame   src= "body.html "   onload= "alert( 'index ') "   name= "mainFrame "   title= "mainFrame "   id= "mainFrame ">
</frameset>
<noframes> <body>
</body> </noframes>
</html>

//body.html
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=utf-8 ">
<title> 无标题文档 </title>
</head>

<body   onLoad= "alert(parent.mainFrame.src) ">

</body>
</html>



[解决办法]
<body onLoad= "alert(parent.frames[ 'mainFrame '].location.href) ">

热点排行