milov.nl

Interaction design • webdevelopment • web art • photography

November 2002

ugly :(
document.myForm.myInput.value
document.someImage.src


pretty :)
document.forms['myForm'].elements['myInput'].value
document.images['someImage'].src



void wrote on 2002/11/14:
You are so right! It's like comparing XHTML to HTML. Maybe it's time for XJavascript?


Eric wrote on 2002/11/14:
Wrong
Less code = pretty


Mario wrote on 2002/11/15:
If it works, that's ok.
The goals sometimes justify the ways.


Jan! wrote on 2002/11/17:
>Wrong
>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?


Liorean wrote on 2002/11/20:
The document.<formName>.<elementName> syntax instead of document.forms[<formName>].element[<elementName>] was one of the worst mistakes made at Netscape in creting the language - and Microsoft didn't make it especially much better.

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?