[Javascript] insert value into form field

Joshua Turcotte kaji at umit.maine.edu
Sun Jun 2 22:34:13 CDT 2002


if the form tag references a javascript function onxxxevent="blah(this);" ...

... then within the function you should rather easily be able to say this.t1.value = xyz;  xyz may also be something you could pass as an argument from the call to blah()...

if you reference the form any less directly, it is typically as f1.t1.value.  But, this varies significantly from one browser type to the next and can be a source of frustration.  At least for me... with IE, i -believe- it could simply be
document.form.f1.t1.value, almost regardless of its nesting within your document... but I'm pretty sure netscape would require you do be more specific... meaning, if it is embedded in a named layer or table or maybe even frame, you'd have to
reference these in sequence.  

the .value = xyz is absolutely right... the rest I've said i've said while in a drowsy state (been reading 'eon' a bit too late recent nights) and truthfully these things tend to bite me frequently when debugging javascripts... so any corrections or
backup from the mailing list would be appreciated.



_____________________________________________________________
J.e. Turcotte: eMAGERY Founder, Media|Creative Solutions Developer
jet at emagery.com, voicemail: (207) 866-4842, www.emagery.com




More information about the Javascript mailing list