电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

给地图找个放大镜


发布日期:2023/11/13
 

<html>

<head><meta httpequiv="ContentType" content="text/html; charset=gb"><title>网页特效观止|wwwjscodecn| 给地图加个放大镜</title><SCRIPT>var shrinkfactor=// left and top position of the thumbnailimage// (distance to the left and top browsermargin pixels)var thumbleft = var thumbtop = // left and top position of the zoomed image// (distance to the left and top browsermargin pixels)var largeleft = var largetop = // width and height of the enlarged images sector (visible part pixels)var clipwidth = var clipheight = </SCRIPT><SCRIPT>var isNav isIEvar offsetX offsetYvar selectedObjvar largewidth = var largeheight = var thumbwidth = Mathfloor(largewidth/shrinkfactor)var thumbheight = Mathfloor(largeheight/shrinkfactor)var dragimgwidth = Mathfloor(clipwidth/shrinkfactor)var dragimgheight = Mathfloor(clipheight/shrinkfactor)var dragimgleft = thumbleft+var dragimgtop = thumbtop+var difleft= largeleftthumbleftvar diftop= largetopthumbtopvar clippointsvar cliptop=var clipbottom=cliptop+clipheightvar clipleft=var clipright=clipleft+clipwidthif (parseInt(navigatorappVersion) >= ) {if (navigatorappName == "Netscape") {isNav = true} else {isIE = true}}function setZIndex(obj zOrder) {objzIndex = zOrder}function shiftTo(obj x y) {if (isNav) { if(x<=documentthumbleft) {x=documentthumbleft}if(x>=(documentthumbleft+thumbwidthdragimgwidth)) {x=documentthumbleft+thumbwidthdragimgwidth}if(y<=documentthumbtop) {y=documentthumbtop}if(y>=(documentthumbtop+thumbheightdragimgheight)) {y=documentthumbtop+thumbheightdragimgheight}objmoveTo(xy)} else {if(x<=documentallthumbstyleposLeft) {x=documentallthumbstyleposLeft}if(x>=(documentallthumbstyleposLeft+thumbwidthdragimgwidth)) {x=documentallthumbstyleposLeft+thumbwidthdragimgwidth}if(y<=documentallthumbstyleposTop) {y=documentallthumbstyleposTop}if(y>=(documentallthumbstyleposTop+thumbheightdragimgheight)) {y=documentallthumbstyleposTop+thumbheightdragimgheight}objpixelLeft = xobjpixelTop = y}cliptop = (ythumbtop)*shrinkfactorclipbottom = cliptop+clipheightclipleft = (xthumbleft)*shrinkfactorclipright = clipleft+clipwidthif (documentall) {clippoints ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"documentalllargestyleposTop=largetopcliptopdocumentalllargestyleposLeft=largeleftclipleftdocumentalllargestyleclip=clippoints}if (documentlayers) {documentlargetop=largetopcliptopdocumentlargeleft=largeleftclipleftdocumentlargeclipleft = clipleftdocumentlargeclipright = cliprightdocumentlargecliptop = cliptopdocumentlargeclipbottom = clipbottom}}function setSelectedElem(evt) {if (isNav) {var testObjvar clickX = evtpageXvar clickY = evtpageYfor (var i = documentlayerslength ; i >= ; i) {testObj = documentlayers[i]if ((clickX > testObjleft) &&(clickX < testObjleft + testObjclipwidth) &&(clickY > testObjtop) &&(clickY < testObjtop + testObjclipheight && documentlayers[i]id=="dragimg")) {selectedObj = testObjsetZIndex(selectedObj )return}}} else {var imgObj = windoweventsrcElementif (imgObjparentElementidindexOf("dragimg") != ) {selectedObj = imgObjparentElementstylesetZIndex(selectedObj)return}}selectedObj = nullreturn}function dragIt(evt) {if (selectedObj) {if (isNav) {shiftTo(selectedObj (evtpageX offsetX) (evtpageY offsetY))} else {shiftTo(selectedObj (windoweventclientX offsetX) (windoweventclientY offsetY))return false}}}function engage(evt) {setSelectedElem(evt)if (selectedObj) {if (isNav) {offsetX = evtpageX selectedObjleftoffsetY = evtpageY selectedObjtop} else {offsetX = windoweventoffsetXoffsetY = windoweventoffsetY}}return false}function release(evt) {if (selectedObj) {setZIndex(selectedObj )selectedObj = null}}function setNavEventCapture() {if (isNav) {documentcaptureEvents(EventMOUSEDOWN | EventMOUSEMOVE | EventMOUSEUP)}}function init() {if (documentlayers) { var imageurl=documentlargedocumentlargepicsrc largewidth=documentlargedocumentwidthlargeheight=documentlargedocumentheightthumbwidth = Mathfloor(largewidth/shrinkfactor)thumbheight = Mathfloor(largeheight/shrinkfactor) documentthumbdocumentwrite("<IMG NAME=thumbpic SRC="+imageurl+" width="+thumbwidth+" height="+thumbheight+">") documentthumbdocumentclose()documentdragimgdocumentwrite("<IMG NAME=dragimgpic border= SRC=dragimggif width="+dragimgwidth+" height="+dragimgheight+">") documentdragimgdocumentclose()documentlargeleft=largeleftdocumentlargetop=largetopdocumentthumbleft=thumbleftdocumentthumbtop=thumbtopdocumentdragimgleft=dragimgleftdocumentdragimgtop=dragimgtopdocumentlargeclipleft=clipleftdocumentlargeclipright=cliprightdocumentlargecliptop=cliptopdocumentlargeclipbottom=clipbottomdocumentlargevisibility="visible"setNavEventCapture()}if (documentall) { var imageurl=documentlargepicsrclargewidth=documentalllargeoffsetWidthlargeheight=documentalllargeoffsetHeightthumbwidth = Mathfloor(largewidth/shrinkfactor)thumbheight = Mathfloor(largeheight/shrinkfactor)thumbinnerHTML="<IMG NAME=thumbpic SRC="+imageurl+" width="+thumbwidth+" height="+thumbheight+">"dragimginnerHTML="<IMG NAME=dragimgpic border= SRC= width="+dragimgwidth+" height="+dragimgheight+">"documentalllargestyleposLeft=largeleftdocumentalllargestyleposTop=largetopdocumentallthumbstyleposLeft=thumbleftdocumentallthumbstyleposTop=thumbtopdocumentalldragimgstyleposLeft=dragimgleftdocumentalldragimgstyleposTop=dragimgtopclippoints ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"documentalllargestyleclip=clippointsdocumentalllargestylevisibility="visible"}documentonmousedown = engagedocumentonmousemove = dragItdocumentonmouseup = release}windowonload=init</SCRIPT></head><body><p>用鼠标移动下面的方框效果不错吧</p><center><DIV style="position:absolute;visibility:hidden;" ID="large"><IMG NAME="largepic" SRC="<DIV style="position:absolute;" ID="thumb"></DIV><DIV style="position:absolute;" ID="dragimg"></DIV></center></body></html>

上一篇:选择器中含有空格在使用示例及注意事项

下一篇:只能输入汉字