资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
多图展示点击切换效果模拟的flash效果,点小图放大显示,再点恢复默认。
多图展示点击切换效果模拟的flash效果,点小图放大显示,再点恢复默认。
<base href='http://demo.rexsong.com/200507/image_onclick_switch/'> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh-cn"> <head> <title>类似于Flash制作的一个图片展示效果</title> <meta name="Author" content="http://www.webjx.com"> <meta http-equiv="imagetoolbar" content="no"> <style type="text/css"> html,body {cursor:crosshair;margin:0; padding:0; position:absolute; overflow:hidden; background:#222; left:0; top:0; width:100%; height:100%;zIndex:-2;} </style> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%3C!--%20%0D%0A%2F%2F%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20%0D%0A%0D%0Awindow.onerror%20%3D%20new%20Function(%22return%20true%22)%3B%20%0D%0Ascreen.bufferDepth%20%3D%2016%3B%20%0D%0Adocument.onselectstart%20%3D%20function%20()%20%7B%20return%20false%3B%20%7D%20%0D%0A%0D%0A%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%20%0D%0Avar%20NX%20%20%20%20%20%3D%203%3B%20%0D%0Avar%20NY%20%20%20%20%20%3D%203%3B%20%0D%0Avar%20SP%20%20%20%20%20%3D%2020%3B%20%0D%0Avar%20DELAY%20%20%3D%2096%3B%20%0D%0A%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%20%0D%0A%0D%0Avar%20object%20%3D%20new%20Array()%3B%20%0D%0Avar%20nI%20%20%20%20%20%3D%200%3B%20%0D%0Avar%20run%20%20%20%20%3D%20false%3B%20%0D%0Avar%20xrun%20%20%20%3D%200%3B%20%0D%0Avar%20dR%20%20%20%20%20%3D%201%3B%20%0D%0Avar%20iW%20%20%20%20%20%3D%200%3B%20%0D%0Avar%20iH%20%20%20%20%20%3D%200%3B%20%0D%0Avar%20oH%20%20%20%20%20%3D%200%3B%20%0D%0Avar%20oW%20%20%20%20%20%3D%200%3B%20%0D%0A%0D%0Afunction%20CObj(N%2Cy%2Cx)%7B%20%0D%0A%0D%0A%20this.obj%20%3D%20document.createElement(%22span%22)%3B%20%0D%0A%20this.obj.onclick%20%3D%20new%20Function(%22object%5B%22%2BN%2B%22%5D.GE1()%22)%3B%20%0D%0A%20this.obj.onmousedown%20%3D%20new%20Function(%22return%20false%3B%22)%3B%20%0D%0A%20this.obj.style.cursor%20%3D%20%22pointer%22%3B%20%0D%0A%20this.obj.style.position%20%3D%20%22absolute%22%3B%20%0D%0A%20this.img%20%3D%20document.createElement(%22img%22)%3B%20%0D%0A%20this.img.style.position%20%3D%20%22absolute%22%3B%20%0D%0A%20this.img.src%20%3D%20IMGSRC%5BN%25nI%5D.src%3B%20%0D%0A%20this.obj.appendChild(this.img)%3B%20%0D%0A%20IMGBOX.appendChild(this.obj)%3B%20%0D%0A%0D%0A%20this.object%20%3D%20new%20Array()%3B%20%0D%0A%20this.x%20%20%20%20%20%20%3D%20x%3B%20%0D%0A%20this.y%20%20%20%20%20%20%3D%20y%3B%20%0D%0A%20this.N%20%20%20%20%20%20%3D%20N%3B%20%0D%0A%20this.W%20%20%20%20%20%20%3D%200%3B%20%0D%0A%20this.H%20%20%20%20%20%20%3D%200%3B%20%0D%0A%20this.L%20%20%20%20%20%20%3D%200%3B%20%0D%0A%20this.T%20%20%20%20%20%20%3D%200%3B%20%0D%0A%0D%0A%20function%20CImg(Parent%2Cy%2Cx)%7B%20%0D%0A%20%20this.Parent%20%3D%20Parent%3B%20%0D%0A%0D%0A%20%20this.obj%20%3D%20document.createElement(%22span%22)%3B%20%0D%0A%20%20this.obj.style.position%3D%22absolute%22%3B%20%0D%0A%20%20this.obj.style.overflow%3D%22hidden%22%3B%20%0D%0A%20%20this.obj.style.cursor%20%3D%20%22pointer%22%3B%20%0D%0A%20%20this.img%20%3D%20document.createElement(%22img%22)%3B%20%0D%0A%20%20this.img.style.position%20%3D%20%22absolute%22%3B%20%0D%0A%20%20this.img.src%20%3D%20IMGSRC%5BN%25nI%5D.src%3B%20%0D%0A%20%20this.obj.appendChild(this.img)%3B%20%0D%0A%20%20this.Parent.obj.appendChild(this.obj)%3B%20%0D%0A%0D%0A%20%20this.N%20%20%20%3D%20Parent.N%3B%20%0D%0A%20%20this.x%20%20%20%3D%20x%3B%20%0D%0A%20%20this.y%20%20%20%3D%20y%3B%20%0D%0A%20%20this.W%20%20%20%3D%200%3B%20%0D%0A%20%20this.H%20%20%20%3D%200%3B%20%0D%0A%20%20this.L%20%20%20%3D%200%3B%20%0D%0A%20%20this.T%20%20%20%3D%200%3B%20%0D%0A%20%20this.dx%20%20%3D%200%3B%20%0D%0A%20%20this.dy%20%20%3D%200%3B%20%0D%0A%20%20this.px%20%20%3D%200%3B%20%0D%0A%20%20this.py%20%20%3D%200%3B%20%0D%0A%20%20this.dw%20%20%3D%200%3B%20%0D%0A%20%20this.dh%20%20%3D%200%3B%20%0D%0A%20%20this.pw%20%20%3D%200%3B%20%0D%0A%20%20this.ph%20%20%3D%200%3B%20%0D%0A%20%20this.ipx%20%3D%200%3B%20%0D%0A%20%20this.ipy%20%3D%200%3B%20%0D%0A%20%20this.idx%20%3D%200%3B%20%0D%0A%20%20this.idy%20%3D%200%3B%20%0D%0A%0D%0A%20%20this.GE2%20%3D%20function%20()%7B%20%0D%0A%20%20%20with(this)%7B%20%0D%0A%20%20%20%20px%20-%3D%20dx%20*%20dR%3B%20%0D%0A%20%20%20%20py%20-%3D%20dy%20*%20dR%3B%20%0D%0A%20%20%20%20pw%20%2B%3D%20dw%20*%20dR%3B%20%0D%0A%20%20%20%20ph%20%2B%3D%20dh%20*%20dR%3B%20%0D%0A%20%20%20%20ipx%20-%3D%20idx%20*%20dR%3B%20%0D%0A%20%20%20%20ipy%20-%3D%20idy%20*%20dR%3B%20%0D%0A%0D%0A%20%20%20%20with(obj.style)%7B%20%0D%0A%20%20%20%20%20left%20%20%20%3D%20Math.round(px)%3B%20%0D%0A%20%20%20%20%20top%20%20%20%20%3D%20Math.round(py)%3B%20%0D%0A%20%20%20%20%20width%20%20%3D%20Math.round(pw)%2B1%3B%20%0D%0A%20%20%20%20%20height%20%3D%20Math.round(ph)%2B1%3B%20%0D%0A%20%20%20%20%20if(dR%3D%3D-1)if(pw%3C%3DW%2B1)obj.style.visibility%3D%22hidden%22%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%0D%0A%20%20%20%20with(img.style)%7B%20%0D%0A%20%20%20%20%20left%20%20%20%3D%20Math.round(ipx-oW)%3B%20%0D%0A%20%20%20%20%20top%20%20%20%20%3D%20Math.round(ipy-oH)%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%0D%0A%20%20%20%20if(%2B%2Bxrun%3E%3DNX*NY*SP)%7B%20%0D%0A%20%20%20%20%20xrun%3D0%3B%20%0D%0A%20%20%20%20%20run%3Dfalse%3B%20%0D%0A%20%20%20%20%20if(dR%3D%3D-1)Parent.obj.style.zIndex%20%3D%200%3B%20%0D%0A%20%20%20%20%20dR%20%3D%20-dR%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%7D%20%0D%0A%0D%0A%20%20this.GE1%20%3D%20function%20(N1%2CN2)%7B%20%0D%0A%20%20%20with(this)%7B%20%0D%0A%20%20%20%20if(dR%3D%3D1)%7B%20%0D%0A%20%20%20%20%20px%20%20%3D%20L%3B%20%0D%0A%20%20%20%20%20py%20%20%3D%20T%3B%20%0D%0A%20%20%20%20%20dx%20%20%3D%20((Parent.L%20%2B%20L)%20-%20(x%20*%20Parent.W))%20%2F%20SP%3B%20%0D%0A%20%20%20%20%20dy%20%20%3D%20((Parent.T%20%2B%20T)%20-%20(y%20*%20Parent.H))%20%2F%20SP%3B%20%0D%0A%20%20%20%20%20pw%20%20%3D%20W%3B%20%0D%0A%20%20%20%20%20ph%20%20%3D%20H%3B%20%0D%0A%20%20%20%20%20dw%20%20%3D%20(Parent.W%20-%20W)%20%2F%20SP%3B%20%0D%0A%20%20%20%20%20dh%20%20%3D%20(Parent.H%20-%20H)%20%2F%20SP%3B%20%0D%0A%20%20%20%20%20ipx%20%3D%20-L%3B%20%0D%0A%20%20%20%20%20ipy%20%3D%20-T%3B%20%0D%0A%20%20%20%20%20idx%20%3D%20((x%20*%20Parent.W)%20-%20L)%20%2F%20SP%3B%20%0D%0A%20%20%20%20%20idy%20%3D%20((y%20*%20Parent.H)%20-%20T)%20%2F%20SP%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20obj.style.visibility%3D%22visible%22%3B%20%0D%0A%20%20%20%20if(img.height%3Edocument.body.offsetHeight)oH%3D(img.height-document.body.offsetHeight)%2F2%3B%20else%20oH%20%3D%200%3B%20%0D%0A%20%20%20%20if(img.width%3Edocument.body.offsetWidth%2F2)oW%3D(img.width-(document.body.offsetWidth%2F2))%2F2%3B%20else%20oW%20%3D%200%3B%20%0D%0A%20%20%20%20for(i%3D0%3Bi%3CSP%3Bi%2B%2B)%20setTimeout(%22object%5B%22%2BN1%2B%22%5D.object%5B%22%2BN2%2B%22%5D.GE2()%22%2C16*i)%3B%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%7D%20%0D%0A%0D%0A%20%20this.DOOT%20%3D%20function%20()%7B%20%0D%0A%20%20%20with(this)%7B%20%0D%0A%20%20%20%20W%20%3D%20%20Parent.W%20%20%2F%20NX%3B%20%0D%0A%20%20%20%20H%20%3D%20%20Parent.H%20%2F%20NY%3B%20%0D%0A%20%20%20%20L%20%3D%20%20x%20*%20W%3B%20%0D%0A%20%20%20%20T%20%3D%20%20y%20*%20H%3B%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%7D%20%0D%0A%20%7D%20%0D%0A%0D%0A%20var%20%20k%20%3D%200%3B%20%0D%0A%20for(var%20i%3D0%3Bi%3CNY%3Bi%2B%2B)%20%0D%0A%20%20for(var%20j%3D0%3Bj%3CNX%3Bj%2B%2B)%20%0D%0A%20%20%20this.object%5Bk%2B%2B%5D%20%3D%20new%20CImg(this%2Ci%2Cj)%3B%20%0D%0A%0D%0A%20this.GE1%20%20%3D%20function%20()%7B%20%0D%0A%20%20with(this)%7B%20%0D%0A%20%20%20if(!run)%7B%20%0D%0A%20%20%20%20TXTBOX.innerHTML%20%3D%20%22%3Cdiv%20style%3D'margin%3A2%25'%3E%22%2BTXTSRC%5BN%25nI%5D.innerHTML%2B%22%3C%2Fdiv%3E%22%3B%20%0D%0A%20%20%20%20run%20%3D%20true%3B%20%0D%0A%20%20%20%20obj.style.zIndex%20%3D%201%3B%20%0D%0A%20%20%20%20for(var%20i%3D0%3Bi%3CNX*NY%3Bi%2B%2B)%20setTimeout(%22object%5B%22%2BN%2B%22%5D.object%5B%22%2Bi%2B%22%5D.GE1(%22%2BN%2B%22%2C%22%2Bi%2B%22)%22%2Ci*DELAY)%3B%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%7D%20%0D%0A%20%7D%20%0D%0A%0D%0A%20this.DOOT%20%3D%20function%20()%7B%20%0D%0A%20%20with(this)%7B%20%0D%0A%20%20%20if(img.width%3CiW)iW%3Dimg.width%3B%20%0D%0A%20%20%20if(img.height%3CiH)iH%3Dimg.height%3B%20%0D%0A%20%20%20with(obj.style)%7B%20%0D%0A%20%20%20%20W%20%3D%20width%20%20%3D%20iW%20%20%2F%20NX%3B%20%0D%0A%20%20%20%20H%20%3D%20height%20%3D%20iH%20%2F%20NY%3B%20%0D%0A%20%20%20%20L%20%3D%20left%20%20%20%3D%20x%20*%20W%3B%20%0D%0A%20%20%20%20T%20%3D%20top%20%20%20%20%3D%20y%20*%20H%3B%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%20with(img.style)%7B%20%0D%0A%20%20%20%20width%20%20%3D%20W%3B%20%0D%0A%20%20%20%20height%20%3D%20H%3B%20%0D%0A%20%20%20%7D%20%0D%0A%20%20%20for(var%20i%20in%20object)%20object%5Bi%5D.DOOT()%3B%20%0D%0A%20%20%7D%20%0D%0A%20%7D%20%0D%0A%7D%20%0D%0A%0D%0A%0D%0Aonload%20%3D%20function()%20%7B%20%0D%0A%20IMGSRC%20%3D%20document.getElementById(%22imgsrc%22).getElementsByTagName(%22img%22)%3B%20%0D%0A%20TXTSRC%20%3D%20document.getElementById(%22txtsrc%22).getElementsByTagName(%22div%22)%3B%20%0D%0A%20IMGBOX%20%3D%20document.getElementById(%22imgbox%22)%3B%20%0D%0A%20TXTBOX%20%3D%20document.getElementById(%22txtbox%22)%3B%20%0D%0A%20CENTER%20%3D%20document.getElementById(%22center%22)%3B%20%0D%0A%20iH%20%3D%20document.body.offsetHeight%3B%20%0D%0A%20iW%20%3D%20document.body.offsetWidth%2F2%3B%20%0D%0A%20nI%20%3D%20IMGSRC.length%3B%20%0D%0A%20var%20k%20%3D%200%3B%20%0D%0A%20for(var%20i%3D0%3Bi%3CNY%3Bi%2B%2B)%7B%20%0D%0A%20%20for(var%20j%3D0%3Bj%3CNX%3Bj%2B%2B)%7B%20%0D%0A%20%20%20object%5Bk%5D%20%3D%20new%20CObj(k%2Ci%2Cj)%3B%20%0D%0A%20%20%20object%5Bk%2B%2B%5D.DOOT()%3B%20%0D%0A%20%20%7D%20%0D%0A%20%7D%20%0D%0A%20IMGBOX.style.width%20%20%3D%20iW%3B%20%0D%0A%20IMGBOX.style.height%20%3D%20iH%3B%20%0D%0A%20TXTBOX.style.width%20%20%3D%20iW%3B%20%0D%0A%20TXTBOX.style.height%20%3D%20iH%3B%20%0D%0A%20TXTBOX.style.left%20%20%20%3D%20iW%3B%20%0D%0A%20TXTBOX.style.visibility%3D%22visible%22%3B%20%0D%0A%20CENTER.style.left%20%20%20%3D%20-iW%3B%20%0D%0A%20CENTER.style.top%20%20%20%20%3D%20-iH%2F2%3B%20%0D%0A%7D%20%0D%0A%2F%2F--%3E%20%0D%0A%3C%2Fscript%3E"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <div style="position:absolute;left:50%;top:50%;"><div id="center" style="position:absolute;"> <div id="imgbox" style="position:absolute;left:0;top:0;overflow:hidden;"></div> <div id="txtbox" style="position:absolute;visibility:hidden;overflow:hidden;background:#333;color:#FFF;font-family:verdana;font-size:0.8em;"> <div style="margin:2%"> <h2>IMGBOX</h2>Click the thumbnails on the left for a larger image. The description connected to the clicked image is displayed here. Note: for performance reasons, images are not resized and must be all of the same size. </div> </div> </div></div> <div id="imgsrc" style="visibility:hidden"> <img src="BS9097.jpg" _ewebeditor_ta_src="BS9097.jpg"> <img src="BS9092.jpg" _ewebeditor_ta_src="BS9092.jpg"> <img src="BS9084.jpg" _ewebeditor_ta_src="BS9084.jpg"> <img src="BS9064.jpg" _ewebeditor_ta_src="BS9064.jpg"> <img src="BS9050.jpg" _ewebeditor_ta_src="BS9050.jpg"> <img src="BS9070.jpg" _ewebeditor_ta_src="BS9070.jpg"> <img src="BS9079.jpg" _ewebeditor_ta_src="BS9079.jpg"> <img src="BS9068.jpg" _ewebeditor_ta_src="BS9068.jpg"> <img src="BS9039.jpg" _ewebeditor_ta_src="BS9039.jpg"> </div> <div id="txtsrc" style="visibility:hidden"> <div> <h2>the river</h2> Awaken from my nap by the river </div> <div> <h2>transparency</h2> Its transparency was hypnotizing. </div> <div> <h2>cold</h2> Currents of cold water played with light. </div> <div> <h2>sank in</h2> I threw a few nuts into the river. They floated for a while, then sank in. </div> <div> <h2>masked</h2> A wide stepping stone masked the water's depth. </div> <div> <h2>a glimpse</h2> Later on, I had a glimpse of the river's bed. </div> <div> <h2>forgotten</h2> The wheelchair made a noise. Again, I had forgotten about my legs. </div> <div> <h2>floated</h2> Still, I floated in oblivion of things too real. </div> <div> <h2>for me</h2> I stared fixedly at the water's open arms. The stream was singing for me. </div> </div> <!-- crossbrowser images_loading_bar - Gerard Ferrandez - www.dhteumeuleu.com - Feb 2005 --> <span id=LB0 style="position:absolute;left:50%;top:50%;"> <span style="position:absolute;font-family:arial;font-size:10px;color:#FFFFFF;left:-50;top:-18">Loading...</span> <span style="position:absolute;left:-50;top:-5;font-size:1px;width:100;height:10px;background:#333"> <span id=LB1 style="position:absolute;left:0;top:0;font-size:1px;width:0;height:10px;background:#FFFFFF"></span> </span> </span> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0Am00%3Ddocument.getElementById(%22imgsrc%22).getElementsByTagName(%22img%22)%3B%20%0D%0Am01%3Dm00.length%3Bfunction%20images_loading_bar()%7Bm02%3D0%3B%20%0D%0Afor(i%3D0%3Bi%3Cm01%3Bi%2B%2B)m02%2B%3D(m00%5Bi%5D.complete)%3F1%3A0%3B%20%0D%0Adocument.getElementById(%22LB1%22).style.width%3DMath.round(m02%2Fm01*100)%3B%20%0D%0Aif(m02%3D%3Dm01)setTimeout(%22document.getElementById('LB0').style.display%3D'none'%22%2C128)%3B%20%0D%0Aelse%20setTimeout(%22images_loading_bar()%22%2C%2064)%3B%7D%3B%20%0D%0Aimages_loading_bar()%3B%20%0D%0A%3C%2Fscript%3E"> <!-- end of images_loading_bar code --> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程