<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><SCRIPT language=javascript>
<!--
var arr=["jpg","bmp","gif"]; //设置允许上传图片格式function CheckValid(){
if (window.UploadForm.txtMin.value =="" ) {
            alert("请输入或选择款式缩略图片!!");
window.UploadForm.txtMin.focus();
return false;
}if (window.UploadForm.txtMax.value =="" ) {
            alert("请输入或选择款式图片!!");
window.UploadForm.txtMax.focus();
return false;
}
if(!checkPic()) return false;
window.UploadForm.submit 
// window.StyleAdd.submit() 
 return(true);
}function fiter(strFileName){
for(var i=0;i<arr.length;i++)
if(arr[i]==strFileName)
return true;

return false;
}function checkPic(){
//图片属性检测
  var strPicMin=UploadForm.txtMin.value;
  var strPicMax=UploadForm.txtMax.value;
  strPicMin=strPicMin.toLowerCase();
  strPicMax=strPicMax.toLowerCase();
  var intstrPicMinLen=strPicMin.length;
  var intstrPicMaxLen=strPicMax.length;
  strPicMinExtName=strPicMin.substring(intstrPicMinLen-4,intstrPicMinLen);
  strPicMaxExtName=strPicMax.substring(intstrPicMaxLen-4,intstrPicMaxLen);
  
  if(!fiter(strPicMinExtName)){
alert("缩略图请选择正确图片格式!!");
return false;
  }
  if(!fiter(strPicMaxExtName)){
alert("款式图请选择正确图片格式!!");
return false;
  }
  
  if(imgMin.width>200 || imgMin.height>200){
alert("您上传的缩略图图片尺寸太大!!(长<200;宽<200)");
return false;
  }
  
  if(imgMax.width>800 || imgMax.height>600){
alert("您上传的款式图图片尺寸太大!!(长<800;宽<600)");
return false;
  }
  return true;
}function setEditWinPos(){
var intCurrentW=window.document.body.offsetWidth;
var intCurrentH=window.document.body.offsetHeight;
var intWinW=divPic.style.width;
var intWinH=divPic.style.height;
setVisibility(true);
divPic.style.pixelTop=(parseInt(intCurrentH)-parseInt(intWinH))/2;
divPic.style.pixelLeft=(parseInt(intCurrentW)-parseInt(intWinW))/2;
}function setVisibility(blnKey){
if(blnKey){
divPic.style.visibility="visible";
divPic.style.display="block";
}else{
divPic.style.visibility="hidden";
divPic.style.display="none";
}
}
function toShow(obj,objPic){
var strPicPath=obj.value;
if(strPicPath==''){
alert('请选择上传图片!!');
return false;
}
showPic.src=strPicPath;
setEditWinPos();
showPicInfo.innerText="大小:"+objPic.width + "X" + objPic.height;
if(objPic.width>240) showPic.width=240;
if(objPic.height>100) showPic.height=100;
}-->
</SCRIPT></HEAD>
<BODY leftmargin=0 topmargin=0>
<BR>
<table width=80% align=center>
<form name="UploadForm" action="StyleAdd_Save.asp" enctype="multipart/form-data" method="post" style="BORDER-BOTTOM: thin; BORDER-RIGHT-STYLE: none"><tr>
<td >
<table align='center' width='100%' border='1' cellpadding='3' cellspacing='0' bordercolorlight='#000000' bordercolordark='#ffffff'>

<tr>
<td align=right>缩略图名称:</td>
<td>
<input type="file" name="txtMin" class=inpStyle onpropertychange="imgMin.src=this.value;">
<input type=button name="btShow" class=btnStyle value="预览" onclick="toShow(document.all.txtMin,imgMin)">
</td>
</tr>
<tr>
<td align=right>款式图名称:</td>
<td>
<input type="file" name="txtMax" class=inpStyle onpropertychange="imgMax.src=this.value;">
<input type=button name="btShow" class=btnStyle value="预览" onclick="toShow(document.all.txtMax,imgMax)">
</td>
</tr>
<tr> 
            <td valign=top> 
              <div align="right"><a href="#" onClick="ProductCatalog.style.display=ProductCatalog.style.display=='none'? '':'none';return false">相关产品分类:</a></div>
            </td>
            <td >&nbsp<br>
          <tr> 
            <td colspan=2 align=center> 
              <input type="submit" value="添加款式" class=btnStyle id="submit" name="submit" language="javascript"  onClick="return CheckValid()">
              <input type="reset" name="reset" value="重填" class=btnStyle>
            </td>
          </tr>
</table>
</td>
</tr>
</form>
</table>
<div id=divPic style="position:absolute;  width:300px; height:140px; z-index:2;background-color:menu; visibility : hidden; display:none" class=inpStyle>
<br>
<center>
<p id=showPicInfo></p>
<img id=showPic>
<br>
<INPUT type="button" value="确定" id=btcancal name=btCancal class=btnStyle onclick=setVisibility(false)>
</center>
</div>
<img id=imgMin style=visibility:hidden><br>
<img id=imgMax style=visibility:hidden>
</BODY>
</HTML>