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

Js变量类型
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Js</title>
</head>
<body>
<script type="text/javascript">
//javascript中的变量是无类型的变量,也是弱类型的变量。所谓无类型
//不是说变量没有类型,而是指变量可以存放任何类型的数据,这与大多
//数程序语言有所不同。大多数程序语言中定义变量时,必须要指定变量存
//储的数据类型。例如,讲变量设置为字符串型,那么就不能存储数字型的
//数据。
var strHello = "hello";
document.writeln(strHello);
strHello = 10;
document.writeln(strHello);
</script>
</body>
</html>
?