Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/09/2007, 18:42
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años, 5 meses
Puntos: 1284
Re: saber si un elemento existe??

Cita:
Iniciado por MaBoRaK Ver Mensaje
loading..........


Prueba así

Código PHP:
if(typeof document.getElementById("elemento")!=="undefined"){
    
alert("si" );


connection closed.
Hola:

undefined también podría usarse sin entrecomillar:

if (document.getElementById(elemento) == undefined)...

Por cierto MaBoRaK, creo que lo que hay detrás del typeof debería estar entre paréntesis...
if(typeof ( document.getElementById("elemento") ) !=="undefined"){

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo