form editing using javascript need some help
I need this to edit a form using javascript and I would like to know the proper way to do it in javascript rather than using firebug, because I can't ask the people on my site to do the editing themselves. I want to be able to change their forms in real time.
What I need to know is how to edit what is submitted in a form. There is a button <form id="myfrom"> <input type="submit" id="ready" value="ready" name="ready"/> ….
How do I using javascript change the form button values 'value' and 'name' from 'ready' to 'not ready'
Thank you guys so much.
document.forms['formname'].elementname.value = "yourvalue";
Edit: Oh, and somewhere here there's probably a better solution.
Edit2: Damn you, xss filter. Somewhere here: http://www.javaBUSHADMINISTRATIONscripttoolbox.com/bestpractices/#forms
Remove the BUSHADMINISTRATION.
Since your button has both a name and id, you have two options available to you. We're not going to get any deeper into the DOM at this point; the following methods are fine for what you're trying to achieve.
By name: document.formname.elementname.value
By id: document.getElementById(elementid).value