technotool Posted June 8, 2008 Share Posted June 8, 2008 hi, I seem to be missing something. the onClick event ("Normals") is doing NOTHING. I am trying to set certain radio buttons to checked. Any help would be greatly appreciated. technotool FireFox 2.0.0.14 <html> <head> <script language="Javascript" type="text/javascript"> normalValues(){ var norm_ao = document.getElementById("pe_gen1"); var norm_nr = document.getElementByID("pe_gen3"); norm_ao.checked = true; norm_nr.checked = true; } </script> </head> <body> <br> <b>Physical Exam:</b><br> <form id="form_pe" method="" action=""> <a href="#" onClick="normalValues();">Normals</a> General<br> <input type="radio" name="pe_gen1" id="pe_gen1" value="alert and oriented x 3">A & O x3 <br> <input type="radio" name="pe_gen2" value="No apparent distress">NAD <input type="radio" name="pe_gen2" value="Obvious distress">Obvious distress<br> <input type="radio" name="pe_gen3" id="pe_gen3" value="normal respiation">Normal Respiration <input type="radio" name="pe_gen3" value="Labored Respiration">Labored Respiration <br> <input type="radio" name="pe_gen4" value="normal mood">Normal mood <input type="radio" name="pe_gen4" value="Depressed Mood">Depressed Mood<br> <button type="submit" value="submit">submit</button> <button type="reset" value="reset">reset </button> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/109270-onclick-event-not-working/ Share on other sites More sharing options...
nibbo Posted June 8, 2008 Share Posted June 8, 2008 A couple of things here. normalValues is a function so need to be declared as such and document.getElementByID should be document.getElementById. function normalValues(){ var norm_ao = document.getElementById("pe_gen1"); var norm_nr = document.getElementById("pe_gen3"); norm_ao.checked = true; norm_nr.checked = true; } Link to comment https://forums.phpfreaks.com/topic/109270-onclick-event-not-working/#findComment-560512 Share on other sites More sharing options...
technotool Posted June 8, 2008 Author Share Posted June 8, 2008 thanks so much. I knew that I was missing something. function!!! technotool Link to comment https://forums.phpfreaks.com/topic/109270-onclick-event-not-working/#findComment-560522 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.