纯粹是为了打发时间 , 手写了一个 js 的 的 控件。 控件。
代码如下 :
<html> <Head> <script type = "text/javascript"> var alertobj = new object (); var generalStyle = {ZINDEX: 0, ширина: «200px», высота: «100px», граница: «Толстый твердый #CCCCC», «Фон:" #ffffff ",« Абсолют », Top:« 35%»,« слева »:« 40%»} var txtStyle = {TextAlign:« Center »} var btnsty = {absopyle = {absoplege = {absopyle =", ",", ",", ",", "," Abslious = ",", ",", "," AbslieStyle = "," Abslious = "," AbslioStyle = {TextAlign: "} var btnsty? «40%», Top: «70%», Color: «#3333333», Fontweight: «Bold», OutlineColor: «#3366ff», Outlinestyle: «Ridge», Outlinewidth: «Thin», // Outline: «Thin Ridge#3366ff», Innerhtml: «Ok»} alertobj = ststyeret: {weneralset: {generalSet: a aLertobj = ststyeret: txtset: txtstyle, btnset: btnstyle, isexist: false} alertobj.createcomponent = function () {var component = document.createElement (аргументы [0]); var styles = аргументы [1]; for (var in in styles) {if (styles [свойство]! = null) {try {component.style [свойство] = styles [свойство]; } catch (err) {document.write (err.name+":"+свойство+"<br/>"); // Установить ошибку свойства! }}} return Component; } 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 = аргументы [0]; var btnobj = this.createComponent («кнопка», 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); }} функция Show (s) {alertobj.show (s); } </script> </head> <body> <p onclick = "show ('Inner Test');"> Нажмите Show Alert </p> </body> </html>