Ferris教程学习笔记:js示例3.1 用typeof查看数据类型

 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  &lt;script type="text/javascript"&gt;
13   alert(typeof 12345);
14   alert(typeof "abc");
15   alert(typeof document);
16  &lt;/script&gt;
17 </pre>
18 <script type="text/javascript">
19  alert("typeof 12345 ->" + typeof 12345 + "\
20        \n\n typeof \"abc\"->"+ typeof "abc" + "\
21        \n\n typeof document ->"+ typeof document);
22 </script>
23 </body>
24 </html>

 

posted @ 2013-12-13 16:36  kaka100  阅读(198)  评论(0编辑  收藏  举报