
September 22nd, 2012, 06:13 AM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 2
Time spent in forums: 30 m 38 sec
Reputation Power: 0
|
|
|
Other - Checkbox toggle
Hi there,
Just learning the ropes and wondered if someone could assist with my form for an assignment.
The 3 x name= "regular service" options should appear only if the name="service" value "regular" button is checked. Otherwise they should be hidden.
Then, once a user selects one of these three values, they should be able to select one of the name ="years" fields.
Many thanks in advance.
<head>
<title>BuffetQuote 2012 </title>
<script type="text/javascript">
window.onload = function()
{
var toggle_object = document.form1.regularservice.value
if (document.form1.regular.checked)
{
toggle_object.style.display = "block";
}
else
{
toggle_object.style.display = "none";
}
}
</script>
</head>
<body>
<form action="script.url"name="form1">
<h1>Please select number of times the service is required</h1>
<input type="radio" name="service" value="onceonly" /> Once Only
<input type="radio" name="service" value="regular" /> Regular Service<br /> <br />
<input type="radio" name="regularservice" value="twelveyear" /> Once a month for a year
<input type="radio" name="regularservice" value="sixeyear" /> Once a month for six months
<input type="radio" name="regularservice" value="onceyear" /> Once a year
<br />
<input type="radio" name="years" value="oneyearcontract" /> 1 year contract
<input type="radio" name="years" value="twoyearcontract" /> 2 year contract
<input type="radio" name="years" value="threeyearcontract" /> 3 year contract
</form>
</body>
</html>
|