飄浮的連結
檔案下載 : 1
將下列程式碼複製至<head>程式碼</head>區內。
<div id="waterMark" style="position: absolute; left: 120; top: 12;
width: 90; height: 16"> <a href="../index.htm"><img src="nslogo.jpg" alt="鄉城風情" border="0" width="100" height="50"></a> <script language="JavaScript1.2"> <!-- markW = 100; // 圖檔的寬 markH = 50; // 圖檔的長 markX =98; // 螢幕上X軸的位置 markY = 40; // 螢幕上Y軸的位置 markRefresh = 1; // 每幾千分之一秒重新定位 // set common object reference if (!document.all) document.all = document; if (!document.all.waterMark.style) document.all.waterMark.style = document.all.waterMark; wMark = document.all.waterMark.style; wMark.width = markW; wMark.height = markH; navDOM = window.innerHeight; function setVals() { barW = 0; barH = 0; if (navDOM) { if (document.height > innerHeight) barW = 20; if (document.width > innerWidth) barH = 20; } else { innerWidth = document.body.clientWidth; innerHeight = document.body.clientHeight; } posX = ((innerWidth - markW)-barW) * (markX/100); posY = ((innerHeight - markH)-barH) * (markY/100); } function wRefresh() { wMark.left = posX + (navDOM?pageXOffset:document.body.scrollLeft); wMark.top = posY + (navDOM?pageYOffset:document.body.scrollTop); } function markMe() { setVals(); window.onresize=setVals; markID = setInterval ("wRefresh()",markRefresh); } window.onload=markMe; //--> </script> </div> |