[Greasemonkey] Refrencing a field name without form name

Rod McGuire mcguire at telerama.com
Mon Sep 18 01:16:55 EDT 2006


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.




More information about the Greasemonkey mailing list