Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-16-2003, 03:27 PM   PM User | #1
frontline
Regular Coder

 
Join Date: Sep 2002
Posts: 143
Thanks: 0
Thanked 0 Times in 0 Posts
frontline is an unknown quantity at this point
how can i know if element is not exists in document

Hello
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??
thanks
frontline is offline   Reply With Quote
Old 01-16-2003, 03:45 PM   PM User | #2
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
Well, becuase you have some illegal syntax there. try something like this
Code:
function getNode( id )
{
	return ( document.all || document.getElementById )( id );
}

alert( getNode( "foo" ) );
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:53 AM.


Advertisement
Log in to turn off these ads.