当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM src属性

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM src属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 426 ::
收藏到网摘: n/a

The src property sets or returns the URL of the document that should be loaded into the frame.
src属性可以设置或返回应加载进框架里的文档URL

Syntax
语法

frameObject.src=URL


Example
举例

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>


Try-It-Yourself Demos
尝试与演示

Change the source of two frames
改变两个框架的来源地址

评论 (0) All

登陆 | 还没注册?