日期:2014-05-16 浏览次数:20344 次
var parts_type_array = {"cpu":"CPU", "memory":"内存", "disk":"硬盘", "flash":"FLASH", "networkcard":"网卡", "diskback":"硬盘背板", "motherboard":"主板", "arraycard":"阵列卡", "directcard":"直连卡", "fans":"风扇", "power":"电源"}; for(key in parts_type_array){ alert(key+'-------'+parts_type_array[key]); } var parts_type_array2 = {"CPU":"cpu", "内存":"memory", "硬盘":"disk", "FLASH":"flash", "网卡":"networkcard", "硬盘背板":"diskback", "主板":"motherboard", "阵列卡":"arraycard", "直连卡":"directcard", "风扇":"fans", "电源":"power"}; for(key in parts_type_array2){ alert(key+'-------'+parts_type_array2[key]); }
var array2 = new Array(); array2["A"] = "a"; array2["B"] = "b"; array2["C"] = "c"; for (key in array2) { // 在输出正确数组前,会先输出许多函数信息 alert(key + '=====' + array2[key]); }
var name = "QQ"; var d = {}; d["d_0"] = "qq"; d["d_1"] = "QQ"; for (var j = 0; j < 2; j++){ if(name == d["d_"+j]){ alert("匹配成功"); } }
var name = "QQ"; var name_0 = "qq"; var name_1 = "QQ"; for (var j = 0; j < 2; j++){ if(eval("name == name_"+j)){ alert("匹配成功"); } }