<!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=utf-8" />
<title>jsonºÍÊý×é</title>
<script>
var json={a:12, b:5, c:7};
var arr=[12,5,7];
//alert(json.a);
//alert(json[¡®a¡®]);//jonsµÄϱêÊÇ×Ö·û´®
//alert(arr[0]);//Êý×éµÄϱêÊÇÊý×Ö
//alert(arr.length);//Êä³ö3
//alert(json.length);//Êä³öundefined,jsonûÓÐlength
//Ñ»·
/*for(var i=0;i<arr.length;i++)
{
alert(¡®µÚ¡®+i+¡®¸öÔªËØ:¡®+arr[i]);
}*/
/*for(var i in arr)
{
alert(¡®µÚ¡®+i+¡®¸öÔªËØ:¡®+arr[i]);
}*/
for(var i in json)
{
alert(¡®µÚ¡®+i+¡®¸öÔªËØ:¡®+json[i]);
}
</script>
</head>
<body>
</body>
</html>
¡¾JSѧϰ¡¿JS»ù´¡2
±êÇ©£ºals for onload load false doctype rip Êä³ö Çé¿ö
¡¡