<!DOCTYPE HTML> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>数组</title> <script type="text/javascript"> //创建数组 var arr = ['*','##',"***","&&","****","##*"]; arr[7] = "**"; //显示数组长度 alert.(arr.length); //将数组内容输出,完成达到的效果。 document.write(arr[0]+"<br/>"); document.write(arr[7]+"<br/>"); document.write(arr[2]+"<br/>"); document.write(arr[4]+"<br/>"); </script> </head> <body> </body> </html>
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数组</title>
<script type="text/javascript">
//创建数组
var arr = ['*','##',"***","&&","****","##*","**"];
arr[7] = "**";
//显示数组长度
document.write("arr的长度:"+arr.length+'<br>');
//将数组内容输出,完成达到的效果。
document.write(arr[0]+'<br>');
document.write(arr[6]+'<br>');
document.write(arr[2]+'<br>');
document.write(arr[4]+'<br>');
</script>
</head>
<body>
</body>
</html>
这个可以
你的alert后面打多了一个点