What new students often learn ~
<Script language = "javascript"> alert ('badwolf test! '); </Script> // prompt
<Script language = "javascript"> alert ('haha! '); </Script> // prompt
<Script language = "javascript"> alert (new Date (); </script> // read system time
<A href = "javascript: alert (new Date ();"> www.winshell.cn </a> // click to connect to the js running display time
<Input type = "button" onClick = "alert (new Date ()" value = "Click here"> // click Submit to display the js running time.
********************** For loop ************** *************
<Script>
Var badwolf_x = "";
For (var x = 1; x <= 100; x ++)
{
Badwolf_x = badwolf_x + "x =" + x;
}
Alert (badwolf_x );
</Script>
**************** *************
<Script>
Function get_sum ()
{
Var x = parseFloat (document. jisuanqi. no1.value );
Var y = parseFloat (document. jisuanqi. no2.value );
Var sum = x + y;
Alert (sum );
// Return sum;
}
</Script>
<Form name = "jisuanqi" action = "#">
<Input type = "text" name = "no1" value = "Enter the first number">
<Lable> + </lable>
<Input type = "text" name = "no2" value = "enter the second number">
<Input type = "button" value = "calculation" onclick = "get_sum ()">
</Form>
* ********************* If/else displays comments based on the score ********** *****
<Html>
<Head>
<Title> if/else displays comments based on the score </title>
</Head>
<Script>
Function dd ()
{
Var aa = document. form1.chengji. value;
If (aa <= 100 & aa> 90)
{
Alert ("excellent performance ");
}
Else if (aa <= 90 & aa> 75)
{
Alert ("Medium score ");
}
Else if (aa <= 75 & aa> = 60)
{
Alert ("pass ");
}
Else if (aa <60 & aa> = 0)
{
Alert ("fail ");
}
Else
{
Alert ("you are stupid ~~~!! Did you enter the score ???? ");
}
}
</Script>
<Body>
<Form name = "form1" action = "#">
<Lable> enter your score <lable> <input type = "text" name = "chengji"> <input type = "button" value = "to get comments !! "Onclick =" dd () ">
</Form>
</Body>
</Html>
***************
<Script>
Var x = 10;
Var y =-4;
If (x> 20)
{
If (y> 0)
{
Alert (x + y );
}
Else
{
Alert (x-y );
}
}
Else
{
Alert ('pipi ');
}
</Script>