[Programming Game] presents a gift at the age of a new year. (Ignite the fireworks of xiuyouxu on the 2-147 floor) (run in IE)

Source: Internet
Author: User

[Programming Game] presents a gift at the age of a new year. (The first prize is 10000 available points)
Author:
Ignition[Ctrl + A select all tips: you can modify some code and then press run]
<HTML> <br/> <body bgcolor = '#000000'> <br/> <SCRIPT type = "text/JavaScript"> <br/> base = {<br/> config: function (O, C) {<br/> for (var I in c) {<br/> O [I] = C [I]; <br/>}< br/>}, <br/> Get: function (ID) {<br/> return document. getelementbyid (ID); <br/>}, <br/> creatediv: function (divid) {<br/> var OBJ = document. createelement ('div '); <br/> obj. setattribute ('id', divid); <br/> return OBJ; <br/>}, <br/> get Csstext: function (ID) {<br/> If (typeof id = 'string') {<br/> var node = This. get (ID); <br/> return node.style.css text; <br/>}else {<br/> return id.style.css text <br/>}< br/> }, <br/> setcsstext: function (ID, style) {<br/> If (typeof id = 'string') <br/> this.get(id).style.css text = style; <br/> else <br/> id.style.css text = style <br/>}, <br/> replacesubstring: function (STR, substr, newstr) {<br/> Var B = Str. indexof (substr); <br/> var E = B + substr. length; <br/> var L = Str. substring (0, B); <br/> var r = (E + 1) <Str. length? Str. substring (E, str. length): ''; <br/> return L + newstr + R; <br/>}, <br/> changestylebyproperty: function (oldstyle, prop, newvalue) {<br/> var B = oldstyle. indexof (PROP); <br/> var E = oldstyle. indexof (';', B); <br/> var BC = oldstyle. substring (B, E + 1); <br/> var NS = prop + ':' + newvalue + ';' <br/> return this. replacesubstring (oldstyle, BC, NS); <br/>}< br/> pongpong = function (c) {<br/> base. config (this, c); <br/> This. ball = ['○', '● ','★',' ■ ',' ◆ ',' ▲ ']; <Br/> This. G = 1; <br/> This. color = ['red', 'Orange ', 'yellow', 'green', 'Blue', 'purple ', 'pink']; <br/> // This. X = math. floor (document. body. clientwidth/2); <br/> This. y = document. body. clientheight-40; <br/> This. maxheight = document. body. clientheight-50; <br/> This. maxinitialv = math. floor (math. SQRT (2 * This. g * This. maxheight); <br/> This. mininitialv = math. floor (Math <br/>. SQRT (2 * This. g * This. (maxheight * 2/3); <br/> This. riv = 0; <br/> This. WD = document. body. clientwidth; <br/> This. initialstyle = "position: absolute; left:" + this. X + "PX; top:" + this. Y <br/> + "PX; width: 20px; Height: 20px;"; <br/> This. explodecolor = NULL; <br/> This. temp = NULL; <br/> This. init (); <br/>}< br/> pongpong. prototype = {<br/> X: math. floor (document. body. clientwidth/2), <br/> getriv: Fun Ction () {<br/> var r = math. floor (math. random () * This. maxinitialv); <br/> var M = This. maxinitialv-this. mininitialv; <br/> If (r <this. mininitialv) <br/> r = This. mininitialv + R % m; <br/> return r; <br/>}, <br/> init: function () {<br/> This. temp = base. creatediv ('ball'); <br/> This. changecolor (); <br/>}, <br/> randomcolor: function () {<br/> return this. color [math. floor (math. random () * 7)]; <br/>}, <Br/> changecolor: function () {<br/> // set the fireworks color <br/> This. explodecolor = This. randomcolor (); <br/> This. setinnerhtml (this. temp, this. explodecolor); <br/>}, <br/> setinnerhtml: function (El, color) {<br/> el. innerhtml = '<span style = "color:' + color + ';">' <br/> + this. ball [math. floor (math. random () * 6)] + '</span>' <br/>}, <br/> explode: function () {<br/> var left = This. temp. offsetleft; <br/> VaR Top = This. temp. offsettop; <br/> document. body. removechild (this. temp); <br/> document. body. style. backgroundcolor = This. explodecolor; <br/> setTimeout (function () {<br/> document. body. style. backgroundcolor = 'black'; <br/>}, 50); <br/> var Nt = this; <br/> // display the explosive effect <br/> var flag = true; <br/> // number of fragments <br/> var sp = math. floor (math. random () * 6) + 1; <br/> var T = setinterval (function () {<br/> If (FLAG) {< Br/> flag = false; <br/> for (VAR I = 0; I <sp; I ++) {<br/> var SPI = document. getelementbyid ('SP '+ I); <br/> SPI = SPI? SPI: base. creatediv ('SP '+ I); <br/> NT. setinnerhtml (SPI, NT. randomcolor (); <br/> var IX = left + (30-math. floor (math. random () * 60); <br/> var Iy = Top + (30-math. floor (math. random () * 60); <br/> VaR is = "position: absolute; left:" + ix + "PX; top: "+ Iy <br/> +" PX; width: 20px; Height: 20px; "; <br/> document. body. appendchild (SPI); <br/> base. setcsstext (SPI, is); <br/>}< br/>} else {<br/> for (VAR I = 0; I <sp; I ++) {<br/> var Si = document. getelementbyid ('SP '+ I); <br/> If (SI) <br/> document. body. removechild (SI); <br/>}< br/> clearinterval (t); <br/>}< br/>}, 100); <br/> This. changecolor (); <br/>}, <br/> Start: function () {<br/> This. riv = This. getriv (); <br/> document. body. appendchild (this. temp); <br/> var x = math. floor (this. WD/4 + math. random () * This. WD/2) + 'px '; <br/> var NS = base. changestylebyproperty (this. initialstyle, 'left', x); <br/> base. setcsstext (this. temp, NS); <br/> var time = 0; <br/> var Nt = This; <br/> var T = setinterval (function () {<br/> time = Time + 1; <br/> var S = (NT. riv-nt. g * time/2) * time; <br/> var v = nt. riv-nt. g * time; <br/> If (V> = 0) {<br/> var nH = nt. y-S; <br/> var NS = base. changestylebyproperty (base. getcsstext ('ball'), <br/> 'top', NH); <br/> base. setcsstext (NT. temp, NS); <br/>}else {<br/> clearinterval (t); <br/> NT. explode (); <br/> NT. start (); <br/>}< br/>}, 50); <br/>}< br/> window. onload = function () {<br/> var pp = new pongpong (); <br/> PP. start (); <br/>}< br/> </SCRIPT> <br/> </body> <br/> </ptml>
Ignition[Ctrl + A select all tips: you can modify some code and then press run]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.