HTML DOM src 屬性
定義和用法
src 屬性可設置或返回被載入 iframe 中的文檔的 URL。
語法
iframeObject.src=URL
實例
下面的例子可更改兩個框架的源:
<html>
<head>
<script type="text/javascript">
function changeSource()
{
document.getElementById("frame1").src="frame_c.htm"
document.getElementById("frame2").src="frame_d.htm"
}
</script>
</head>
<body>
<iframe src="frame_a.htm" id="frame1"></iframe>
<iframe src="frame_b.htm" id="frame2"></iframe>
<br /><br />
<input type="button" onclick="changeSource()"
value="Change source of the two iframes" />
</body>
</html>