Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/05/2008, 11:31
juanromerocruz
 
Fecha de Ingreso: febrero-2007
Mensajes: 103
Antigüedad: 18 años
Puntos: 0
nada nuevo en IE NO FUNCIONA

Como siempre tengo un codigo que en FF funciona correctamente y
en IE, no se por que,no.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
#myId {
height: 200px;
width: 400px;
border-top-width: 3px;
border-right-width: 3px;
border-bottom-width: 3px;
border-left-width: 3px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;

}
-->
</style>
</head>

<body>

<script type="text/javascript">
var p=document.createElement("p");
p.setAttribute("style","color:red");
div=document.createElement("div");
div.setAttribute("id","myId");
//div.setAttribute("style","visibility:visible");
var texto=document.createTextNode("Este texto es para agregar al parrafo");

p.appendChild(texto);

document.body.appendChild(div).appendChild(p);

function ocultar(){
div.setAttribute("style","visibility:hidden");

}

function mostrar(){
div.setAttribute("style","visibility:visible");

}


</script>

<form >
<input name="" type="button" onclick="javascript:ocultar();" value="ocultar" />
<input name="" type="button" onclick="javascript:mostrar();" value="mostrar" />
</form>

</body>
</html>



El codigo es parte de un ejercicio y lo que hace es ocultar un div o presentarlo cuando se pulsa un boton u otro