[Greasemonkey] Refrencing a field name without form name

rejectpenguin rejectpenguin at gmail.com
Mon Sep 18 10:17:08 EDT 2006


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
> 
> 

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



More information about the Greasemonkey mailing list