提交按钮的值在点击时消失

时间:2011-09-26 18:35:40

标签: php javascript jquery forms onclick

我有一个简单的表单,它接收用户的电子邮件地址(单击“电子邮件”链接时显示该表单)。除了提交按钮的值在Click或onSubmit上消失外,所有内容似乎都能正常运行。我似乎无法追查这个问题。请参考here。此问题似乎只会影响IE。我不想显示PHP处理 - 但如果有必要,我会展示我能做什么。基本上,只是想知道是否有人可以发现可能导致此问题的任何语法错误,或者是否有人有解决方案。

形式:

<div id="formContainer">
    <form action="http://www.example.com/catalog/scripts/email.php" method="post" id="contactForm">
        <input type="text" name="email" value="E-mail Address" id="email" style="padding-left:5px; font:bold 11px Arial;"/> 
        <input type="text" name="last" value="" id="last" />
        <input type="hidden" name="id" value="'.$_GET['id'].'">
        <input type="submit" value="Submit" id="contactSubmit"/>
    </form>
</div>

JS:

<script>
    $(document).ready(function() {var options = {target: '#alert'};
    $('#contactForm').ajaxForm(options); });
    $.fn.clearForm = function() {
        return this.each(function() {
            var type = this.type, tag = this.tagName.toLowerCase();
            if (tag == 'form')
                return $(':input',this).clearForm();
            if (type == 'text' || type == 'password' || tag == 'textarea')
                this.value = '';
            else if (type == 'checkbox' || type == 'radio')
                this.checked = false;
            else if (tag == 'select')
                this.selectedIndex = -1;
        });
    };
</script>

0 个答案:

没有答案
相关问题