HTML DOM innerHTMLPropiedad

元素对象参考手册Objeto Elemento


Definición y uso

La propiedad innerHTML establece o devuelve el HTML entre las etiquetas de inicio y fin de la fila de la tabla.

Sintaxis

HTMLElementObject.innerHTML=text


Soporte del navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los navegadores principales soportan la propiedad innerHTML.


Ejemplo

Ejemplo

Cambiar texto, URL y destino del enlace:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Ejemplo (example.com)</title> <script> function changeLink(){ document.getElementById('myAnchor').innerHTML="EJEMPLO"; document.getElementById('myAnchor').href="//www.example.com"; document.getElementById('myAnchor').target="_blank"; } </script> </head> <body> <a id="myAnchor" href="//www.microsoft.com">Microsoft</a> <input type="button" onclick="changeLink()" value="Modificar enlace"> </body> </html>

Pruébalo »


元素对象参考手册Objeto Elemento

Otras extensiones