日期:2014-05-16  浏览次数:20393 次

JavaScript基本类型

JavaScript基本类型

?

一.布尔型


?

二.字符串型


?

三.数值型



?

四.函数



??

附源代码:

?

1.布尔型?

<!DOCTYPE HTML PUBLIC "-//W 3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>JavaScript Boolean型测试</title>

</head>

 

<body>

       <div align="center">

       <B>布尔型</B></div><br>

       <table align="center" border="1" width="70%">

              <tr> 

                     <th>序号</th>

                     <th>表达式</th>

                     <th>值</th>

              </tr>

              <tr>

                     <td>1</td>

                     <td>+true</td>

                     <td><input id=res1></input></td>

              </tr>

              <tr>

                     <td>2</td>

                     <td>+false</td>

                     <td><input id=res2></input></td>

              </tr>

              <tr>

                     <td>3</td>

                     <td>parseInt(true)</td>

                     <td><input id=res3></input></td>

              </tr>

              <tr>

                     <td>4</td>

                     <td>parseInt(false)</td>

                     <td><input id=res4></input></td>

              </tr>

              <tr>

                     <td>5</td>

                     <td>true + ""</td>

                     <td><input id=res5></input></td>

              </tr>

              <tr>

                     <td>6</td>

                     <td>false + ""</td>

                     <td><input id=res6></input></td>

              </tr>

              <tr>

                     <td>7</td>

                     <td>new Boolean(true)</td>

                     <td><input id=res7></input></td>

              </tr>

              <tr>

                     <td>8</td>

                     <td>new Boolean(false)</td>

                     <td><input id=res8></input></td>

              </tr>

              <tr>

                     <td>9</td>

                     <td>new Boolean("true")</td>

                     <td><input id=res9></input></td>

              </tr>

              <tr>

                     <td>10</td>

                     <td>new Boolean("false")</td>

                     <td><input id=res10></input></td>

              </tr>

              <tr>

                     <td>11</td>

                     <td>true == "0"</td>

                     <td><input id=res11></input></td>

              </tr>

              <tr>

                     <td>12</td>

                     <td>false == "0"</td>

                     <td><input id=res12></input></td>

              </tr>

              <tr>

                     <td>