Copiar código del código de la siguiente manera:
<html>
<script language = "javaScript" type = "text/javaScript">
función test () {
// Crear elementos
var myelement = document.createElement ("a");
// Agregar la información necesaria al elemento creado
myelement.href = "http://www.baidu.com";
myElement.inntext = "Conectar a Baidu";
myelement.id = "id1";
//myelement.style.top = "300px";
//myelement.style.left = "500px";
// mielement.
// Agregar los elementos creados al objeto del cuerpo
//document.body.appendchild (mielement);
// Agregar el elemento al div
document.getElementById ("Div1").
}
Función test2 () {) {
// Eliminar un elemento
// También puede obtener el elemento principal del nuevo elemento a través del atributo
//document.getElementByid.
document.getElementById ("Div1").
}
</script>
<Body>
<input type = "button" onClight = "test ()" value = "vitalizando un hipervínculo"/>
<input type = "button" onClight = "test2 ()" value = "Dynamic Eliminar el elemento agregado"/>
<div id = "div1" style = "ancho: 200px; altura: 300px; borde: 1px sólido rojo">
div1
</div>
</body>
</html>