gina4uncc
11-28-2005, 12:12 AM
Ive got most of the code, i just cant seem to get it to run......
Please help!!!!!!!!! :confused:
<html>
<head>
<title> Check boxes and Radio buttons </title>
<script type="text/javascript">
function displayMessage (f) {
//Check the boxes
if (f.airCB [0].checked) {
alert ("Keep it cool!")
}
else if (f.sunroofCB[1].checked){
alert ("Feel the fresh air!")
}
else if (f.audioCB[2].checked) {
alert ("Crank it up!")
}
//Check the radio buttons
if (f.colorRB [0].checked == true) {
alert ("Nice and cool!")
}
else if (f.colorRB[1].checked == true) {
alert ("Refreshing!")
}
else if (f.colorRB[2].checked == true) {
alert ("Who likes it hot?")
}
//Check the popup menu
if (f.selectedIndex.checked ==0) {
alert("Go for the caffeine!")
}
else if (f.selected.Index.checked ==1){
alert ("Who needs cola?")
}
else if (f.selectedIndex.checked ==2){
alert ("Goes down smooth!")
}
</script>
</head>
<body>
<form id ="survey" name ="survey">
<strong> Please select the options you desire (check any or all): </strong> <br/>
<input type= "checkbox" name = "airCB" />Air condtioning <br />
<input type="checkbox" name ="sunroofCB"/>Sunroof <br/>
<input type="checkbox" name ="audioCB"/> Deluxe audio system<br/>
<strong> Select your favorite color:</strong><br/>
<input type="radio" name="color"[0]RB" />Blue<br/>
<input type="radio" name="color"[1]RB"/>Green<br/>
<input type="radio" name="color:[2]RB"/>Red<p>
<strong> Select your favorite soft drink type: </strong><br/>
<input name= "sodaMenu">
<option>Cola
<option>Lemon-Lime
<option>Root beer
</input>
<input type="button" name="b1" value="Click when finished"
onclick="displaymessage(document.survey)"/>
</form>
</body>
</html>
Please help!!!!!!!!! :confused:
<html>
<head>
<title> Check boxes and Radio buttons </title>
<script type="text/javascript">
function displayMessage (f) {
//Check the boxes
if (f.airCB [0].checked) {
alert ("Keep it cool!")
}
else if (f.sunroofCB[1].checked){
alert ("Feel the fresh air!")
}
else if (f.audioCB[2].checked) {
alert ("Crank it up!")
}
//Check the radio buttons
if (f.colorRB [0].checked == true) {
alert ("Nice and cool!")
}
else if (f.colorRB[1].checked == true) {
alert ("Refreshing!")
}
else if (f.colorRB[2].checked == true) {
alert ("Who likes it hot?")
}
//Check the popup menu
if (f.selectedIndex.checked ==0) {
alert("Go for the caffeine!")
}
else if (f.selected.Index.checked ==1){
alert ("Who needs cola?")
}
else if (f.selectedIndex.checked ==2){
alert ("Goes down smooth!")
}
</script>
</head>
<body>
<form id ="survey" name ="survey">
<strong> Please select the options you desire (check any or all): </strong> <br/>
<input type= "checkbox" name = "airCB" />Air condtioning <br />
<input type="checkbox" name ="sunroofCB"/>Sunroof <br/>
<input type="checkbox" name ="audioCB"/> Deluxe audio system<br/>
<strong> Select your favorite color:</strong><br/>
<input type="radio" name="color"[0]RB" />Blue<br/>
<input type="radio" name="color"[1]RB"/>Green<br/>
<input type="radio" name="color:[2]RB"/>Red<p>
<strong> Select your favorite soft drink type: </strong><br/>
<input name= "sodaMenu">
<option>Cola
<option>Lemon-Lime
<option>Root beer
</input>
<input type="button" name="b1" value="Click when finished"
onclick="displaymessage(document.survey)"/>
</form>
</body>
</html>