通过javascript提交表单的结果与通过实际单击提交表单的结果不同?

通过javascript提交表单的结果与通过实际单击提交表单的结果不同?,javascript,google-chrome-extension,Javascript,Google Chrome Extension,我正在尝试为chrome扩展编写javascript,以便在我浏览的页面上提交以下表单: <form name='cartcheckoutpro' method='POST'action='https://store01.prostores.com/servlet/store/Checkout?cart_id=39064012' style='margin:0px'> <input type='image' name='checkout' src='/images/In

我正在尝试为chrome扩展编写javascript,以便在我浏览的页面上提交以下表单:

<form name='cartcheckoutpro' method='POST'action='https://store01.prostores.com/servlet/store/Checkout?cart_id=39064012' style='margin:0px'>
    <input type='image' name='checkout' src='/images/InitialSet/proceedtocheckout.gif' border='0'/><input type='hidden' name="cart_id" value="39064012">
</form>
但是,当我使用javascript提交表单时,下一页的加载方式与我单击按钮继续时的加载方式不同。有没有想过我为什么要讨论这个问题

以下是目标页面上的脚本:

<script type="text/javascript">
    window.onload = function () {
        var email = document.getElementById("customerregistryemail");
        if (email)
            email.setAttribute("autocomplete", "off");
    }
</script>

<script type="text/javascript">
    function toggleLogin() {
        document.getElementById('logininfo').style.display = document.getElementById('returning').checked ? "inline" : "none";
    }
    YAHOO.util.Event.addListener(window, "load", function () {
        toggleLogin();
    });    
    toggleLogin();
</script>

window.onload=函数(){
var email=document.getElementById(“customerregistryemail”);
如果(电子邮件)
email.setAttribute(“自动完成”、“关闭”);
}
函数toggleLogin(){
document.getElementById('logininfo')。style.display=document.getElementById('returning')。选中?“内联”:“无”;
}
YAHOO.util.Event.addListener(窗口,“加载”,函数(){
toggleLogin();
});    
toggleLogin();

有什么不同?您的输入type=“hidden”必须使用/>关闭。如果我手动单击提交表单的按钮,我将获得以下3个选项:(1)我希望在不创建帐户的情况下下下订单。(2) 我是一个新客户,我想注册并创建一个帐户。(3) 我是一位回头客,希望使用我的现有帐户。当我模拟提交表单时,我没有得到任何选项,下面的页面假设了选项(1)的变体。请发布更多的代码,就像lolcat上的脚本一样,我已经按照要求在页面上发布了脚本。虽然,我应该注意到,这些脚本仅出现在我通过单击按钮手动提交表单时得到的页面上。当模拟通过javascript提交表单时,它会将我带到完全相同的web地址,但是,页面完全不同。如果在浏览器中手动输入目标URL,则可以得到相同的结果。提交表单时是否需要传输值?在哪里处理post参数?有服务器脚本吗?为什么要调用toggleLogin()两次?您确定使用javascript提交时输入字段的值与单击提交时输入字段的值完全相同吗?
<script type="text/javascript">
    window.onload = function () {
        var email = document.getElementById("customerregistryemail");
        if (email)
            email.setAttribute("autocomplete", "off");
    }
</script>

<script type="text/javascript">
    function toggleLogin() {
        document.getElementById('logininfo').style.display = document.getElementById('returning').checked ? "inline" : "none";
    }
    YAHOO.util.Event.addListener(window, "load", function () {
        toggleLogin();
    });    
    toggleLogin();
</script>