Beispiele wie: unten:
Kopieren Sie den Code -Code wie folgt:
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<kopf>
<meta http-äquiv = "content-type" content = "text /html; charset = gb2312" /> />
<title> js Verifizierungscode </title>
<Style type = "text/css">
.Code
{{{{
Hintergrundbild: URL (Code.jpg);
Schriftfamilie: Arial;
Schriftstil: kursiv;
Farbe: Rot;
Grenze: 0;
Polsterung: 2px 3px;
Buchstabenabteilung: 3px;
Schriftgewicht: mutiger;
}
.Untangeded
{{{{
Grenze: 0;
}
</style>
<script Language = "javaScript" Typ = "text/javaScript">
VAR -Code; // den Verifizierungscode in der globalen Definition definieren
Funktion createCode ()
{{{{
code = "";
Var codength = 4;
var checkcode = document.getElementById ("checkCode");
Var Selectchar = Neuarray (0,1,2,3,4,5,6,7,7,8,9);
für (var i = 0; i <codength; i ++)
{{{{
var ladx = math.floor (math.random ()*10);
Code += SelectChar [Charindex];
}
// alarm (Code);
if (checkcode)
{{{{
CheckCode.className = "Code";
CheckCode.Value = code;
}
}
Funktionswert ()
{{{{
var inputcode = document.getElementById ("input1").
if (inputcode.length <= 0)
{{{{
ALERT ("Bitte geben Sie den Verifizierungscode ein!");
}
sonst wenn (inputcode! = code)
{{{{
ALERT ("Bestätigungscode -Eingabefehler!");
CreateCode ();
}
anders
{{{{
Alert ("OK");
}
}
</script>
</head>
<body nur = "createCode ()" >>
<form action = "#">
<Eingabe type = "text" id = "input1" />
<Eingabe type = "text" onclick = "createCode ()" readonly = "readonly" id = "checkCode" /> <br />
<input id = "button1" onclick = "validate ();" type = "button" value = "OK" /> /> />
</form>
</body>
</html>