firefox 31 javascript提交不工作

firefox 31 javascript提交不工作,javascript,firefox,form-submit,Javascript,Firefox,Form Submit,Firefox31出现问题,因为javascript提交不起作用。问题出现在产品页面,因为在选择产品后,它没有导航到购物车页面或愿望列表页面。我已经在其他浏览器和Firefox30上进行了测试,并且在它们上运行良好。我也尝试过禁用其他插件,但没有成功。我调试下面给定的代码段,它的变量根据逻辑获得所需的值,例如,只有当用户选中字段时,它才输入else。如果您能提供任何快速解决方案,我将不胜感激 echo "<input class=\"button wish_btn_style\"

Firefox31出现问题,因为javascript提交不起作用。问题出现在产品页面,因为在选择产品后,它没有导航到购物车页面或愿望列表页面。我已经在其他浏览器和Firefox30上进行了测试,并且在它们上运行良好。我也尝试过禁用其他插件,但没有成功。我调试下面给定的代码段,它的变量根据逻辑获得所需的值,例如,只有当用户选中字段时,它才输入else。如果您能提供任何快速解决方案,我将不胜感激

    echo "<input class=\"button wish_btn_style\" type=\"submit\" value=\"Add to   
    wishlist\" onclick=\"return changelocation('wishlist.php')\"><!--img   
    src=\"img/wishlist_small.png\" width=\"16\" height=\"15\"-->";
    echo "<input class=\"button cart_btn_style\" type=\"submit\" value=\"Add to cart\" 
    onclick=\"return changelocation('cart.php')\"><!--img src=\"img/cart_gray.png\" 
    width=\"32\" height=\"24\"-->";

function changelocation(action)
{var canigo=0;
   var x=document.getElementById('txt_quent').value;
   var status;
 if((x=="") || isNaN(x))
 {
  alert("Please enter quantity only in number");
  var canigo=1;
  return false;
    }

    if(canigo==0)
        {status=$('input:radio[name="subid"]:checked').val();
    if(isNaN(status))
    {

     alert('Please select the desired product specification');
        return false;   
    }
    else
    {

         document.getElementById('product').action=action;
        document.getElementById('product').target='_self';
        document.getElementById('product').submit();


        return true;  

    }
    }

    }
echo”“;
回声“;
功能更改位置(操作)
{var canigo=0;
var x=document.getElementById('txt_quent').value;
var状态;
如果((x==“”)| | isNaN(x))
{
警告(“请仅在数字中输入数量”);
var canigo=1;
返回false;
}
如果(canigo==0)
{status=$('input:radio[name=“subid”]:checked').val();
如果(isNaN(状态))
{
警报(“请选择所需的产品规格”);
返回false;
}
其他的
{
document.getElementById('product')。action=action;
document.getElementById('product')。target='u self';
document.getElementById('product').submit();
返回true;
}
}
}

您的表单中是否有一个名为“操作”的输入字段

我今天在Firefox31中遇到了一些旧代码的错误。在Firefox的早期版本中,.action解析为表单的“action”属性,但在版本31中,它改为解析为页面上名为“action”的输入字段

通过使用jQuery,我使它再次工作:

$("#defForm").attr("action", sURL);
或者,我可以更改页面上使用的输入字段命名约定


我很想了解Firefox行为改变的原因。

编辑:在最后一篇文章中解决了我的问题

我也有同样的问题,但我使用输入操作,为我更改输入的名称是一个大问题

此脚本在Firefox 31的早期版本上没有问题

if(ie){
    for(i=document.getElementById('miForm').attributes.length-1;i>0;i--){
        if(document.getElementById('miForm').attributes[i].name=='action'){
            document.getElementById('miForm').attributes[i].value='../views/newJSP.jsp';
            break;
        }
    }
}else document.getElementById('miForm').action='../views/newJSP.jsp';
document.getElementById('action').value='abrir';
document.getElementById('miForm').submit();
在Firefox上,如果(ie)不返回任何名为action的属性,则在以前的版本中返回action属性

我没有任何解决办法

编辑: 是虫子吗

解决方案:

我的脚本在for循环中出错。 在ie中,表单中属性的长度为116,动作属性的位置为114,但在firefox中,长度为5,动作的位置为0

这是更新form.action的代码

for(i=document.getElementById('miForm').attributes.length-1;i>=0;i--){
    if(document.getElementById('miForm').attributes[i].name=='action'){
        document.getElementById('miForm').attributes[i].value='../views/newJSP.jsp';
        break;
    }
}

在运行此脚本之前,什么是
document.getElementById('product')。操作
?类似于
target
?如果用户单击“添加到购物车”,则action属性将根据submit按钮获取其值,然后action将是cart.php,如果用户单击“添加到愿望列表”,则action将是wishlist.php这实际上并没有回答我的问题。问题是
document.getElementById('product').action
是否是此代码运行之前的字符串,或者它是否是元素。