主題: [求助] [求助]軟體王 的圖片展示是怎麼做的? [打印本頁]
發表人:
bluejim 時間: 2006-9-14 01:58 PM 主題: [求助]軟體王 的圖片展示是怎麼做的?
軟體王 的圖片展示是怎麼做的?
舉例子而言:
http://www.softking.com.tw/soft/clickcount.asp?fid3=6933
在 該軟體相關圖片資料 下面的圖片:
按一下圖片會變大,再按一下會回愎原狀,
請問有人知道方法嗎?
發表人:
阿達猴 時間: 2006-9-14 04:40 PM
請複製以下原始碼到<HEAD></HEAD>之中
<SCRIPT Language=Javascript>
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all
function enlarge(which,e){
//Render image code for IE 4+ and NS6
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (crossobj.style.visibility=="hidden"){
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
crossobj.innerHTML='<div align=right id=drag><b onClick=closepreview() style=font-family:tahoma;font-size:8pt>X</b></div><img src="'+which+'">'
crossobj.style.visibility="visible"
}
else
crossobj.style.visibility="hidden"
return false
}
//Render image code for NS 4
else if (document.layers){
if (document.showimage.visibility=="hide"){
document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which+'" border=0></a>')
document.showimage.document.close()
document.showimage.left=e.x
document.showimage.top=e.y
document.showimage.visibility="show"
}
else
document.showimage.visibility="hide"
return false
}
//if NOT IE 4+ or NS 4, simply display image in full browser window
else
return true
}
function closepreview(){
crossobj.style.visibility="hidden"
}
</script>
<script language="JavaScript1.2">
//By Dynamicdrive.com
//drag drop function for NS 4////
/////////////////////////////////
var nsx,nsy,nstemp
function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
//drag drop function for IE 4+ and NS6////
/////////////////////////////////
function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
}
return false
}
function initializedrag(e){
if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY
tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)
dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
</SCRIPT>
請複製以下原始碼到<BODY></BODY>之中
<div id="showimage" style="position:absolute;visibility:hidden;border:1px solid black"></div>
<a href="原大圖案" onClick="return enlarge('原大圖案',event)"><img src="縮細圖案" border="0"></a>
紅色部份可以自己修改
<div id="showimage" style="position:absolute;visibility:hidden;border:1px solid black"></div>
<a href="原大圖案" onClick="return enlarge('原大圖案',event)"><img src="縮細圖案" border="0"></a>
轉貼來源:i-Web網頁教學
發表人:
bluejim 時間: 2006-9-15 01:35 AM
非常感謝,我努力試一下。
歡迎光臨 TWed2k (http://twed2k.org/) |
Powered by Discuz! 4.1.0 |