Javascript表单提交:对象不支持此属性或方法(IE7) [英] Javascript form submit: Object doesn't support this property or method (IE7)

查看:237
本文介绍了Javascript表单提交:对象不支持此属性或方法(IE7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用javascript提交表单。 Firefox工作正常,但IE在此函数的提交行上抱怨对象不支持此属性或方法:

I'm trying to submit a form with javascript. Firefox works fine but IE complains that "Object doesn't support this property or method" on the submit line of this function:

function submitPGV(formName, action)
{
    var gvString = "";

    pgVisibilities.each(function(pair) {
        gvString += pair.key + ":" + pair.value + ",";
    });

    $('pgv_input').value = gvString;

    var form = $(formName);
    form.action = action;
    form.submit();
}

在这里调用:

<a href="javascript:submitPGV('ProductGroupVisibility','config/productgroupvis/save')">

以下是表格:

<form id="ProductGroupVisibility" action="save" method="post">
    <input type="hidden" name="ows_gv..PGV" id="pgv_input" value=""/>
</form>

任何想法?

推荐答案

尝试检查IE正在选择的元素的类型:

Try checking the type of the element IE is selecting:

// For getting element with id you must use # 
alert( typeof( $( '#ProductGroupVisibility' )));

页面上有其他内容可能是IE在表单之前选择的ID。

It is possible there is something else on the page with that ID that IE selects before the form.

这篇关于Javascript表单提交:对象不支持此属性或方法(IE7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆