HTML DOM Frame 的 src

定义和用法

src 属性可设置或返回应当被载入框架中的文档的 URL。

该属性只是 HTML 的 <frame> 标记的一个对应,并不是 Window.location 这样的 Location 对象。

语法

frameObject.src=URL

实例

在我们的例子中,首先将创建包含带有两个列的框架集的 HTML 文档。每列设置为浏览器窗口的 50%:

<html>
  <frameset cols="50%,50%">
    <frame id="lFrame" src="frame_src.htm">
    <frame id="rFrame" src="frame_a.htm">
  </frameset>
</html>

HTML 文档 "frame_src.htm" 被放入第一列,而 HTML 文档 "frame_a.htm" 被放入第二列。

下面是 "frame_src.htm" 的源代码:

<html>
<head>
<script type="text/javascript">
function newSrc()
{
parent.document.getElementById("lFrame").src="http://w3school.com.cn"
parent.document.getElementById("rFrame").src="http://google.com"
}
</script>
</head>

<body>
<form>
<input type="button" οnclick="newSrc()"
value="Change frame source" />
</form>
</body>

</html>

 

Frame  的 src 会自动加载内容.

转载于:https://www.cnblogs.com/wicub/p/3502287.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值