Jump to content

onClick event not working


technotool

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.