Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,
What is exact difference between document.elementid(suppose textbox).value and form.textbox.value?
Both are recognise value of textbox.

Shall you help me to this problem ?
Posted
Updated 23-May-11 2:26am
v2
Comments
That's Aragon 23-May-11 8:28am    
Edited for grammar and readability.

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-May-11 12:00pm    
Nice, my 5.
--SA
document.getElementById() is the recommended way to get reference of elements in your web page. This is easier to use and also would not require any changes if you decide to change something else like the Form name (or Id) etc.
However, as it traverses the entire DOM tree, it is usually slower (not noticeable) than the document.forms notation of referencing objects.



document.forms is harder to use in the sense that you need you to know properly the entire path to the object beginning from the document element. But on the other hand it is comparatively faster (not noticeable)./pre>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900