框架学习(一) 入门
1、
<!DOCTYPE html> <html> <frameset rows="50%,*" ID="TopWindow"> <frame name="UpperWindow" src="UpperWindow.html" /> <frame name="LowerWindow" src="LowerWindow.html" /> </frameset> </html>
2、
<!DOCTYPE html> <html> <head> <script language="JavaScript" type="text/javascript"> function window_onload() { alert("The name of the upper frame's window object is " + window.name); /*name就是在框架页中定义的框架页的名称*/ alert("The location of UpperWindow's parent is " + window.parent.location.href); /*可以通过window.parent属性来访问父window对象的所有属性和方法*/ } </script> </head> <body onload="return window_onload()"> <p>Upper Frame </p> </body> </html>
3、
<!DOCTYPE html> <html> <head> <script type="text/javascript" language="javascript"> function window_onload() { alert("The name of the lower frame's window object is " + window.name); alert("The location of LowerWindow's parent is " + window.parent.location.href); } </script> </head> <body onload="return window_onload()"> <p> Lower Frame</p> </body> </html>
posted on 2013-08-08 12:36 TrustNature 阅读(97) 评论(0) 编辑 收藏 举报