中的accept属性问题 ,高手请进!

longshenwang 2003-09-15 10:04:49
小弟想实现在<INPUT NAME="fileName" TYPE=FILE>中设置某个属性来完成在浏览文件时只能看见设定好了的文件类型,不知道使用accept="image/gif"行不行,试验后发现还是可以看见别的类型文件,请各位高手帮忙!。。
...全文
911 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuhangyan 2003-09-24
  • 打赏
  • 举报
回复
最后一次提前 没有高手能帮我解决这个问题吗?

斑竹呢? 没有的话就只能失望的结贴了 :(
longshenwang 2003-09-23
  • 打赏
  • 举报
回复
大家多多发表自己的看法啊! 没关系 ~~ UP UP UP ^_^
zhanghk 2003-09-22
  • 打赏
  • 举报
回复
楼上说的没错,即使你这样能实现的话,我还是可以选择别的文件的
zhanghk 2003-09-22
  • 打赏
  • 举报
回复
楼上说的没错,即使
xdspower 2003-09-21
  • 打赏
  • 举报
回复
好像没有办法, 一个想象的方案是在获取文件名后自己判断,对不符合要求的不处理(上传,调用)
xdspower 2003-09-19
  • 打赏
  • 举报
回复
我个人认为ACCEPT属性是针对数据获取方式的,并不是一般意义上的文件属性,所以楼主的要求用这个方法是不能达到的。
showerXP 2003-09-19
  • 打赏
  • 举报
回复
ACCEPT="image/pjpeg"
hisi 2003-09-19
  • 打赏
  • 举报
回复
好像没有办法
keygao 2003-09-19
  • 打赏
  • 举报
回复
没有这个属性吧
longshenwang 2003-09-19
  • 打赏
  • 举报
回复
请问xdspower,用什么方法能够实现类似功能?谢谢!
longshenwang 2003-09-18
  • 打赏
  • 举报
回复
楼上的
用<INPUT NAME="fileName" TYPE=FILE ACCEPT=""image/jpg">不行啊!

在浏览的时候什么文件都看得见(exe、txt、doc......)我想要的是浏览的时候只能看见、选择jpg类型的图片
zhaoweiwei 2003-09-17
  • 打赏
  • 举报
回复
<INPUT NAME="fileName" TYPE=FILE ACCEPT=""image/jpg">
anita2li 2003-09-16
  • 打赏
  • 举报
回复
UP
yonghengdizhen 2003-09-16
  • 打赏
  • 举报
回复
楼主没说错,但是对于这个属性,我也从来没有成功应用过

ACCEPT Attribute | accept Property

--------------------------------------------------------------------------------

Sets or retrieves a comma-separated list of content types.

Syntax

HTML <INPUT ACCEPT = sAccept... >
Scripting INPUT.accept(v) [ = sAccept ]

Possible Values

sAccept String that specifies or receives comma-separated list of content types.

The property is read/write. The property has no default value.

Remarks

The information from the list can be used to filter out nonconforming files when prompting a user to select files to be sent to the server using the <INPUT> element with type="file".

Examples of content types include "text/html", "image/png", "image/gif", "video/mpeg", "audio/basic", "text/tcl", "text/javascript", and "text/vbscript". For the current list of registered Multipurpose Internet Mail Extensions (MIME) types, see MIME types .

There is no functionality implemented for this property unless defined by the author.

Standards Information

This property is defined in HTML 4.0 and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .

Applies To

INPUT
Platform Version
Win32: 6
Version data is listed when the mouse hovers over a link, or the link has focus.
INPUT
blues-star 2003-09-16
  • 打赏
  • 举报
回复
accept是你自己编出来的。

并且type="file"不能完成你所述功能。
longshenwang 2003-09-16
  • 打赏
  • 举报
回复
怎么没人回答啊! 太简单????

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧