Frame/IFrame srcPropiedad

Frame/IFrame 对象参考手册Objeto Frame/IFrame

Definición y uso

La propiedad src establece o devuelve el valor del atributo src del elemento frame/iframe.

La propiedad src especifica la URL del documento cargado en el frame/iframe.

Sintaxis

frameObject.src=URL

o

iframeObject.src=URL


Compatibilidad con navegadores

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los navegadores principales son compatibles con la propiedad src.


Ejemplo

Ejemplo

Cambiar la propiedad src del iframe:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo(example.com)</title>
<script>
function changeSrc(){
    document.getElementById("myframe").src="http://www.baidu.com";
}
</script>
</head>
<body>

<iframe id="myframe" src="../index.html">
<p>Tu navegador no soporta iframes.</p>
</iframe>
<br><br>
<input type="button" onclick="changeSrc()" value="Modificar enlace de origen">

</body>
</html>

Pruébalo »


Frame/IFrame 对象参考手册Objeto Frame/IFrame Otras extensiones