Help me with this code I cannot seem to get it to work!
I need to make this function work for a school project
which requires a form to be validated. The rest of the code works but I cannot seem to get this bit to. I need to make it so when one of the radio buttons is clicked a confirmation box is brought up, with the name of the button pressed.
Eg. "You have selected ______. Are You Sure"
The blank space is where the bit needs to be.
Then when cancel is pressed the radio buttons are all unchecked.
It also must be in one function. Any help would be appreciated.
Here is what I have so far:
<html>
<head>
<script language="JavaScript">
function checkbox() {
var confirmboxyes = confirm("You've selected. Are you sure?");
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Ive made alterations to the code but I cannot seem to get the value of the radio buttons to be displayed in the confirm box, i was getting "invalid" for a while, but now it wont work entirely.
Heres what I have changed:
<html>
<head>
<script language="JavaScript">
function checkbox() {
var confirmboxyes = confirm("You've selected " + Selected + ". Are you sure?");
var Selected = "";
if (document.getElementsById("cats").checked == true) {Selected = document.getElementsById("cats").value;}
if (document.getElementsById("dogs").checked == true) {Selected = document.getElementsById("dogs").value);}
if (document.getElementsById("birds").checked == true) {Selected = document.getElementsById("birds").value);}
Bookmarks