Ejemplos como: a continuación:
Copiar código del código de la siguiente manera:
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-equiv = "content-type" content = "text /html; charset = gb2312" /> />
<title> JS Código de verificación </title>
<Style type = "text/css">
.código
{{
IMAGEN DE ACTUALO: URL (Code.jpg);
Font-Family: Arial;
Estilo de fuente: cursiva;
Color: rojo;
borde: 0;
relleno: 2px 3px;
Espaciado de letras: 3px;
Font-peso: más audaz;
}
.unchangeded
{{
borde: 0;
}
</style>
<script language = "javaScript" type = "text/javaScript">
código var;
Función createCode ()
{{
código = "";
Var cod longitud = 4; / la longitud del código de verificación
var checkcode = document.getElementById ("checkcode");
var selectchar = nueva matriz (0,1,2,3,4,5,6,7,8,9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's , 's,' s 't', 'u', 'v', 'ww', 'x', 'y', 'z'); También puedes usar chino en chino
para (var i = 0; i <cod longitudes; i ++)
{{
var charindex = math.floor (math.random ()*36);
código += selectchar [charindex];
}
// alerta (código);
if (checkcode)
{{
Checkcode.classname = "código";
Checkcode.value = código;
}
}
Valor de función ()
{{
var inputCode = document.getElementById ("input1").
if (inputCode.length <= 0)
{{
alerta ("¡Ingrese el código de verificación!");
}
else if (inputCode! = Code)
{{
alerta ("¡Error de entrada del código de verificación!");
createCode ();
}
demás
{{
alerta ("OK");
}
}
</script>
</ablo>
<cuerpo solo = "createCode ()" >>
<Form Action = "#">
<input type = "text" id = "input1" />
<input type = "text" onClick = "createCode ()" readonly = "readonly" id = "checkcode" /> <Br />
<input id = "button1" onClick = "validate ();" type = "Button" Value = "Ok" /> /> />
</form>
</body>
</html>