Thanx man! I've changed the unique ID from 1 to a, and it still produces the same error. I totally see your point, but don't you agree that my sollution should work as well? And what about the strange thing that the error does not occur, when alerting on the line above?
--- In [email protected], Bjoern Hoehrmann <[EMAIL PROTECTED]> wrote: > * skrellkolja wrote: > >The var node represents a unique ID, in my case the number 1. What > >happens is that i get the error "SVGDoc.getElementById(...) is null or > >not an object.". This would probably make u say "But, dude, be sure > >the elements exists." The strange thing is: if I uncomment the alert > >statement on the line above, it will alert true, and no error on the > >line beneath is produced. > > Note that IDs MUST NOT start with a digit. > > >if (!checkConent(node)) > > createContent(..) > > > > > >function checkContent(n){ > >//alert(SVGDoc.getElementById (n "_textContent_text").hasChildNodes()); > >return SVGDoc.getElementById(n + "_textContent_text").hasChildNodes(); > >} > > The proper way to do this would be to check the getElementById return > value before trying to call a method on it. For example > > var node = document.getElementById(...); > return node && node.hasChildNodes(); > -- > Bj�rn H�hrmann � mailto:[EMAIL PROTECTED] � http://bjoern.hoehrmann.de > Weinh. Str. 22 � Telefon: +49(0)621/4309674 � http://www.bjoernsworld.de > 68309 Mannheim � PGP Pub. KeyID: 0xA4357E78 � http://www.websitedev.de/ ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

