首页 新闻 会员 周边 捐助

请问这是一个二维数组吗?

0
[已解决问题] 解决于 2016-12-21 22:26
var dd = [
{
project: [{
text: "第一课"
},
{
text: "控制Div属性",
href: "lesson1/01.html"
},
{
text: "网页换肤",
href: "lesson1/02.html"
},
{
text: "函数接收参数并弹出",
href: "lesson1/03.html"
},
{
text: "用循环将三个Div变成红色",
href: "lesson1/04.html"
},
{
text: "鼠标移入/移出改变样式",
href: "lesson1/05.html"
},
{
text: "记住密码提示框",
href: "lesson1/06.html"
}]
},
{
project: [{
text: "第二课"
},
{
text: "百度输入法",
href: "lesson2/01.html"
},
{
text: "点击Div,显示其innerHTML",
href: "lesson2/02.html"
},
{
text: "求出数组中所有数字的和",
href: "lesson2/03.html"
},
{
text: "弹出层效果",
href: "lesson2/04.html"
},
{
text: "函数传参,改变Div任意属性的值",
href: "lesson2/05.html"
},
{
text: "图片列表:鼠标移入/移出改变图片透明度",
href: "lesson2/06.html"
},
{
text: "简易选项卡",
href: "lesson2/07.html"
},
{
text: "简易JS年历",
href: "lesson2/08.html"
},
{
text: "单一按钮显示/隐藏一播放列表收缩展开",
href: "lesson2/09.html"
},
{
text: "提示框效果",
href: "lesson2/10.html"
},
{
text: "鼠标移过,修改图片路径",
href: "lesson2/11.html"
},
{
text: "复选框(checkbox)全选/全不选/返选",
href: "lesson2/12.html"
}]
},
{
project: [{
text: "第三课"
},
{
text: "用typeof查看数据类型",
href: "lesson3/01.html"
},
{
text: "用parseInt解析数字,并求和",
href: "lesson3/02.html"
},
{
text: "累加按钮,自加1",
href: "lesson3/03.html"
},
{
text: "输入两个数字,比较大小",
href: "lesson3/04.html"
},
{
text: "页面加载后累加,自加1",
href: "lesson3/05.html"
},
{
text: "判断数字是否为两位数",
href: "lesson3/06.html"
},
{
text: "网页计算器",
href: "lesson3/07.html"
},
{
text: "简易网页时钟",
href: "lesson3/08.html"
},
{
text: "倒计时时钟(100秒)",
href: "lesson3/09.html"
}]
},
{
project: [{
text: "第四课"
},
{
text: "setTimeout应用",
href: "lesson4/01.html"
},
{
text: "自动播放一幻灯片效果",
href: "lesson4/02.html"
},
{
text: "自动改变方向一幻灯片效果",
href: "lesson4/03.html"
},
{
text: "agruments应用一求出函数参数的总合",
href: "lesson4/04.html"
},
{
text: "css函数一设置/读取对象的属性",
href: "lesson4/05.html"
},
{
text: "当前输入框高亮显示",
href: "lesson4/06.html"
},
{
text: "数组练习:各种数组方法的使用",
href: "lesson4/07.html"
},
{
text: "事件练习:封装兼容性添加、删除事件的函数",
href: "lesson4/08.html"
},
{
text: "星级评分系统",
href: "lesson4/09.html"
}]
},
{
project: [{
text: "第五课"
},
{
text: "模拟select控件",
href: "lesson5/01.html"
},
{
text: "点击页面,显示单击的坐标",
href: "lesson5/02.html"
},
{
text: "用户按下键盘,显示keyCode",
href: "lesson5/03.html"
},
{
text: "阻止右键菜单(阻止默认事件)",
href: "lesson5/04.html"
},
{
text: "跟随鼠标移动(大图展示)",
href: "lesson5/05.html"
},
{
text: "自定义右键菜单",
href: "lesson5/06.html"
},
{
text: "用键盘控制Div",
href: "lesson5/07.html"
},
{
text: "Div闪烁",
href: "lesson5/08.html"
}]
},
{
project: [{
text: "第六课"
},
{
text: "完美拖拽",
href: "lesson6/01.html"
},
{
text: "仿腾讯微博效果",
href: "lesson6/02.html"
},
{
text: "自定义多级右键菜单",
href: "lesson6/03.html"
}]
},
{
project: [{
text: "第七课"
},
{
text: "自动轮播广告(缓冲效果)",
href: "lesson7/01.html"
},
{
text: "图片切换(Loading效果)",
href: "lesson7/02.html"
},
{
text: "移动效果(按轨迹移动)",
href: "lesson7/03.html"
}]
},
{
project: [{
text: "第八课"
},
{
text: "iPhone手机解锁效果",
href: "iphone-unlock"
},
{
text: "自定义滚动条",
href: "lesson8/01.html"
},
{
text: "拖拽一Clone",
href: "lesson8/02.html"
},
{
text: "拖拽并可以改变大小",
href: "lesson8/03.html"
}]
},
{
project: [{
text: "第九课"
},
{
text: "仿苹果电脑任务栏菜单",
href: "lesson9/01.html"
},
{
text: "拼图小游戏",
href: "lesson9/02.html"
},
{
text: "模拟表单控件",
href: "lesson9/03.html"
}]
},
{
project: [{
text: "第十课"
},
{
text: "为数组添加方法(求和,最大值)",
href: "lesson10/01.html"
},
{
text: "自动轮播广告(面向对象版)",
href: "lesson10/02.html"
},
{
text: "运动框架(面向对象版)",
href: "lesson10/03.html"
},
{
text: "照片墙一多实例演示(面向对象版)",
href: "lesson10/04.html"
},
{
text: "拖拽库(面向对象版)",
href: "lesson10/05.html"
},
{
text: "无缝滚动(面向对象版)",
href: "lesson10/06.html"
},
{
text: "延时加载(面向对象版)",
href: "lesson10/07.html"
},
{
text: "仿腾讯游戏《英雄杀》官网Flash效果",
href: "lesson10/08.html"
},
{
text: "百度有啊通栏展示效果",
href: "lesson10/09.html"
},
{
text: "放烟花效果(面向对象版)",
href: "lesson10/10.html"
},
{
text: "《穿越火线》官网导航菜单",
href: "lesson10/11.html"
},
{
text: "《百度风云榜》TAB切换",
href: "lesson10/12.html"
},
{
text: "IBM官网导航条效果",
href: "lesson10/13.html"
},
{
text: "面试题-动态生成表格",
href: "lesson10/14.html"
}]
},
{
project: [{
text: "项目实例"
},
{
text: "眼镜在线试戴",
href: "eyeglass"
},
{
text: "日历组件",
href: "calendar"
},
{
text: "淘宝网-迷你登录",
href: "taobao-login"
},
{
text: "仿Google+ 游戏频道焦点图效果",
href: "google"
}]
},
{
project: [{
text: "YUI实例"
},
{
text: "淘宝旅行通用日历组件",
href: "calendar/trip-calendar"
},
{
text: "酒店价格日历",
href: "calendar/price-calendar"
}]
},
{
project: [{
text: "KISSY实例"
},
{
text: "KISSY版-酒店价格日历",
href: "calendar/hotel-price-calendar"
},
{
text: "KISSY版-图片浏览组件",
href: "lightbox"
},
{
text: "酒店地图交通与周边",
href: "rich-map"
},
{
text: "多SKU酒店价格中心",
href: "price-center/hotel"
},
{
text: "多SKU门票价格中心",
href: "price-center/ticket"
},
{
text: "新版-多SKU门票价格中心",
href: "price-center/newticket"
}]
},
]
vickysi的主页 vickysi | 初学一级 | 园豆:199
提问于:2016-09-29 00:34
< >
分享
最佳答案
0

不是.是一维数组.

奖励园豆:5
吴瑞祥 | 高人七级 |园豆:29449 | 2016-09-29 10:15

其实这个数据是一个函数的参数,函数内部是这样用的:

function myFunc(data){

var project = data[0].project;

for(var i=0;i<project.length;i++){

project[i].text;

project.href;

}
}

像是二维数组

vickysi | 园豆:199 (初学一级) | 2016-09-29 10:29

纠正:project[i].href

vickysi | 园豆:199 (初学一级) | 2016-09-29 10:30

@vickysi: data[0][0],这种才是二维数组.你这个是一维数组.只是数组元素的一个属性值还是一个数组.

吴瑞祥 | 园豆:29449 (高人七级) | 2016-09-29 10:36
其他回答(3)
0

json结构可以算是2维数组

2012 | 园豆:21645 (高人七级) | 2016-09-29 08:34

这是json结构吗

支持(0) 反对(0) vickysi | 园豆:199 (初学一级) | 2016-09-29 10:31
0

数组的维度,可以这样看[a,b],元素数量是a*b

悦光阴 | 园豆:2251 (老鸟四级) | 2016-09-29 09:47
0

很明显是json结构,应该也可以算作二维数组吧

风归云隐 | 园豆:416 (菜鸟二级) | 2016-09-29 10:35

谢谢解惑,我觉的这个回答更贴切:data[0][0],这种才是二维数组.你这个是一维数组.只是数组元素的一个属性值还是一个数组.

支持(0) 反对(0) vickysi | 园豆:199 (初学一级) | 2016-09-29 10:48

@vickysi: 好像是

支持(0) 反对(0) 风归云隐 | 园豆:416 (菜鸟二级) | 2016-09-29 15:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册