[Greasemonkey] Refrencing a field name without form name

rejectpenguin rejectpenguin at gmail.com
Sun Sep 17 22:27:33 EDT 2006


Thanks for your help.

So if I use getelementbyid it will return the form?

So I could use something like:

var formname = getElementById('fieldname');

would this work?


Rod McGuire wrote:
> 
> Quoting rejectpenguin <rejectpenguin at gmail.com>:
>> Yeah thats my question.. Is it possible to refrence a javascript field
>> name
>> without the form name.
>>
>> Example normally I would refrence it like this:
>> document.form.fieldname.value = "100";
>>
>> but what if there is no form name?
> 
> Please read http://www.oreillynet.com/lpt/a/6257
> All of it, but especially see Pitfall #3:
> 
> Most people attach an 'id="fieldIDxxx"' onto the field, and then access it
> by
> .getElementById('fieldIDxxx') or use XPath.
> 
> 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> 
> 

-- 
View this message in context: http://www.nabble.com/Refrencing-a-field-name-without-form-name-tf2288849.html#a6357564
Sent from the MozDev - greasemonkey forum at Nabble.com.



More information about the Greasemonkey mailing list