接受输入文件中的属性不工作 [英] accept attribute in input file is not working

查看:176
本文介绍了接受输入文件中的属性不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi我在htnl中遇到一个浏览文件对话框控件标签,标签是

hi i came across a browse file dialog control tag in htnl .and the tag was

<input id="myfile" name="myfile"  type="file" accept="application/pdf"/>

但接受属性似乎没有任何效果.iam使用internetexplorer 8浏览器

but the accept attribute doesnt seems to have any effect .iam using internetexplorer 8 browser

根据w3schools,它与接受atribute

does it have any thing to do with the accept atribute

推荐答案

http://www.w3schools.com/TAGS/att_input_accept.asp ), 'accept'属性没有被任何主要的浏览器正确支持。文件浏览器对话框中的过滤器将不起作用。

according to the w3schools (http://www.w3schools.com/TAGS/att_input_accept.asp), the 'accept' attribute is not properly supported by any of the major browsers. The filter inside the file browser dialog will not work.

您可以使用表单onsubmit事件的JavaScript验证来验证文件类型是否正确,否则返回false。

You could use a javascript validation on the form onsubmit event to verify if the file type is correct, returning false otherwise.

这篇关于接受输入文件中的属性不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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