I have a few scripts in a PHP suite that use some simple JavaScript functions, but a couple of them don’t work in Firefox.
I only use JavaScript occasionally, so I forget even the simplest stuff. Does anyone know of a simple, step by step, easy to follow, cross browser DOM reference guide?
OR
Specifically, I need to know how to read data in textboxes, checkboxes, radio buttons, selects and textareas, and then how to write data in the same, or in the case of the select, just select an option. (*see below for form code)
I tried the little tutorial at w3schools.com, but they use methods that look a tad more complicated than I suspect they need to be, and they also reference the form and its elements by their numbers rather than by their names, which is a pain somewhere a little lower than my neck.
And can someone please tell me when I should use name=”somename” and when I should use id=”somename” (and when, as seems common, I should use both)?
Any help, as always, greatly appreciated.
Thanks
CTB
PS. As I am a self confessed simpleton when it come to JavaScript, if anyone wants to try to give me some examples, please relate them to the elements in this form.
<form id=”myform” name=”myform” action=”someaction.php” target=”_top”>
<input type=”text” name=”myname” value=”Chester The Bear”><br />
<input type=”checkbox” name=”mycheckbox” value=”Y” checked><br />
<input type=”radio” name=”radio” value=”V1″><br />
<input type=”radio” name=”radio” value=”V2″ checked “><br />
<textarea name=”mytextarea”>Some very boring text here</textarea><br />
<select name=”myselect”>
<option value=”1″>First Line</option>
<option value=”2″>Second Line</option>
</select>
<input type=”submit” value=”Submit This”>
<form>