hi there
thank you for helping me before but i have new problem with javascript i need to disable the selection list wheb the checkboxes are unchecked and enable when they are checked
this my code so far
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>task2.htm</title>
<script type="text/javascript">
<!--
function setBoxes(obj)
{
if (obj.value=="yes")
{
for (i=0; i<document.getElementById("test").classes.length; i++)
document.getElementById("test").classes[i].disabled=false;
}
else
{
for (i=0; i<document.getElementById("test").classes.length; i++)
document.getElementById("test").classes[i].disabled=true;
}
}
function checkForm() {
var el = document.forms[0].elements;
for(var i = 0 ; i < el.length ; ++i) {
if(el[i].type == "radio") {
var radiogroup = el[el[i].name];
var itemchecked = false;
for(var j = 0 ; j < radiogroup.length ; ++j) {
if(radiogroup[j].checked) {
itemchecked = true;
break;
}
}
if(!itemchecked) {
alert("Please Answer Question One");
if(el[i].focus)
el[i].focus();
return false;
}
}
}
return true;
}
//-->
</script>
<style type="text/css">
<!--
body {background:#DDA0DD; color:#8A2BE2 ; font-size:1.0em;
font-family: verdana;}
h1 { font-family: sans-serif;font-size:1.3em}
h2 { font-family: sans-serif;font-size:1.2em}
-->
</style>
</head>
<body>
<form id="test" method="post" action="http://tl28serv.uws.edu.au/twainfo/form.asp" onsubmit="return checkForm(this);" >
<script type="text/javascript">
<!--
function select(obj)
{
if (obj.name=="classes")
{
for (i=0; i<document.getElementById("test").class.length; i++)
document.getElementById("test").class[i].disabled=false;
}
else
{
for (i=0; i<document.getElementById("test").class.length; i++)
document.getElementById("test").class[i].disabled=true;
}
}
//-->
</script>
<h1> Get Me Fit Quick-Quick Member Survey </h1>
<h2> Please Take a minute to fill in the form below. We Value Your Feedback-Thanks</h2>
<p> 1. How many times per week Have you been visiting our Gymnasium since becoming
a member?<br/>
<input type="radio" name="visites" value="yes" onclick="setBoxes(this);" />Once per week<br/>
<input type="radio" name="visites" value="yes" onclick="setBoxes(this);" /> Twice a week<br/>
<input type="radio" name="visites" value="yes" onclick="setBoxes(this);" /> Three times a week<br/>
<input type="radio" name="visites" value="yes" onclick="setBoxes(this);" /> Four or more times per a week <br/>
<input type="radio" name="visites" value="no" onclick="setBoxes(this);"/> I have not visited since joining (sigh) </p>
<p> 2. Which our classes have you attended?<br/>
<input type="checkbox" name="classes" value="1" onclick="select(this);" /> Aerobics<br/>
<input type="checkbox" name="classes" value="2" onclick="select(this);" /> Boxing<br/>
<input type="checkbox" name="classes" value="3" onclick="select(this);" /> Circuit Class<br/>
<input type="checkbox" name="classes" value="4" onclick="select(this);" /> Weight Training </p>
<p> 3. Which of the above classes has been <b> most</b> beneficial for you?<br/>
(You can only choose one from list)<select name="class" size="1" style="color:#FFFFFF; background-color:#8A2BE2">
<option value="Choose"> - -Please Choose- - </option>
<option value="AER">Aerobics</option>
<option value="Box">Boxing</option>
<option value="Circuit">Circuit Class</option>
<option value="Weight">Weight Training</option></select></p>
<p> 4.Do you think you are recieving good value for money from your membership?<br/>
<input type="radio" name="value" value="yes" />Yes<br/>
<input type="radio" name="value" value="no" />No</p>
<p> 5. If you answered Yes to question above, how much <b> MORE</b> would you be willing to pay<br/>
for your membership?$ <input type="text" name="money" style=" background-color:#8A2BE2;border:0px;color:#FFFFFF ;" /></p>
<p>Today's Date
<!-- this is java script to represent current date -->
<script type="text/javascript">
<!-- hide from old browsers
var today = new Date()
var month = today.getMonth()+1
var year = today.getYear()
var day = today.getDate()
if(day<10) day = "0" + day
if(month<10) month= "0" + month
if(year<1000) year+=1900
document.write("<input name=date type=text readonly=readonly value=" + day + "/" + month + "/" + year + ">")
//-->
</script> </p>
<p> <input type="submit" value="Finshed Survey" style=" background-color:#8A2BE2;color:#FFFFFF ; border:1.0px;border-color:#FFFFFF" ONCLICK= "return checkForm()"/>
<input type="reset" value="Reset Survey" style=" background-color:#8A2BE2;color:#FFFFFF ; border:1px"/></p>
</form>
</body>
</html>