JS Getting Started Tutorial one (the role of web effects in AJAX example)
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title> New Document </title>
<style type= "Text/css Tutorial" >
<!--
DL {background-color: #000; color: #fff; width:100px;}
DT {cursor:pointer;width:100%;background-color: #666;}
. Expand {Overflow:visible}
. collaps tutorial e {height:16px;overflow:hidden;}
-->
</style>
<script language= "javascript" type= "Text/javascript" >
<!--
function Toggledl (DT) {
var Dl=dt.parentnode;
if ("Collapse" ==dl.classname) dl.classname= "expand";
else dl.classname= "collapse";
}
-->
</script>
<body>
<dl>
<dt onclick= "Toggledl (this)" > root node </dt>
<dd> Sub-node 1</dd>
<dd> Sub-node 2</dd>
<dd> Sub-node 3</dd>
<dd> Sub-node 4</dd>
</dl>
</body>
A simple multiplication table to add annotations to achieve the 99 multiplication table
<script language= "javascript" type= "Text/javascript" >
<!--
Here's the note.
var a=1; Comments can be followed by statements
/*
Program function: Print 99 multiplication table
Establishment Date: January 21, 2006
*/
Label1:for (var i=1;i<=9;i++) {
document.write ("<br>");
for (Var j=1;j<=9;j++) {
if (j>i) {
Continue Label1;
}
document.write (i+ "*" +j+ "=" +i*j+ " ");
}
}
-->
</script>
JS uses logical expression examples
<script language= "javascript" type= "Text/javascript"
<!--
//user entered the year to be judged
Var Year=prompt ("Enter the year for which you want to determine whether it is leap years:", 2000);
Year=parseint (year); //Optional: Convert year to numeric type
var check4= (0==year%4); / /Determine whether the year can be divisible by 4
var check100= (0==year%100), //Determine whether the year can be divisible by 100
var check400= (0==year%400); //Determines whether the year is divisible by 400
//gives a judgment result
if ((Check4 &&!check100) | | check400) alert (year+) is a leap year. ");
Else alert (year+) is not a leap year. ");
//-->
</script>