佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 793|回复: 4

怎样在html 制造 下雪的效果?????????

[复制链接]
发表于 29-11-2006 10:23 PM | 显示全部楼层 |阅读模式
请问大家, 怎样在html 制造 下雪的效果?????????thankssssss
回复

使用道具 举报


ADVERTISEMENT

发表于 29-11-2006 11:59 PM | 显示全部楼层
那个要用java script的。
http://www.dynamicdrive.com/ 《-找看这里应该有
回复

使用道具 举报

发表于 30-11-2006 01:19 AM | 显示全部楼层
回复

使用道具 举报

发表于 30-11-2006 03:52 AM | 显示全部楼层
用marquee tag de!
state ur direction n loop n so on so on lar!
each falling object is 1 marquee tag..
回复

使用道具 举报

发表于 30-11-2006 11:46 PM | 显示全部楼层

  1. <html>
  2. <head>
  3. </head>

  4. <body onload="snow()" bgcolor="black">

  5. <script language="JavaScript">
  6. N = 40;
  7. Y = new Array();
  8. X = new Array();
  9. S = new Array();
  10. A = new Array();
  11. B = new Array();
  12. M = new Array();
  13. V = (document.layers)?1:0;
  14. iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;
  15. iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;
  16. for (i=0; i < N; i++){
  17.   Y[i]=Math.round(Math.random()*iH);
  18.   X[i]=Math.round(Math.random()*iW);
  19.   S[i]=Math.round(Math.random()*5+2);
  20.   A[i]=0; B[i]=Math.random()*0.1+0.1;
  21.   M[i]=Math.round(Math.random()*1+1);
  22. }
  23. if (V){
  24.   for (i = 0; i < N; i++) {
  25.     document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")
  26.   }
  27. }
  28. else{
  29.   document.write('<div style="position:absolute;top:0px;left:0px">');
  30.   document.write('<div style="position:relative">');
  31.   for (i = 0; i < N; i++) {
  32.     document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')
  33.   }
  34.   document.write('</div></div>');
  35. }
  36. function snow(){
  37.   var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;
  38.   var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;
  39.   var T=(document.layers)?window.pageYOffset:document.body.scrollTop;
  40.   var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;
  41.   for (i=0; i < N; i++){
  42.     sy=S[i]*Math.sin(90*Math.PI/180);
  43.     sx=S[i]*Math.cos(A[i]);
  44.     Y[i]+=sy;
  45.     X[i]+=sx;
  46.     if (Y[i] > H){
  47.       Y[i]=-10;
  48.       X[i]=Math.round(Math.random()*W);
  49.       M[i]=Math.round(Math.random()*1+1);
  50.       S[i]=Math.round(Math.random()*5+2);
  51.     }
  52.     if (V){
  53.       document.layers['sn'+i].left=X[i];
  54.       document.layers['sn'+i].top=Y[i]+T
  55.     }
  56.     else{
  57.       si[i].style.pixelLeft=X[i];
  58.       si[i].style.pixelTop=Y[i]+T} A[i]+=B[i];
  59.     }
  60.     setTimeout('snow()',10);
  61.   }
  62. </script>

  63. </body>
  64. </html>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 24-9-2024 07:20 AM , Processed in 0.106006 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表