惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

博客园 - 白夜

fedora 17 安装mono ASP.NET MVC3实践笔记 最近要学习的几篇博文 在网页中集成股票走势 Tomcat 报错 累死了 关于IIS无法启动,World Wide Web Publishing服务无法启动,提示错误127 给Aptana Studio添加aspx页面支持 javascript全局变量失效 模板页当中的js文件加载问题 Jscript运行时错误:没有权限 javascript动态绑定img的src地址 关于IIS无法打开aspx页面的问题 关于WebService无法序列化接口的问题 简述WebService与.NET Remoting的区别及适应场合。(转) 关于单实例模式 关于Sys未定以的问题 希望 有关.NET中序列化的一些知识 [转]
input file 输入类型检测,及value清空
白夜 · 2012-07-31 · via 博客园 - 白夜

今天写一个程序的时候,需要判断上传控件的后缀名是否符合要求,如果不符合要求,情况上传输入框,代码如下:

 <input id="fileWord" runat="server" type="file" accept="application/msword" onchange="check(this)" />&nbsp;<asp:Button
            ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="导入"  OnClientClick="return btnCheck()"/>
  function check(input) {
            if (input.value.indexOf('.doc') < 0 && input.value.indexOf('.docx') < 0) {
 
                alert("请选择word文件!");
                input.outerHTML = input.outerHTML.replace(/(value=\").+\"/i, "$1\"");
            }
            else {
                return true;
            }
 
        }
        function btnCheck()
        {
            var file = document.getElementById("fileWord");
            if (file.value == "") {
                alert("请选择word文档");
                return false;
            }
            return true;
        }