DOM HTML atributo de cuadro / iframe src
Frame / objetos IFrame
Definición y Uso
src conjuntos de propiedades o devuelve el atributo src elemento de bastidor de valor / iframe.
atributo src especifica el fotograma / iframe cargada en la URL del documento.
gramática
frameObject.src=URL
或者
iframeObject.src=URL
或者
iframeObject.src=URL
Soporte para el navegador
Todos los principales navegadores soportan el atributo src
Ejemplos
Ejemplos
Cambie el atributo src iframe:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function changeSrc(){
document.getElementById("myframe").src="http://www.baidu.com";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSrc()" value="修改源链接">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function changeSrc(){
document.getElementById("myframe").src="http://www.baidu.com";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSrc()" value="修改源链接">
</body>
</html>
Trate »
Frame / objetos IFrame