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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
The Last Watchdog
The Last Watchdog
T
Tenable Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Simon Willison's Weblog
Simon Willison's Weblog
V
Vulnerabilities – Threatpost
F
Fortinet All Blogs
Microsoft Security Blog
Microsoft Security Blog
A
Arctic Wolf
云风的 BLOG
云风的 BLOG
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
MyScale Blog
MyScale Blog
B
Blog
Spread Privacy
Spread Privacy
S
Schneier on Security
Project Zero
Project Zero
L
LINUX DO - 热门话题
M
MIT News - Artificial intelligence
F
Full Disclosure
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
Cyberwarzone
Cyberwarzone
AWS News Blog
AWS News Blog
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Tailwind CSS Blog
K
Kaspersky official blog
Recent Announcements
Recent Announcements
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
S
Securelist
P
Privacy & Cybersecurity Law Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Exploit Database - CXSecurity.com
V
Visual Studio Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Webroot Blog
Webroot Blog

博客园 - 雨叶秋寒

sjCatSoft上传组件 - 雨叶秋寒 - 博客园 MSSQL的“未与信任SQL SERVER相关联”错误 JAVA中数据类型的转换 在JavaBean中存放数据 - 雨叶秋寒 - 博客园 JSP中的缓冲区你到底能用多少? - 雨叶秋寒 - 博客园 JSP中out对象的方法总结 JSP中的两种包含页面的方法 - 雨叶秋寒 - 博客园 控制TextBox的ReadOnly属性 - 雨叶秋寒 - 博客园 用计划任务定时执行ASP文件 - 雨叶秋寒 - 博客园 读邹建的书(第二章) ASP备份MSSQL数据库 利用ADOX更改字段名 ADOX使用范例(调试成功) ADOX 对象总结 调用类 调用存储过程 MSDN给出的Hashtable的示例 Snippet Compiler 对ArrayList 的简单研究
JavaScript判断上传文件类型 - 雨叶秋寒 - 博客园
雨叶秋寒 · 2005-11-09 · via 博客园 - 雨叶秋寒

工作需要,写了个函数用来判断上传文件的类型,放到这里以便日后整理。

function Check_FileType(str)
{
 
var pos = str.lastIndexOf(".");
 
var lastname = str.substring(pos,str.length)  //此处文件后缀名也可用数组方式获得str.split(".")
 
if (lastname.toLowerCase()!=".jpg" && lastname.toLowerCase()!=".gif")
 
{
     alert(
"您上传的文件类型为"+lastname+",图片必须为.jpg,.gif类型");
     document.myform.pic.focus();
     
return false;
 }

 
else 
 
{
  
return true;
 }

}