JavaScript achieves snow (SNOW)

xiaoxiao2021-03-06  39

Code 1: happy new year </ title> <body bgcolor = "# ff3300" leftmargin = "0" TopMargin = "0" OnLoad = "Snow ()" AAAD98> <script language = "javascript"> <! - n = 100; y = new array (); x = new array (); s = new array (); a = new arch (); b = new array (); m = new array (); v = ? (document.layers) 1:? 0; iH = (document.layers) window.innerHeight: window.document.body.clientHeight; iW = (document.layers) window.innerWidth: window.document.body.clientWidth;? For (i = 0; i <n; i ) {y [i] = math.round (math.random () * ih); x [i] = math.Round (math.random () * IW); s [i] = math.Round (math.random () * 5 2); a [i] = 0; b [i] = math.random () * 0.1 0.1; M [i] = math.Round Math.random () * 1 1);} if (v) {for (i = 0; i <n; i ) {document.write ("<layer name = 'SN" i "' left = 0 TOP = 0 bgcolor = '# ffffff' clip = '0, 0, " M [i] ", " M [i] "'> </ layer> ")}} else {document.write ('< Div style = "Position: absolute; top: 0px; left: 0px">); document.write ('<div style = "position: relative">'); for (i = 0; i <n; i ) {Document.write ('<div id = "si "style =" Position: absolute; top: 0; Left: 0; width: ' m [i] '; height: ' m [i] '; Background: #fffff; font-size: ' m [i] '"> </ div>')} Document.write ('</ div> </ div>');} Function Snow () {var h = (Document.Layers)? Window.innerHeight: Window .Document.body.clientHeight; var w =</p> <p>? (Document.layers) window.innerWidth: window.document.body.clientWidth; var T = (document.layers) window.pageYOffset:? Document.body.scrollTop; var L = (document.layers) window.pageXOffset:? Document.body.scrollLeft; for (i = 0; i <n; i ) {sy = s [i] * math.sin (90 * math.pi / 180); sx = s [i] * math.cos A [i]); y [i] = sy; x [i] = sx; if (y [i]> h) {y [i] = - 10; x [i] = math.round (Math .random () * w); M [i] = math.round (math.random () * 1 1); s [i] = math.round (math.random () * 5 2);} (V) {document.Layers ['SN' i] .left = x [i]; document.Layers ['Sn' i] .top = y [i] t} else {Si [i] .style .pixelleft = x [i]; si [i] .style.pixeltop = y [i] t} a [i] = b [i];} setTimeout ('Snow ()', 20);} // -> </ script> code 2: <body bgcolor = # eE3300> <style> .drop {position: absolute; width: 3; Filter: flipv (), fliph (); font-size: 40; color: # Ffffff} </ stop> <script language = "javascript"></p> <p>Snow = false; // false-rain; True-snowSnowSym = "*" file: // THESE ARE THE SYMBOLS for Eachrainsym = "*" File: // You can put images here.howMANY = 20 file: // how Many DROPS / SNOWFLAKES?</p> <p>/ ************** DO NOT NEED TO CHANGE Anything Below *********** / IF (SNOW) {SYM = SnowSym; Speed ​​= 1; Angle = 10 ; Drops = HOWMANY} else {SYM = RAINSYM; Speed ​​= 30; DROPS = HOWMANY; Angle = 6} Movex = -speed / angle; movey = speed; count = 0;</p> <p>Function move () {for (Move = 0; Move <Drops; Move ) {xx [Move] = MoveX; yy [move] = mv [Move]; hmm = math.Round (Math.random () * 1 ); if (XX [Move] <0) {xx [Move] = MaxX 10;}} (YY [MOVE]> MAXY) {yy [move] = 10;} DROP [Move] .left = xx [Move] ] DROP [Move] .top = yy [Move] Document.body.ScrollTop;} settimeout ('MoveRain ()', '1')} </ script> <script language = "javascript"></p> <p>IF (Document.all) {Drop = New Array (); xx = new array (); yy = new array (); mv = new array () = "Document.all [/ '"; st = "/' ] .style "for (Make = 0; make <Drops; Make ) {document.write ('<div id =" Drop' Make '"Class = Drop>' SYM '</ div>'); DROP [ Make] = evAl (LY 'DROP' MAKE ST); maxx = document.body.clientwidth-40maxy = document.body.clientHeight-40xx [make] = math.random () * maxX; yy [make] = - 100-math.random () * Maxy; Drop [make] .left = xx [opportune] Drop [make] .top = yy [make] mv [make] = (Math.rake] = (Math.rake] = (Math.rake] * 5) Speed ​​/ 16 Drop [make] .FONTSIZE = (Math.random () * 10) 20; if (snow) {color = 'white'} else {color = 'white'} Drop [Make] .COLOR = COL; .οnlοad = MoveRin} </ script> </ body> code 3: <body bgcolor = # eE3300> <script language = "javascript1.2"> <! - var no = 25; var speed = 10; var snowflake = "http://www.cnbruce.com/blog/uploadimg/200412215384750532.gif";</p> <p>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 (); stx = new array (); style (); style (); for (i = 0; i <NO; i) {dx [i] = 0; XP [i] = math.random () * (DOC_WIDTH-50); YP [i] = math.random () * DOC_HEIGHT; AM [i] = math.random () * 20; STX [i] = 0.02 math.random () / 10; STY [i] = 0.7 math.random (); if (ns4up) {if (i == 0) {document.write ("<layer name = / "DOT" i "/" LEFT = / "15 /" "); document.write (" top = / "15 /" visibility = / "show /"> <img src = / ""); document. Write (Snowflake "/" Border = / "0 /"> </ layer> ");} else {docuument.write (" <layer name = / "dot" i "/" left = / "15 / ""); Document.write ("TOP = /" 15 / "Visibility = /" show / "> <img src = /" "); Document.write (Snowflake " / "Border = /" 0 / "> </ layer = /");}}} else if (IE4UP) {IF (i == 0) {document.write ("<div id = /" DOT " i " / "style = /" position: "); Document.write (" Absolute; z-index: " i "; Visibility: "); Document.write (" Visible; Top: 15px; Left: 15px; / "> <IMG SRC = / "");</p> <p>Document.write (Snowflake "/" Border = / "0 /"> </ div> ");} else {document.write (" <div id = / "dot" i "/" style = / " Position: "); Document.write (" Absolute; Z-Index: " i "; Visibility: "); Document.write (" Visible; Top: 15px; Left: 15px; / "> <img src = / "" "; Document.write (Snowflake " / "Border = /" 0 / "> </ div>");}}} function snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} Function Snowns ()}} NO; i) {// Iterate for Every Dot Yp [i] = STY [I]; if (YP [i]> DOC_HEIGHT-50) {XP [i] = math.random () * (DOC_WIDTH- AM [i] -30); YP [i] = 0; STX [I] = 0.02 math.random () / 10; STY [I] = 0.7 math.random (); doc_width = self.innerwidth; doc_height = Self.innerHeight;} DX [i] = stx [i]; document.Layers ["DOT" i] .top = YP [i]; Document.Layers ["DOT" i] .left = XP [ I] AM [i] * math.sin (DX [I]);} settimeout ("SNOWNS ()", speed);} function snowie () {// i = 0; i < NO; i) {// Iterate for Every Dot Yp [i] = STY [I]; if (YP [i]> DOC_HEIGHT-50) {XP [i] = math.random () * (DOC_WIDTH- AM [i] -30); YP [i] = 0 ; STX [I] = 0.02 math.random () / 10; STY [I] = 0.7 math.random (); doc_width = document.body.clientwidth; doc_height = document.body.clientHeight;} DX [i] = Stx [I]; Document.all ["DOT" i] .style.pixeltop = YP [i]; document.all ["DOT" i] .style.pixelleft = XP [i] am [i ] * Math.sin (DX [I]);} settimeout ("Snowie ()", speed);} if (ns4up) {Snowns ();</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-77127.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="77127" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.051</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '8dpZL6FGldZcfNddanMIIbnveifidcJLU9CmE6LbxaEAe29vFE3nW3SNGNvxTh2HAuIOsqpd_2BWYH1Ts9tG_2FVPQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>