Frame/IFrame src property
Frame/IFrame objectDefinitions and usages
The src property can set or return the value of the src property in the frame/iframe element.
The src property specifies the URL of the document that is loaded into the frame/iframe.
Grammar
or
iframeObject.src= URL
Browser support
The src property is supported by all major browsers
Change the src property in iframe:
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
<script>
function changeSrc(){
document.getElementById("myframe").src="http://www.baidu.com" rel="external nofollow" ;
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3cschool.com" rel="external nofollow" >
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSrc()" value="修改源链接">
</body>
</html>
Try it out . . .
Frame/IFrame object