(011)javascript语法基础
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>妙味课堂</title> 6 <script type="text/javascript"> 7 8 var a = 5; 9 10 //alert(typeof a); //number类型 11 12 a = 'abc'; 13 14 //alert(typeof a); //string类型 15 16 a = true; 17 18 //alert(typeof a); //boolean类型 19 20 a = function() { 21 alert("function"); 22 }; 23 24 //alert(typeof a); //function类型 25 26 /* 27 undifine (1)变量未定义 (2)变量定义了未存放数据 28 */ 29 var b; 30 31 //alert(typeof b);//undefined类型(b中未存放数据,无法确定类型) 32 33 window.onload = function() { 34 35 var div = document.getElementById("div1"); 36 //alert(typeof div); 37 alert(typeof document); 38 } 39 40 </script> 41 </head> 42 43 <body> 44 <div id="div1"></div> 45 </body> 46 </html>
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号