ugly :(
document.myForm.myInput.value
document.someImage.src
pretty :)
document.forms['myForm'].elements['myInput'].value
document.images['someImage'].src
Interaction design • webdevelopment • web art • photography
ugly :(
document.myForm.myInput.value
document.someImage.src
pretty :)
document.forms['myForm'].elements['myInput'].value
document.images['someImage'].src
Less code = pretty
The goals sometimes justify the ways.
>Less code = pretty
Less code == more prone to errors
<form name="search">
<h2><img name="search" src="search.gif" alt="Search!"></h2>
<p id="search">This is a search form</p>
</form>
'document.search', say you?
How should you handle a form named "forms" with a child element named "forms", for instance? document.forms["forms"].elements["forms"] is the full format - but does document.forms["forms"] not reference by short form the element at the same time it by full form referece the form? Or how about an element with the id "all" in IE?