日期:2014-05-16  浏览次数:20355 次

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) ">