<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title> New Document </title>
<script language= "javascript" type= "Text/javascript" >
<!--
function SayHello () {
document.write ("<strong>hello</strong>");
}
-->
</script>
<body>
<script language= "javascript" type= "Text/javascript" >
<!--
SayHello ();
-->
</script>
</body>
Look at an instance that gets the checkbox value
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title> New Document </title>
<body>
<form action= "somepage.asp tutorial" name= "Theform" >
<dl>
<dd><input type= "checkbox" Name= "Option1"/> Multiple personalities </dd>
<dd><input type= "checkbox" Name= "Option2"/> Lotte Philosophical </dd>
<dd><input type= "checkbox" Name= "Option3"/> Mature and stable </dd>
<dd><input type= "checkbox" Name= "Option4"/> Childish naughty </dd>
<dd><input type= "checkbox" Name= "Option5"/> Gentle and considerate </dd>
<dd><input type= "checkbox" Name= "Option6"/> Lively and lovely </dd>
<dd><input type= "checkbox" Name= "option7"/> Ordinary </dd>
<dd><input type= "checkbox" Name= "Option8"/> Introverted shyness </dd>
<dd><input type= "checkbox" Name= "Option9"/> Outgoing and cheerful </dd>
<dd><input type= "checkbox" Name= "Option10"/> Wit </dd> Humor
</dl>
<input name= "Submit" type= "Submission" value= "submitted"/>
</form>
</body>
<script language= "javascript" type= "Text/javascript"
<!--
Document.forms[0].elements["Submit" ].onclick=function () {
var checkedcount=0; //statistics selected
for (Var i=0;i<document.forms[0]. elements.length;i++) { //traverse all check boxes
if (document.forms[0].elements[i].checked) checkedcount++;
&NBSP}
if (checkedcount>5 | | checkedcount<3) {
alert ("The number of options is at least 3, no more than 5");
return false; //does not meet the requirements, returns false to cancel submitting
return true;
}
//-->
</script>