View Full Version : how can i know if element is not exists in document

01-16-2003, 03:27 PM
im trying to know if some html object is on the document
but when i try simple :
alert(document["foo"].id) it even don't alert the alert...
by the way in this example there is no foo object .
so.. how can i know if object is NOT exists??

01-16-2003, 03:45 PM
Well, becuase you have some illegal syntax there. try something like this
function getNode( id )
return ( document.all || document.getElementById )( id );

alert( getNode( "foo" ) );

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum