Jump to content

Recommended Posts

How can I invoke an "onclick" event for a radio button of two choices Yes or No. 

<script type= "text/javascript">
function ValueChanged()
{
alert("Function Called");
if(document.getElementById("InsertRecordMetalic_Injury")[1].checked == true;){
document.getElementById("InsertRecordPrior_Surgery")[1].style.background = "yellow";
}
document.getElementById("InsertRecordPhone").focus();

}

document.getElementById("InsertRecordPrior_Surgery")[1].onclick= ValueChanged;

</script>

Link to post
Share on other sites

The ID of a radio button does not seem to be correct. Refer to

It should be something like, InsertRecordMetalic_Injury0, InsertRecordMetalic_Injury1 ....

Also you do not need == true

 

 <script type= "text/javascript">
function ValueChanged()
{
alert("Function Called");
if(document.getElementById("InsertRecordMetalic_Injury0").checked){
document.getElementById("InsertRecordPrior_Surgery0")0.style.background = "yellow";
}
document.getElementById("InsertRecordPhone").focus();

}

document.getElementById("InsertRecordPrior_Surgery0").onclick= ValueChanged;

</script> 

But I am not sure how to change the background color

Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...