当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM src属性
The src property sets or returns the URL of the document that should be loaded into the frame.
src属性可以设置或返回应加载进框架里的文档URL
frameObject.src=URL |
In our example we will first create an HTML document containing a frameset with two columns. Each column is set to 50% of the browser window:
举例中我们建立了一个包含两个列的框架HTML文档,每个列的宽度为整个浏览器窗口总段度的50%:
<html> <frameset cols="50%,50%"> <frame id="lFrame" src="frame_src.htm"> <frame id="rFrame" src="frame_a.htm"> </frameset> </html> |
The HTML document "frame_src.htm" is put into the first column, and the HTML document "frame_a.htm" is put into the second column.
"frame_src.htm"放置在第一个列中,"frame_a.htm"则在第二个列
The source of "frame_src.htm" is as follows:
"frame_src.htm"的代码如下:
<html> <head> <script type="text/javascript"> function newSrc() { parent.document.getElementById("lFrame").src="http://w3schools.com" parent.document.getElementById("rFrame").src="http://google.com" } </script> </head> <body> <form> <input type="button" onclick="newSrc()" value="Change frame source" /> </form> </body> </html> |
Change the source of two frames
改变两个框架的来源地址