On Thu, Jun 10, 2010 at 01:21, Toddintr <[email protected]> wrote: > Thank you Kwah and Jim. I inspected the page using Firebug and here's > the element for the customer id field: > > <input type="text" maxlength="9" class="field" name="textMARS"> > > The field is deep inside the page: nested inside a frame, then inside > a form, and inside a cell in a table. > > In my user script I have: > > document.getElementById('textMARS').focus(); > document.getElementById('textMARS').value = "1234567"; > > Unfortunately, I could not get it to work. I am able to print a > "hello world" message from the script so I know it is being invoked. > Could it be that I need to fully qualify the element because it's so > deep inside the page?
It's probably because 'textMARS' is not the id of the element but the name. Check out getElementsByName. More details here: http://www.w3schools.com/jsref/dom_obj_document.asp -- There are 10 kinds of people in the world: Those who understand binary and those who don't... -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
