In diesem Artikel wird die Methode von JS beschrieben, um nach dem Nachahmung des Zhongguancun-Forums-Scores eine Popup-Eingabeaufforderung zu erzielen. Teilen Sie es für Ihre Referenz. Die spezifische Implementierungsmethode lautet wie folgt:
Kopieren Sie den Code wie folgt: <! DocType html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<kopf>
<titels> js Imitation Zhongguancun Forum Popup-Eingabeaufforderung nach Bewertung </title>
</head>
<body>
<script Language = "JavaScript">
var x = window.x || {};
X.Creat = Funktion (t, b, c, d) {
this.t = t;
this.b = b;
this.c = c;
this.d = d;
this.op = 1;
this.div = document.createelement ("div");
this.div.style.height = "40px";
this.div.style.width = "100px";
this.div.style.background = "rot";
this.div.style.position = "Absolute";
this.div.style.left = "50%";
this.div.style.marginleft = "-50px"
this.div.style.margintop = "-20px"
this.div.inNertext = "Danke für die Teilnahme! Experience +5"
this.div.style.fontsize = "12"
this.div.style.lineHeight = this.div.style.height
this.div.style.textalign = "center";
this.div.style.fontgewicht = "BOLD";
//this.div.style.border="solid Red 1px ";
this.div.style.color = "#fff"
this.div.style.top = (this.b+"%");
document.body.appendchild (this.div);
this.run ();
}
X.Creat.Prototype = {
run: function () {
var me = this;
this.div.style.top = -this.c*(this.t/this.d)*(this.t/this.d)+this.b+"%";
this.t ++;
this.q = setTimeout (function () {me.run ()}, 25)
if (this.t == this.d) {
Clearimeout (me.q);
setTimeout (function () {me.alpha ();}, 1000);
}
},
Alpha: function () {
var me = this;
if ("/v" == "v") {
this.div.style.Filter = "progid: dximagetransform.microsoft.alpha (opacity ="+this.op*100+")";
this.div.style.filter = "alpha (opacity ="+this.op*100+")";
;}
sonst {this.div.style.opacity = this.op}
this.op- = 0,02;
this.w = setTimeout (function () {me.alpha ()}, 25)
if (this.op <= 0) {
Clearimeout (this.w);
document.body.removechild (me.div);
}
}
}
neuer X.Creat (1,50,25,30);
</script>
</body>
</html>
Ich hoffe, dieser Artikel wird für JavaScript -Programme aller hilfreich sein.