
//         *************************  敏哥专用：js控制图片自动按比例缩放  **********************************

// 固定宽高缩放  示例：  <IMG src="<%= url %>" onload="javascript:Img(this);">

// 自定义宽高缩放示例：<IMG src="<%= url %>" onload="javascript:Img_w_h(this,width,height);">






//固定宽，高 自动缩放函数
function Img(ImgD){  
var flag=false;
var image=new Image();
var width=360;  //图片的宽度
var height=260; //图片的高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= width/height){
if(image.width>width){ 
ImgD.width=width;
ImgD.height=(image.height*width)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>height){ 
ImgD.height=height;
ImgD.width=(image.width*height)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
} 

//自定义参数自动缩放函数 Img_w_h
function Img_w_h(ImgD,width,height){  
var flag=false;
var image=new Image();
var width=width;  //得到图片的宽度
var height=height; //得到图片的高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= width/height){
if(image.width>width){ 
ImgD.width=width;
ImgD.height=(image.height*width)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>height){ 
ImgD.height=height;
ImgD.width=(image.width*height)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
} 




<!--
//行换色
function mOver(src,cOver){
    if(!src.contains(event.fromElement)){
        src.style.cursor='default';
        src.bgColor=cOver;
    }
}
function mOut(src,cIn){
    if(!src.contains(event.toElement)){
        src.style.cursor='default';
        src.bgColor=cIn;
    }
}

//表单全选
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }

//按钮询问
function YesNo()
{
   if(confirm("确定操作吗?"))
     return true;
   else
     return false;
	 
}
  
  //只允许写数字
  function checkNUM(){
      if ( !(((window.event.keyCode >= 48) && (window.event.keyCode <= 57))|| (window.event.keyCode == 13) || (window.event.keyCode == 46)|| (window.event.keyCode == 45)|| (window.event.keyCode == 190))){
         window.event.keyCode = 0 ;
      }
   }
-->

