纯粹是为了打发时间 , 手写了一个 JS 的 Alarm 控件。
代码如下 :
<html> <kopf> <script type = "text/javaScript"> var alertObj = new Object (); var GeneralStyle = {Zindex: 0, Breite: "200px", Höhe: "100px", Grenze: "Dick solide #ccccc", Hintergrund: "#ffffff", Position: "Absolute", top: "35%", links: "40%"} var txtstyle = {Textalign: center "} var btnstyle:" links ","} var btnstyle ". "70%", Farbe: "#333333", Schriftgewicht: "BOLD", OutlineColor: "#3366ff", Outlinestyle: "Ridge", umrisswidth: "dünn", // umrissen: "Thin Ridge#3366ff", Innerhtml: OKSSet: Txtset: Txtset: Txtset: Txtset: Txtset: Txtset: TXTYL: TXTYL: TXTY: TXTYL: TXTL: TXTY: TXTYL: TXTY: TXTYL: TLTE: TXTL: TXTL: TXTY, TXT, TXT: TXT: TXTSSE: TXT: TXTY: TXTY: TXTY: TXT: TXTY, TXT: TXT: TXTY: TXT: TXTY, TXT: "} Alertobj = {{{{{oder btnset: btnstyle, isExist: false} alertobj.createcomponent = function () {var component = document.createelement (Argumente [0]); var styles = argumente [1]; für (var Eigenschaft in Stilen) {if (styles [Eigenschaft]! = null) {try {component.style [Eigenschaft] = Styles [Eigenschaft]; } catch (err) {document.write (err.name+":"+Eigenschaft+"<br/>"); // Eigenschaftsfehler festlegen! }}} Rückgabekomponente; } alertobj.show = function () {if (! this.isexist) {this.isexist = true; var bodyObj = document.body; BodyObj.Style.zindex = -1; bodyobj.style.background = "#999999"; var divobj = this.createcomponent ("div", this.generalset); var txtobj = this.createComponent ("p", this.txtSet); txtobj.innerhtml = argumente [0]; var btnoBj = this.createcomponent ("button", this.btnset); btnobj.innerhtml = this.btnset.innerhtml; btnobj.onclick = function () {bodyObj.style.zindex = 0; bodyobj.style.background = ""; bodyobj.removechild (Divobj); if (alertObj.isexist) {alertObj.isexist = false; }} divobj.appendchild (txtObj); divobj.appendchild (btnobj); bodyobj.appendchild (Divobj); }} Funktionshow (s) {alertObj.show (s); } </script> </head> <body> <p onclick = "show ('innerer test');"> klicken