|
**將以下語法放在 <BODY> 和 </BODY> 之間即可顯示功能**
( 紅色xxxxx字部份請更改成你的檔案網址 與 想要表示的字即可 )
熱帶魚放在底下,記得下回去上傳到適當位置.
-
- <script language="JavaScript">
- <!--
- <!--在此修改圖案出現在畫面上的數量-->
- var no = 10;
- <!--在此修改圖案游動的速度,數值越大越慢,越小越快-->
- var speed = 10;
- snow = new Array();
- <!--在此修改需使用的圖案連結路徑-->
- snow[0] = "http://xxxxx/fish1_l.gif";
- snow[1] = "http://xxxxx/fish2_l.gif";
- snow[2] = "http://xxxxx/fish3_l.gif";
- snow[3] = "http://xxxxx/fish4_l.gif";
- snow[4] = "http://xxxxx/fish1_r.gif";
- snow[5] = "http://xxxxx/fish2_r.gif";
- var maxsize = 100;
- var ns4up = (document.layers) ? 1 : 0;
- var ie4up = (document.all) ? 1 : 0;
- var dx, xp, yp;
- var am, stx, sty;
- var i, doc_width = 800, doc_height = 600;
- if (ns4up) {
- doc_width = self.innerWidth;
- doc_height = self.innerHeight;
- } else if (ie4up) {
- doc_width = document.body.clientWidth;
- doc_height = document.body.clientHeight;
- }
- dx = new Array();
- xp = new Array();
- yp = new Array();
- am = new Array();
- stx = new Array();
- sty = new Array();
- var j = 0;
- for (i = 0; i < no; ++ i) {
- dx = 0;
- xp = Math.random()*(doc_height-maxsize);
- yp = Math.random()*(doc_width-maxsize);
- am = Math.random()*10;
- stx = 0.02 + Math.random()/10;
- sty = 0.7 + Math.random();
- if (ns4up) {
- if (i == 0) {
- document.write("<layer name="dot"+ i +"" left="15" top="15" visibility="show"><img src="" + snow[j] + "" border="0"></layer>");
- } else {
- document.write("<layer name="dot"+ i +"" left="15" top="15" visibility="show"><img src="" + snow[j] + "" border="0"></layer>");
- }
- } else if (ie4up) {
- if (i == 0) {
- document.write("<div id="dot"+ i +"" style="POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;"><img src="" + snow[j] + "" border="0"></div>");
- } else {
- document.write("<div id="dot"+ i +"" style="POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;"><img src="" + snow[j] + "" border="0"></div>");
- } }
- if (j == (snow.length-1)) { j = 0; } else { j += 1; }
- }
- document.write("<div id="damy" style="POSITION: absolute; width:1; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: " + (doc_width+maxsize) + "px;"> </div>");
- function snowNS() { // Netscape main animation function
- for (i = 0; i < no; ++ i) { // iterate for every dot
- if (i%2) {
- yp += sty;
- if (yp > doc_width) {
- xp = Math.random()*(doc_height-am-maxsize);
- yp = 0-maxsize;
- stx = 0.02 + Math.random()/10;
- sty = 0.7 + Math.random();
- doc_width = self.innerWidth;
- doc_height = self.innerHeight;
- }
- } else {
- yp -= sty;
- if (yp < -maxsize) {
- xp = Math.random()*(doc_height-am-maxsize);
- yp = doc_width;
- stx = 0.02 + Math.random()/10;
- sty = 0.7 + Math.random();
- doc_width = self.innerWidth;
- doc_height = self.innerHeight;
- } }
- dx += stx;
- document.layers["dot"+i].top = xp + am*Math.sin(dx);
- document.layers["dot"+i].left = yp;
- }
- setTimeout("snowNS()", speed);
- }
- function snowIE() { // IE main animation function
- for (i = 0; i < no; ++ i) { // iterate for every dot
- if (i%2) {
- yp += sty;
- if (yp > doc_width) {
- xp = Math.random()*(doc_height-am-maxsize);
- yp = 0-maxsize;
- stx = 0.02 + Math.random()/10;
- sty = 0.7 + Math.random();
- doc_width = document.body.clientWidth;
- doc_height = document.body.clientHeight;
- }
- } else {
- yp -= sty;
- if (yp < -maxsize) {
- xp = Math.random()*(doc_height-am-maxsize);
- yp = doc_width;
- stx = 0.02 + Math.random()/10;
- sty = 0.7 + Math.random();
- doc_width = document.body.clientWidth;
- doc_height = document.body.clientHeight;
- } }
- dx += stx;
- document.all["dot"+i].style.pixelTop = xp + am*Math.sin(dx);
- document.all["dot"+i].style.pixelLeft = yp;
- }
- setTimeout("snowIE()", speed);
- }
- if (ns4up) {
- snowNS();
- } else if (ie4up) {
- snowIE();
- }
- //-->
- </script>
- <script language="Javascript">
- <!--
- var background = "http://xxxxx/background.gif";
- var speed = 0;
- browserName = navigator.appName;
- browserVer = parseInt(navigator.appVersion);
- if (browserName != "Netscape" || browserVer >= 4.5) {
- function moveback(movert,movedn,hPos,vPos) {
- if (arguments[4])
- document.body.style.backgroundImage = "url("" + arguments[4] + "")";
- if (arguments[5])
- document.body.style.backgroundRepeat = arguments[5]
- if (!isNaN(hPos)) {
- if ((movert!=0) && (hPos>0)) hPos=-100000
- hPos += movert
- }
- if (!isNaN(vPos)) {
- if ((movedn!=0) && (vPos>0)) vPos=-100000
- vPos+= movedn
- }
- document.body.style.backgroundPosition= hPos + " " + vPos
- if (isNaN(hPos)) hPos = """ + hPos + """
- if (isNaN(vPos)) vPos = """ + vPos + """
- setTimeout("moveback("+movert+","+movedn+","+hPos+","+vPos+")",speed)
- }
- moveback(1,1,0,0, background);
- }
- -->
- </script>
複製代碼 |
|