[thelist] New subscriber + form + adressing

Andreas Wahlin Andreas.Wahlin at ufl.gu.se
Mon Jan 12 11:12:41 CST 2004


Hi everyone, I'm new to the list!
I'm currently at work designing a webinterface for a MS Access database
(using ASP with javascript), and have just recently discovered the joys
of webcoding :)
I must confess I didn't know to much of webcoding when I started on this
project, but I've been surfing the web trying to pick up as much as I
can, I want to try and follow the standards, that's been my main hassle
almost. 

So ... To jump into a few questions (these must have been asked before,
but ... After some minimal browsing on evolt and extensive browsing
elsewhere, I couldn't find any answers)

How to adress input tags in a form (and the form tag)?
In using DOM and XHTML (transitional) as far as I've gathered, the
preferred is to use the id attribute, not the name attribut, however,
forms seem to only work with the name attribute. 

<form name="myForm">
<input name="myInput />
</form>

document.myForm.myInput.value will get the value of the input tag, but
if I change the name attributs to id attributes like 
<form id="myForm">
<input id="myInput />
</form>

Nothing much work, also true for ASP's Request.Form

So is one to use name attributes for forms and id attributes in other
places, or do name and id attributes have their distinct uses when
adressing stuff (using the DOM then, I don't really know the difference
between level 0 and level 1)

Also, is it ok to use this as a reference to an input element, or should
one use the whole document.form.input
So like this:
<input name="link" value="" onfocus="if (this.value=='')
this.value+='http://';" />
Or like this:
<input name="link" value="" onfocus="if (document.myForm.link.value=='')
document.myForm.link.value+='http://';" />


Sorry if my questions or phrasings are cumbersome, stupid or otherwise
not-standard. I didn't have the time to wait and catch the vibes :)

Andreas

Grateful for answers

Oh, btw, I'm from Sweden and 23-years-old


More information about the thelist mailing list