}else{
image.src="images/pic_bulboff.gif";
}
}
*html
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF‐8">
<title>HelloJavaScript</title>
<scriptsrc="js/m.js"></script>
</head>
<body>
<imgid="image"src="images/pic_bulboff.gif"onclick="changeImage();">
</body>
</html>
*案例二
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF‐8">
<title>JS基本语法演示</title>
<script>
//document.write("HelloWorld");
/*document.write("HelloWorld");*/
//document.write("HelloWorld");
//number,string,boolean,null,undefined
letnum1=10;
letnum2=99.9;
letstr1="hello";
letstr2="world";
letflag1=true;
letflag2=false;
letobj=null;
letobj2;
document.write(num1+":"+typeofnum1+"<br>");
document.write(num2+":"+typeofnum2+"<br>");
document.write(str1+":"+typeofstr1+"<br>");
document.write(str2+":"+typeofstr2+"<br>");
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46