楼主做了两个页面,
一个是a.php<input type="button" onClick="$('#up').click();" value="上传照片">
<form action="b.php" method="post" enctype="multipart/form-data" target="uploadIframe" id="form1" style="display:none">
<input type="file" name="up" id="up" onchange="$('#sub').click(); ">
<input type="submit" name='sub' id="sub">
</form>
<iframe name="uploadIframe" id="uploadIframe" style="display:none"></iframe>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>一个是b.php<script>alert('1')</script>
结果在IE下无法alert,在其他浏览器下都可以。
请问是什么问题导致的……非常感谢。。jqueryieinputiframebutton
一个是a.php<input type="button" onClick="$('#up').click();" value="上传照片">
<form action="b.php" method="post" enctype="multipart/form-data" target="uploadIframe" id="form1" style="display:none">
<input type="file" name="up" id="up" onchange="$('#sub').click(); ">
<input type="submit" name='sub' id="sub">
</form>
<iframe name="uploadIframe" id="uploadIframe" style="display:none"></iframe>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>一个是b.php<script>alert('1')</script>
结果在IE下无法alert,在其他浏览器下都可以。
请问是什么问题导致的……非常感谢。。jqueryieinputiframebutton
<script>parent.alert('1')</script>
IE的OnChange,不是修改之后触发,而是控件离开焦点的时候触发。与其他浏览器的修改之后立马调用OnChange不一样。这地方IE略有坑爹。所以很多情况下避免使用OnChange
<input type="file" name="up" id="up" onchange="this.parentNode.submit()" style="border: 1px solid red;border:1px solid red;position: absolute;filter: alpha(opacity=0);opacity: 0;width: 100px">
<input type="button" value="上传照片">
</form>
<iframe name="uploadIframe" id="uploadIframe" style="display:none"></iframe>