0

在体内,我有以下内容:

<body onload="loadCheck1();">

这指向以下功能:

function loadCheck1() {

var chkme1 = "<?php echo $_GET['update']; ?>";
if (chkme1 ==1){
window.location = "viewrecipe.php?recipe_name="+recipe_name.value+"&update=2&texty1="+texty1.value+"&texty2="+texty2.value+"&texty3="+texty3.value+"&texty4="+texty4.value+"&texty5="+texty5.value; 
}

if (last==3){
window.location = "viewrecipe.php?recipe_name="+recipe_name.value+"&NewFG1="+texty4.value+"&NewAlc="+texty5.value;
}

}

URLviewrecipe.php?update=1应该加载第一个 window.location 并且viewrecipe.php?update=3应该加载第二个。

在 Chrome 中,这绝对没问题。在 IE 中,我收到一条错误消息,提示“recipe_name”未定义。

我唯一能想到的是,在 Chrome 中,代码仅在页面实际加载后才会激活。到那时,所有字段值都将被填写。

页面加载后是否有其他方法可以运行功能?

4

1 回答 1

0

您的函数中未定义几个变量: - recipe_name - last

它们是在其他地方定义的吗?我猜 texty1 到 texty5 是表单输入。如果不是,这些变量也没有定义。

您应该向我们提供更多代码,以便我们为您提供帮助。

于 2012-09-12T15:25:43.370 回答