<! 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 ="" >
</ HEAD >

< BODY >
< form  name ="fr"  action ="up.asp"  method ="post"  enctype ="multipart/form-data"  onsubmit ="return chk()" >  
< input  type ="file"  name ="file"  id ="file"  size ="30"  UNSELECTABLE ="on" >  
< input  type ="submit"  name ="submit"  value ="上传" >  
< script  language ="javascript" >  
function  chk() 

var  s = fr.file.value; 

if (fr.file.value == ""

alert(
" 请输入图片地址! " ); 
fr.file.focus(); 
return   false
}
 
s
= s.substr(s.lastIndexOf( " . " ) + 1 , 3 ); 
if (s != " gif " && s != " jpg "

alert(
" 请选择正确的图片格式! "
return   false
}
 

var    img    =     new    Image(); 
var  FileMaxSize  =   10 ; // 限制上传的文件大小,单位(k)

 img.src   
=  fr.file.value; 
if (img.fileSize > FileMaxSize * 1024 ) {
alert(
" 请上传小于100K的图片 " );

fr.file.focus();
return   false

}

}

</ script >  
</ BODY >
</ HTML >