首页 > 代码库 > 自己写的_top、_parent以及对iframe和frameset的理解
自己写的_top、_parent以及对iframe和frameset的理解
iframe可以写在<body>标签里,如<body><iframe src="http://www.mamicode.com/xxx" name="xxx" style="width:100%;height:500px;"/></body> iframe标签要成对,不然后面的标签不起作用
frameset不可以写在<body>标签里,如:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <frameset rows="50%,25%,*"> <frame name="frameset_target" src="http://www.mamicode.com/HelloWorld.html" noresize="noresize"/> <frame src="http://www.mamicode.com/hello.java"/> <frame src="http://www.mamicode.com/hello.java"/> </frameset> </html>
-----------------------------------------------------------------------------------------------iframe
<h5>iframe__frameset</h5> <p><a href="http://www.mamicode.com/V1.jpg" target="iframe_target">iframe</a></p> <p><a href="http://www.mamicode.com/V1.jpg" target="frameset_target">frameset</a></p> <iframe src="http://www.mamicode.com/hello.java" name="iframe_target" style="width:100%;height:500px;"/>
-----------------------------------------------------------------------------------------------frameset
注:必须先将frameset所在页面打开,然后,再点击里面的超链接到frame里的标签,(frameset的子标签是frame,不是iframe)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <frameset rows="50%,25%,*"> <frame name="frameset_target" src="http://www.mamicode.com/HelloWorld.html" noresize="noresize"/> <frame src="http://www.mamicode.com/hello.java"/> <frame src="http://www.mamicode.com/hello.java"/> </frameset> </html>
-----------------------------------------------------------------------------------------------top和parent
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <body> <a href="http://www.mamicode.com/a_main.html">主界面</a> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <frameset rows="20%,*"> <!--noresize属性规定用户无法调整框架的大小,默认是可以通过拖动框架之间的墙壁来改变框架大小--> <frame src="http://www.mamicode.com/a_top.html" noresize="noresize"/> <frame src="http://www.mamicode.com/a_bottom.html" name="bottom" noresize="noresize"/> </frameset> </html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> this is top.html </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <frameset cols="20%,*"> <!--noresize属性规定用户无法调整框架的大小,默认是可以通过拖动框架之间的墙壁来改变框架大小--> <frame src="http://www.mamicode.com/a_left.html" noresize="noresize"/> <frame src="http://www.mamicode.com/a_right.html" name="bottom" noresize="noresize"/> </frameset> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> this is left.html </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> </head> <body> this is right.html <a href="http://www.mamicode.com/a_target_test1.html" target="bottom">test1</a> <a href="http://www.mamicode.com/a_target_test1.html" target="_parent">_parent</a> <a href="http://www.mamicode.com/a_target_test1.html" target="_top">_top</a> </body> </html>
自己写的_top、_parent以及对iframe和frameset的理解
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。