社区
JavaScript
帖子详情
怎么过滤文件后缀
让他只显示*.jpg和*.gif
floydyxc
2002-07-08 09:32:49
怎么过滤文件后缀<input type="file"> 让他只显示*.jpg和*.gif
...全文
459
6
打赏
收藏
怎么过滤文件后缀<input type="file" /> 让他只显示*.jpg和*.gif
怎么过滤文件后缀 让他只显示*.jpg和*.gif
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
floydyxc
2002-07-11
打赏
举报
回复
多谢
希默软件
2002-07-09
打赏
举报
回复
<input type=file id=myImg>
<input type=button value=check onclick="var aa=myImg.value.split('.');if(aa[aa.length-1]=='gif'||aa[aa.length-1]=='jpg'){alert('*.jpg or *.gif')}else{alert('Not *.jpg or *.gif')};">
qiushuiwuhen
2002-07-09
打赏
举报
回复
<input id=t type="file">
<script>
t.focus()
new ActiveXObject("wscript.shell").sendKeys(".gif")
</script>
qiushuiwuhen
2002-07-09
打赏
举报
回复
<input id=t type="file">
<script>
t.focus()
new ActiveXObject("wscript.shell").sendKeys(".gif")
</script>
lanbor
2002-07-08
打赏
举报
回复
<html>
<head>
<script language=javascript>
function checkImage(sId)
{
if(( document.all[sId].value.indexOf(".gif") == -1) && (document.all[sId].value.indexOf(".jpg") == -1)) {
alert("请选择gif或jpg的图象文件");
event.returnValue = false;
}
}
</script>
</head>
<body>
<form action='dddd.asp' onsubmit="checkImage('myImg')">
<input type=file id=myImg>
<input type=submit name=submit value=submit>
</form>
</body>
</html>
saucer
2002-07-08
打赏
举报
回复
you cannot do that in all major browsers
<
input
type
="
file
" />浏览时只
显示
指定
文件
类型
input
type
="
file
" accept="application/msword" >br>br>accept属性列表br> 1.accept="application/msexcel" 2.accept="application/msword" 3.accept="application/pdf" 4.accept="application/pos
<
input
type
=“
file
“>的 accept 属性如何精确
过滤
HEIC/WebP 等现代图片格式?
在前端开发里,`<
input
type
="
file
">` 元素是实现
文件
上传的常用组件,但如果不加以限制,用户可能会上传各种不符合要求的
文件
,尤其是在处理图片上传时,面对HEIC、WebP等现代图片格式,如何精准
过滤
,让上传...
使用 <
input
type
=“
file
“> 时限制
文件
格式?
当用户单击 HTML 中 元素中的浏览按钮时,我想限制可以从本机操作系统
文件
选择器中选择的
文件
类型。我觉得这是不可能的,但我想知道是否有 解决方案。我想只保留 HTML 和 JavaScript;请不要闪光。
input
[
type
="
file
"]上传
文件
原理详解
input
[
type
="
file
"]上传
文件
原理详解 最近又搞了一下上传
文件
功能,用别人的插件不大符合自己要求,还是用HTML5的
input
[
type
="
file
"]比较好控制,现在重新回顾一下使用
input
[
type
="
file
"]上传
文件
【1】修改
input
...
js 在<
input
type
='
file
'/>的使用中,控制
文件
的
后缀
jpg
gif
等
var
file
_name = Ext.getCmp('_DocumentData').getValue();//EXTJS获得
文件
路径的名称 if (
file
_name != "" &&
file
_name != null) { var
file
_ext =
file
_name.substr...
JavaScript
87,994
社区成员
224,689
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章