html.js

来自「此系统都是基于ASP+ACCESS技术开发的电子商务平台,属于全自动化、全智能的」· JavaScript 代码 · 共 56 行

JS
56
字号
// 按比例生成缩略图									----------------------------
function DrawImage(MyPic,W,H){
  var flag=false;
  var image=new Image();
  image.src=MyPic.src;
  if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= W/H){
      if(image.width>W){  
        MyPic.width=W;
        MyPic.height=(image.height*W)/image.width;
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
    else{
      if(image.height>H){  
        MyPic.height=H;
        MyPic.width=(image.width*H)/image.height;     
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
  }
}
// 点击验证码图换数字									----------------------------
function UpVerifyCode(){
  document.getElementById("PhotoSN").src = "../Include/VerifyCode.asp?t="+Math.random();
}
// 指向变换背景图片  									----------------------------
function ChangeBackground(MyObj,NewBackground){ 
  MyObj.style.backgroundImage=NewBackground;
}   

window.onload=menuFix;
function menuFix() {
	var sfEls = document.getElementById("mainMenu").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseDown=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseUp=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?