TShopping

 找回密碼
 註冊
搜索
查看: 1811|回復: 3
打印 上一主題 下一主題

[分享] 移動式公告小視窗

[複製鏈接]
跳轉到指定樓層
1#
發表於 2008-6-1 16:21:40 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
程式碼內容如下:

在<body>之下貼上下面語法:

<script language="javascript1.2">
var dragswitch=0
var nsx
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){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for IE 4+////
/////////////////////////////////

var dragapproved=false

function drag_dropie(){
if (dragapproved==true){
document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
document.all.showimage.style.pixelTop=tempy+event.clientY-iey
return false
}
}

function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=showimage.style.pixelLeft
tempy=showimage.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}

if (document.all){
document.onmouseup=new Function("dragapproved=false")
}

////drag drop functions end here//////

function hidebox(){
if (document.all)
showimage.style.visibility="hidden"
else if (document.layers)
document.showimage.visibility="hide"
}
</script>

<div id="showimage" style="position: absolute; width: 563; left: 50; top: 50; height: 46">
<table border="0" width="250" bgcolor="#000080" cellspacing="0" cellpadding="2">
<tr>
<td width="100%" align="center" valign="middle"><table border="0" width="100%" cellspacing="0" cellpadding="0"
height="36">
<tr>
<td  style="cursor:hand" width="100%" align="left"><font size="2"><ilayer width="100%"><layer width="100%"  >
<font color="#FFFFFF">可移動本公告小視窗喔!</font></layer></ilayer></font></td>
<td style="cursor:hand"><a href="#" > <img src="http://hi.chjh.tpc.edu.tw/~s80419/001.jpg" alt="關閉" width="16" height="14" border=0></a></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2" align="left">
<font size="2" color="#6699FF">這是一個可移動拖曳的視窗<br>
設定很簡單又好用還等什麼哩 ...</font> </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>


將紅色網址是x的圖
如果不想用
也可用其他圖代替

 

臉書網友討論
2#
發表於 2011-6-25 01:04:35 | 只看該作者
樓主,支持!  

版主招募中

*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-27 00:18 , Processed in 0.067929 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表