Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery don'提交表单;我不能在Internet Explorer上工作_Jquery_Html_Internet Explorer 9 - Fatal编程技术网

使用jQuery don'提交表单;我不能在Internet Explorer上工作

使用jQuery don'提交表单;我不能在Internet Explorer上工作,jquery,html,internet-explorer-9,Jquery,Html,Internet Explorer 9,我使用此代码通过jQuery向我的Web服务器提交文件: <input type="file" name="userfile" id="userfile" size="20" onChange="$('#ajaxupload').fadeIn();$(this).closest('form').submit(); return false;" style="display : none;" /> <input type="submit" value="Neue Datei hi

我使用此代码通过
jQuery
向我的Web服务器提交文件:

<input type="file" name="userfile" id="userfile" size="20" onChange="$('#ajaxupload').fadeIn();$(this).closest('form').submit(); return false;" style="display : none;" />
<input type="submit" value="Neue Datei hinzuf&uuml;gen" onclick="$('#userfile').click(); return false;" />


这在
Firefox
Safari
上运行良好,但在
InternetExplorer
上不起作用,所以这里出了什么问题?

onChange
在您使用的IE版本中不受支持。试试看


$('.userfile').change(函数(){
$('#ajaxupload').fadeIn();
$(this).closest('form').submit();
返回false;
});
$('.submitUserFile')。单击(函数(){
$('#userfile')。单击();
返回false;
});

什么是“不起作用”?它不提交?对不起,是的,它不提交。jQuery启动Ajax Gif($('#ajaxupload').fadeIn();),但仅此而已!您不应该以这种方式混淆html和jquery。试着在外部js文件中使用它。嗨,我试过了,但结果是一样的!我认为提交有问题,因为$('ajaxupload').fadeIn();每次都是triggerd!他做出了新的回答。我删除了
中的所有jQuery脚本,希望它能正常工作。也许是
ajaxupload
fadeIn函数搞砸了。。。是否包含jQuery库<代码>当然我包括了jQuery。我尝试了你的解决方案,但没有成功。如果我使userfile可见,并且只在您的解决方案中使用它(不包括提交),那么一切都很好:-(,但这真的很难看。
<script type="text/javascript">
    $('.userfile').change(function () {
        $('#ajaxupload').fadeIn();
        $(this).closest('form').submit(); 
        return false;
    });

    $('.submitUserFile').click(function () {
        $('#userfile').click();
        return false;
    });
</script>

<input type="file" name="userfile" id="userfile" size="20" style="display : none;" />
<input type="submit" id="submitUserFile" value="Neue Datei hinzuf&uuml;gen" />