51 lines
1.5 KiB
HTML
Executable File
51 lines
1.5 KiB
HTML
Executable File
<html>
|
|
<head>
|
|
<title>Example 6.5</title>
|
|
<script>
|
|
function checkIt()
|
|
{
|
|
document.getElementById("tibet").checked=true
|
|
}
|
|
function uncheckIt()
|
|
{
|
|
document.getElementById("tibet").checked=false
|
|
}
|
|
function pick_sides()
|
|
{
|
|
var flag = false;
|
|
var i =0;
|
|
var side1 = "";
|
|
var side2 = "";
|
|
for (i = 1; i <= 7; i++)
|
|
{
|
|
if ((document.getElementById(i).checked == true) && (flag == false))
|
|
{
|
|
side1 = document.getElementById(i).value;
|
|
flag = true;
|
|
}
|
|
else if ((document.getElementById(i).checked == true) && (flag == true))
|
|
side2 = document.getElementById(i).value;
|
|
|
|
}
|
|
document.getElementById('side_one').innerHTML = side1;
|
|
document.getElementById('side_two').innerHTML = side2;
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<table width = 60% align = "center"><tr><td><br />
|
|
<h2> Where do you live?</h2>
|
|
<input type="checkbox" name="country" id="argentina" value="Argentina" >Argentina<br />
|
|
<input type="checkbox" name="country" id="china" value="China" >China<br />
|
|
<input type="checkbox" name="country" id="france" value="France">France<br />
|
|
<input type="checkbox" name="country" id="italy" value="Italy">Italy<br />
|
|
<input type="checkbox" name="country" id="spain" value="Spain">Spain<br />
|
|
<input type="checkbox" name="country" id="tibet" value="Tibet">Tibet<br />
|
|
<input type="checkbox" name="country" id="usa" value="United States">United States<br />
|
|
<p><button onclick="checkIt()">Check Tibet</button>
|
|
<button onclick="uncheckIt()">Uncheck Tibet</button></p>
|
|
</td></tr></table>
|
|
</body></html>
|