[Greasemonkey] Refrencing a field name without form name
Vectorspace
vectorspace at ntlworld.com
Tue Sep 19 07:30:18 EDT 2006
with getElementById, you don't need the form name in order to get the
field element
rejectpenguin wrote:
> So how could I do this without having the name of the form?
>
>
> A. Alfred Ayache wrote:
>
>> Yes, but if you gave the form element an ID, it would return the form
>> object.
>>
>> A. Alfred Ayache
>> http://lphs76.ca - Reunion community
>> http://www.rentersPlus.com - Apartment Search
>> http://www.lastbyte.ca - Web Design, eCommerce, PHP/MySQL, Java,
>> Oracle
>>
>>
>> Vectorspace wrote:
>>
>>> getElementById('fieldname') will return the field element, not the form
>>>
>>> rejectpenguin wrote:
>>>
>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Greasemonkey mailing list
>>> Greasemonkey at mozdev.org
>>> http://mozdev.org/mailman/listinfo/greasemonkey
>>>
>>> --------------------------------
>>> Spam/Virus scanning by CanIt Pro
>>>
>>> For more information see
>>> http://www.kgbinternet.com/SpamFilter.htm
>>>
>>> To control your spam filter, log in at
>>> http://filter.kgbinternet.com
>>>
>>>
>>>
>> _______________________________________________
>> Greasemonkey mailing list
>> Greasemonkey at mozdev.org
>> http://mozdev.org/mailman/listinfo/greasemonkey
>>
>>
>>
>
>
More information about the Greasemonkey
mailing list