js 初始化时如何建立二维数组
建立二维数据js数据的代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>js 初始化时建立二维数组</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<script>
function showMap(){
var showLine = new Array(["百度","http://www.baidu.com"],["400电话","http://www.my400800.cn"], ["谷歌","http://www.google.com.hk"]);
//var url = location.href;
//document.write(url);
for(var i=0;i<showLine.length;i++){
document.write("<br><a href='"+showLine[i][1]+"' title='"+showLine[i][0]+"'>"+showLine[i][0]+"</a>");
}
}
showMap();
</script>
</BODY>
</HTML>
运行结果如下: