Re: DOM - parse HTML document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----- From: "Leonidas Safran" <Elektrik@xxxxxxx>

By the way, because I found it strange to have more than one field with the same id, I looked on the famous selfhtml tutorial website http://de.selfhtml.org which says that unique id is only mandatory for css, but not for javascript actually. I was surprised...
http://de.selfhtml.org/css/formate/zentrale.htm#individualformate
http://en.selfhtml.org/css/formate/zentrale.htm#individualformate
(english translation is a little different)



That is correct but it is not complete. Everything that relies on a unique id would fail, CSS amongst others(which is what this article covers), but not the only one.

Basically there are two functions to get elements by id or name: getElementById and getElementsByName. Notice the first one returns a single element since there cannot be more than one, the second one returns a collection of elements, since duplicates are allowed. Thus, if you put an id in an element, it is because you want to reach it, but if the id is duplicated then you cannot reach it any longer.

Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux