Ver Mensaje Individual
  #11 (permalink)  
Antiguo 07/01/2004, 06:04
Avatar de KarlanKas
KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 22 años, 4 meses
Puntos: 61
Hola a los dos!!

Javier, me han traido montañas de código, y había uno para tí!!

Es este:


Código PHP:
<html>
<
head>
    <
title>Untitled</title>
    <
style>
    .
a{background:red;
    
width:100px;
    
height:100px;}
    </
style>
</
head>

<
body>
<
div id="pru"></div>
<
script>
elem=document.getElementById('pru');
elDiv=document.createElement('div');
elDiv.setAttribute('className','a');
elDiv.setAttribute('id','algo');
elDiv.onclick=pepe
function pepe(esto) {
if (
esto){alert(esto.id);}
else{
alert(this.id)}}
elem.appendChild(elDiv);

</script>
<input value="www" type="button" onclick="pepe(elDiv)"/>

</body>
</html> 
__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.