<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript"><!--
function CheckFileSize(){
var picsize=100*1024;
var s = document.Myform.photo.value;
if(s==" ")return true;
var img = new Image();
img.src = s;
var filename=document.getElementById('aaa').value;
//图片的长和宽的验证(单位为像素)
if(img.width > 150 || img.height > 300){
alert("高 = "+ img.height + "\n宽 = "+ img.width);
alert("图片的高应<150,宽应<300");
}
//图片大小的验证(单位为字节)
if(img.fileSize > picsize){
alert("fileSize = "+ img.fileSize +" 字节");
alert("图片应<300KB");
}
//删除文本框内的图片路径
document.getElementById("photo").select();
document.execCommand("Delete");
}
//--></SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!--
//图片类型的验证
function CheckFileType(){
var filename=document.getElementById('aaa').value;
if(filename.lastIndexOf(".")!=-1){
var fileType = (filename.substring(filename.lastIndexOf(".")+1,filename.length)).toLowerCase();
var suppotFile = new Array();
suppotFile[0] = "jpeg";
suppotFile[1] = "jpg";
suppotFile[2] = "gif";
suppotFile[3] = "png";
suppotFile[4] = "bmp";
for(var i =0;i<suppotFile.length;i++){
if(suppotFile[i]==fileType){
return true;
}else{
continue;
}
}
window.alert("不支持文件类型"+fileType);
alert("只支持JPEG.JPG.GIF.PNG.BMP五种图片格式");
//document.Myform.reset();//清空整个form
document.getElementById("photo").select();
document.execCommand("Delete");
}else{
alert("只支持JPEG.JPG.GIF.PNG.BMP五种图片格式");
document.getElementById("photo").select();
document.execCommand("Delete");
}
}
//--></SCRIPT>
</HEAD>
<BODY>
<form name=Myform onsubmit="return CheckFileSize()">
<input id="aaa" type=file name=photo onchange="CheckFileType()"><br/>
<input type=submit value=submit>
</form>
</BODY>
</HTML>
分享到:
相关推荐
bc.MaxWidth = size.Width; bc.MaxHeight = size.Height; bc.ProcessImage(ivbmp); Rectangle[] rects = bc.GetObjectsRectangles(); Bitmap tmp = new Bitmap(bmp); using (Graphics g = Graphics.From...
<table width="88%" height="142" border="1" cellpadding="-2" cellspacing="-2" bordercolor="#669999" bordercolordark="#FFFFFF"> <td width="32%" height="27" bgcolor="#809EA4"> 省级名称: <td ...
<br>控件属性说明: <br>ID Width 控件宽度,IE有效 Height 控件高度 AjaxImage 上传时显示的loading图片路径,默认路径为"/images/ajax.gif" IsMuch 是否多文件 true 多文件上传,false 单...
<TD vAlign=center background=../houtaimoban/houtaimoban/images/bg.gif height=279><TABLE height=109 cellSpacing=0 cellPadding=0 width=369 align=center border=0> <TD width=155> <IMG height=...
cv::Size ResImgSiz = cv::Size(rect.Width(), rect.Height()); cv::resize(frame, newframe, ResImgSiz, CV_INTER_CUBIC); MatToCImage(newframe, imgDst); imgDst.Draw(pThis->GetDlgItem(IDC_STATIC_IMG...
file_size_limit : "1024", 上传文件体积上限,单位MB file_upload_limit : 10, 限定用户一次性最多上传多少个文件,在上传过程中,该数字会累加,如果设置为“0”,则表示没有限制 file_queue_limit : 2, ...
话不多说,请看代码: <!...<... <head>... .cont{width:300px;height:auto;... #useId{width:120px;height:45px;line-height:45px;...font-size:20px;margin:10px;} </style> </head> <body>
Size = 14.25 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 12255 Left = 600 MultiLine = -1 'True ScrollBars = 3 'Both ...
<table align="center" border="1" width="99%" height="99%" cellspacing="0" cellpadding="3" bordercolor="#6595d6"> <tr><th>FSO文件浏览器 - 编辑文本文件</th></tr> <tr><td height="25">文件名: ...
imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height); [self.viewaddSubview:imageView]; [self performSelectorInBackground:@selector(detect:) withObject:nil]; } detect为自己定义的...
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // 创建BufferedImage类的对象 Graphics g = image.getGraphics(); // 创建Graphics类的对象 Graphics2D g2d = ...
5.1 连续滚动的文字,图片(注意是连续的,两段文字和图片中没有空白出现) 5.2 html编辑控件类 5.3 颜色选取框控件 5.4 下拉菜单 5.5 两层或多层次的下拉菜单 5.6 仿IE菜单的按钮。(效果如rongshuxa....
[ 3.968638] [mmc]: sdc2 set ios: clk 25000000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 3.968734] [mmc]: mclk 0xf1c20090 0xc100000b [ 3.989421] Bluetooth: BNEP filters: protocol ...
jsp探针ceshi.jsp ; charset=gb2312" %> class LfSpy { boolean supportHibernate = false; boolean supportJNDI = false;...boolean supportJavaxSql = false;...private final String linuxParseMacAddress(String ...
利用正则表达式来进行简单的表单验证 话不多说,先贴上 样式 .warn{ font-size: 14px; display: none; color: red; } #warn{ /* overflow: hidden; */ width: 100px; display: none; } #warn span ,...
sflash_size = spi flash size, optional, if spi_board0 is nor flash , carefully ;max_speed_hz = max transfer speed ;bus_num = bus ID ;chip_select = chip select, 0,1 ;mode = SPI transfer mode ;---------...
key_support_preview_size = 1280x1024, 1280x960, 1280x720, 640x480 key_default_preview_size = 640x480 used_picture_size = 1 key_support_picture_size = 1280x1024, 1280x960, 1280x720, 640x480 key_...
r40_tinav2.1_最终验证通过_使用CB-S来验证OV5640有横条纹fpscamera+SPI2.0成功_20171114_1443没有外层目录.7z 开发板:CB-S 1、(可选修改/调试技巧:) 除了ov5640.c之外,其它的驱动都不编译,节省编译时间!...
Size = 14.25 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 12255 Left = 600 MultiLine = -1 'True ScrollBars = 3 'Both ...