JS Getting Started Tutorial one (JavaScript's role paradigm in Ajax)

Source: Internet
Author: User

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+ "&nbsp; ");
}
}

-->
</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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.