博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
验证图片
阅读量:4597 次
发布时间:2019-06-09

本文共 1068 字,大约阅读时间需要 3 分钟。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
   
<
title
>无标题页</
title
>
</
head
>
<
body
>
   
<
form
id
=
"form1"
runat
=
"server"
>
   
<
div
>
       
<
asp:FileUpload
ID
=
"FileUpload1"
runat
=
"server"
/>
       
<
asp:Button
ID
=
"Button1"
runat
=
"server"
OnClick
=
"Button1_Click"
Text
=
"Button"
/>
   
<
input
type
=
"file"
lang
=
"de"
/>&nbsp;
       
<
asp:CustomValidator
ID
=
"CustomValidator1"
runat
=
"server"
ControlToValidate
=
"FileUpload1"
           
ErrorMessage
=
"CustomValidator"
ClientValidationFunction
=
"clientValidate"
></
asp:CustomValidator
></
div
>
   
</
form
>
   
<
script
type
=
"text/javascript"
>
   
function clientValidate(source,arguments){
       
var rgx=/(jpg|gif|bmp)/i;
       
var sFilePath=document.getElementById("<%=FileUpload1.ClientID %>").value;
       
var ext=sFilePath.substring(sFilePath.lastIndexOf(".")+1);
       
arguments.IsValid=rgx.test(ext);
   
}
   
</
script
>
</
body
>
</
html
>

转载于:https://www.cnblogs.com/xuzhiheng/archive/2013/05/30/3108289.html

你可能感兴趣的文章
spring boot 首次请求Controller慢
查看>>
事件绑定
查看>>
grep命令详解
查看>>
iterm2快捷键
查看>>
asp.net 生成PDF方法
查看>>
EntityFramework 7 Join Count LongCount 奇怪问题(已修复)
查看>>
设计模式---组件协作模式之模板方法模式(Tempalte Method)
查看>>
程序员心理看WEB开发框架
查看>>
@Data 注解在实体类的使用可省去生成GET,SET方法
查看>>
webpack 介绍 & 安装 & 常用命令
查看>>
ASP.NET刷新页面的六种方法总结
查看>>
ECSHOP增加独立评论页面,并分页显示
查看>>
linux date -s
查看>>
jQuery实现可编辑表格
查看>>
Java实验三
查看>>
算法的评价
查看>>
python学习笔记(二)
查看>>
综合云平台 - GlusterFS - 03
查看>>
地球总在不停地转,时间总是不停地走
查看>>
3章 项目属性配置
查看>>