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"><head> 3 <meta http-equiv="Content-Type" content="text/html; charset=gbk"> 4 <title>用typeof查看数据类型</title> 5 <style type="text/css"> 6 pre{color:green;padding:10px 15px;background:#f0f0f0;border:1px dotted #333;font:12px/1.5 Coursier New;} 7 span{color:#999;} 8 </style> 9 </head> 10 <body> 11 <pre> 12 <script type="text/javascript"> 13 alert(typeof 12345); 14 alert(typeof "abc"); 15 alert(typeof document); 16 </script> 17 </pre> 18 <script type="text/javascript"> 19 alert("typeof 12345 ->" + typeof 12345 + " 20 typeof "abc"->"+ typeof "abc" + " 21 typeof document ->"+ typeof document); 22 </script> 23 </body> 24 </html>