Java Reference
In-Depth Information
could be used in an e‐commerce situation, to sell computers with the exact specifications determined by
the customer.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chapter 11: Example 6</title>
</head>
<body>
<form action="" name="form1">
<p>
Tick all of the components you want included on your computer
</p>
<p>
<label for="chkDVD">DVD-ROM</label>
<input type="checkbox" id="chkDVD" name="chkDVD" value="DVD-ROM" />
</p>
<p>
<label for="chkBluRay">Blu-ray</label>
<input type="checkbox" id="chkBluRay" name="chkBluRay"
value="Blu-ray" />
</p>
<p>
Select the processor speed you require
</p>
<p>
<input type="radio" name="radCpuSpeed" checked="checked"
value="3.2 ghz" />
<label>3.2 GHz</label>
<input type="radio" name="radCpuSpeed" value="3.7 ghz" />
<label>3.7 GHz</label>
<input type="radio" name="radCpuSpeed" value="4.0 ghz" />
<label>4.0 GHz</label>
</p>
<input type="button" value="Check form" name="btnCheck" />
</form>
<script>
var myForm = document.form1;
function getSelectedSpeedValue() {
var radios = myForm.radCpuSpeed;
for (var index = 0; index < radios.length; index++) {
if (radios[index].checked) {
return radios[index].value;
}
}
return "";
Search WWH ::




Custom Search