嘿,请帮我解决这个问题,我想添加许多变量并让他们检查数组,但它不起作用。我希望它检查文本框中的所有文本,如果它与数组相同,那么它将提供警报。这是我的代码
function setValue(){
myVariable= document.forms["myform"]["gname"].value;
myVariable1= document.forms["myform"]["graphic"].value;
myVariable2= document.forms["myform"]["gpc"].value;
myVariable3= document.forms["myform"]["procesor"].value;
myVariable4= document.forms["myform"]["ram"].value;
myVariable5= document.forms["myform"]["os"].value;
var graphic = ["radeon hd", "nvidia"];
var gname = ["prince of persia", "grand theft auto"];
var gpc = ["radeon hd 121", "nvidia 121"];
var procesor = ["intel i7", "intel i5", "intel i3"];
var os = ["Windows 7", "Windows 8", "Windows xp"];
var ram = ["4 Gb", "8 Gb", "12 Gb"];
var canRun = false;
for(i=0;i<ram.length;i++)
(i=0;i<gpc.length;i++)
(i=0;i<os.length;i++)
(i=0;i<procesor.length;i++)
(i=0;i<gname.length;i++)
(i=0;i<graphic.length;i++)
{
if (myVariable5 === os[i] && myVariable4 === ram[i] && myVariable3 === procesor[i] && myVariable2 === gpc[i] && myVariable1 === graphic[i] && myVariable === gname[i])
{
canRun = true;
}
}
if (canRun)
{
alert("yes this game can run");
}
else
{
alert("No, This game cannot run");
}
};