JavaScript模拟ACDSEE简单功能
2008-02-23 07:49:41来源:互联网 阅读 ()
------------------------------------------- 演示代码:
---------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Document </TITLE>
<style type="text/css">
body{
padding : 0px ;
margin : 0px;
background-color : #999999 ; }
.DivMain {
position : absolute ;
text-align : center ;
overflow : hidden ;
}
.DivMenu {
position : absolute ;
text-align : left ;
overflow : hidden ;
}
.ImgMain {
position : absolute ;
overflow : hidden ;
border : 0px ;
}
.TBMain {
background-color : #CCCCCC ;
padding : 0px ;
border : 0px ;
z-index : 99 ;
line-height : 18px ;
}
.TBMenu {
background-color : #FFCCCC ;
padding : 0px ;
border : 0px ;
z-index : 99 ;
color: #000000 ;
}
.HrScroll {
margin : 0px;
background-color : #FFFFFF ;
padding : 0px ;
border : 0px ;
z-index : 99 ;
color : #000000 ;
border-spacing : 0px;
width : 160px ;
height : 10px ;
}
</style> <SCRIPT LANGUAGE="JavaScript">
<!-- var originalWidth ;
var originalHeight ; var objDivMain ;
var objTbMain ; var objImg ;
var ObjDrag ; var objDivMenu ;
var objTbMemu ; var objbtnImgInfo ; var objDivFlag;
var objHrScroll; var oRcts ;
var oTextRange ; function setInit(obj) { objDivMain = document.getElementById("divMain") ;
objTbMain = document.getElementById("TbMain") ; objDivMenu = document.getElementById("DivMenu") ;
objTbMenu = document.getElementById("TbMenu") ; objImg = document.getElementById("imgMain") ;
objbtnImgInfo = document.getElementById("btnImgInfo") ;
objDivFlag = document.getElementById("DivFlag");
objHrScroll = document.getElementById("HrScroll"); originalWidth = obj.width;
originalHeight = obj.height; objImg.style.width = originalWidth;
objImg.style.height = originalHeight; fmImgZoom.FitScreen.click();
} function setFitScreen() { initImg(objImg);
} function setOriginal() { var intBodyWidth ;
var intBodyHeight ; intBodyWidth = document.body.clientWidth ;
intBodyHeight = document.body.clientHeight ; objImg.style.left = 0 ;
objImg.style.top = 0 ;
objImg.style.width = originalWidth;
objImg.style.height = originalHeight;
objImg.style.zoom = 1 ; objDivMain.style.width = intBodyWidth ;
objDivMain.style.height = intBodyHeight - objTbMain.clientHeight; fnWritePos(objImg.style.left,objImg.style.top,objImg.style.zoom);
} function initImg(objCurrent) { var intBodyWidth ;
var intBodyHeight ; intBodyWidth = document.body.clientWidth ;
intBodyHeight = document.body.clientHeight ;
objTbMain.style.top = 0;
objTbMain.style.height = 20;
objTbMain.style.width = intBodyWidth;
objDivMain.style.left = 0 ;
objDivMain.style.height = intBodyHeight - objTbMain.clientHeight;
objDivMain.style.width = intBodyWidth ; initZoom(objCurrent);
} function initZoom(obj){ var intObjWidth ;
var intObjHeight ;
var intDivHeight ;
var intZoomRatio ;
intDivHeight = objDivMain.style.pixelHeight;
intObjHeight = obj.style.pixelHeight;
intZoomRatio = intDivHeight / intObjHeight; obj.style.zoom = intZoomRatio ;
obj.style.top = 0;
obj.style.left = 0; fnWritePos (obj.style.left,obj.style.top,obj.style.zoom) ;
} function fnMouseDown(obj) {
ObjDrag=obj;
ObjDrag.setCapture();
ObjDrag.l=event.x-ObjDrag.style.pixelLeft;
ObjDrag.t=event.y-ObjDrag.style.pixelTop;
} function fnMouseMove() {
if(ObjDrag!=null) {
ObjDrag.style.left = event.x-ObjDrag.l;
ObjDrag.style.top = event.y-ObjDrag.t;
fnWritePos(ObjDrag.style.left,ObjDrag.style.top,ObjDrag.style.zoom);
}
} function fnMouseUp() {
if(ObjDrag!=null) {
ObjDrag.releaseCapture();
ObjDrag=null;
}
} function fnZoomIn() { objImg.style.zoom = parseFloat(objImg.style.zoom) 0.01 ;
fnWritePos(objImg.style.left,objImg.style.top,objImg.style.zoom);
} function fnZoomOut() { if(objImg.style.zoom>0.01){
objImg.style.zoom = parseFloat(objImg.style.zoom) - 0.01 ;
fnWritePos(objImg.style.left,objImg.style.top,objImg.style.zoom);
}
} function fnDivMouseDown() {
if ( event.button == 2 && event.srcElement.id != "imgMain") {
objDivMenu.style.top = event.y;
objDivMenu.style.left = event.x;
objDivMenu.style.visibility = ""; oTextRange = objHrScroll.createTextRange() ;
oRcts = oTextRange.getClientRects();
oBndRct = objDivFlag.getBoundingClientRect();
objDivFlag.style.top = oRcts[0].top;
objDivFlag.style.left = oRcts[0].left parseInt(objImg.style.zoom * 10) ;
objDivFlag.style.visibility = ""; }
if ( event.button == 1 && event.srcElement.id != "imgMain") {
objDivMenu.style.visibility = "hidden";
objDivFlag.style.visibility = "hidden";
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash