<script type="text/javascript">
var name=['A','B','C','D','E','F','G','H','I','J'];
var sex=["女","男","男","女","女","男","女","女","女","男"];var age=[21,23,24,21,22,21,22,20,20,20];
var aclass=["大一","大三","大四","大一","大四","大一","大四","大一","大二","大三","大一","大三"];
var person=[name,sex,age,aclass];
//第一步把之前的数据写成一个数组的形式,定义变量为 infos
for(var i=0;i<10;i++){
var infos=person[3][i];
if(infos=="大一"){
var infoa=person[1][i];
if(infoa=="女"){
document.write(person[0][i]+"<br />");
}
}
}
你把数组名name换个名字就好了,,比如用var names=[............]
https://segmentfault.com/q/1010000006679126
我在这里看到了你想要的答案。说的是:
window.name 是 DOM 对象 window的一个属性name 主要用于为超链接和表单设置目标(target)window。
具体原理,我也不清楚,猜测是name原本的预设的功能并没有失效导致的混乱吧。要是你查到了,烦请告诉我答案。
结果了然,只是原理问题,正在询问度娘 - -
把name 变量名字改了就可以了
<!DOCTYPE HTML> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>流程控制语句</title> <script type="text/javascript"> var infos=[["小A","女",21,"大一"],["小B","男",23,"大三"],["小C","男",24,"大四"],["小D","女",21,"大一"],["小E","女",22,"大四"],["小F","男",21,"大一"],["小G","女",22,"大二"],["小H","女",20,"大三"],["小I","女",20,"大一"],["小J","男",20,"大三"]]; for(var i=0;i<infos.length;i++) { if(infos[i][1]=="女"&&infos[i][3]=="大一") document.write(infos[i][0]); } </script> </head> <body> </body> </html>
这是我过关的代码。。我也讲不出什么 理解,记住 就好了
自己百度吧,,,好像是浏览器的什么关键字