|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:- t7 `) g3 S; ?, e4 K, |
<script language="javascript"> ' g6 A: d) e9 |- t- G( W. E* s
function IsDigit(cCheck) $ Q; O1 {! L2 o) i, A U
{
$ N+ W/ f, V, A6 S/ }; U' { return (('0'<=cCheck) && (cCheck<='9')); 8 m/ P8 l: h- b/ o* J
} * _( ?: ^8 ?, C& z/ @
3 \% v) j+ I9 G0 V
function IsAlpha(cCheck)
; K* h6 M9 m7 {0 F* z# E {
9 S. T R9 A) E/ C [6 C return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
* t# H! _% o9 Z0 `/ o } . [0 a" v: _( s k
x* p' J! V7 P* R6 F4 dfunction IsaNull(cCheck)
0 S5 O) s0 E1 Y { 9 E& M5 y# d4 {
return(cCheck != " ") 3 z% p+ f6 k+ R' q% T/ o6 ~
}
7 q7 h: ?$ l0 m5 x
! s& o! }5 I) ?* k# }, Cfunction checkform() ; S; h% b3 U6 _; _: n
{
) p5 r/ t& w0 J" x" S U8 B id = document.sform1.id.value; 9 y$ \6 `/ [- x8 Y
if (id == "")
* i4 _8 O4 v5 X1 f0 R {
9 G* ~5 Z1 k Y alert("请输入注册名"); , ~8 w. w" C* Y/ K, ^
document.sform1.id.focus();
4 R. H7 u- V3 P* ?6 A* x return false;
6 l: L% h* D% f5 f0 L2 j; N2 H } 0 }! A& ~5 _5 d' o$ _: H; r
( S7 \" v" e2 v, R( D for (nIndex=0; nIndex<id.length; nIndex++) 5 K0 m; \( f8 L* I
{ : [" G) ?7 A9 r: l7 u2 n
cCheck = id.charAt(nIndex);
) {4 ?+ Q2 V9 m3 ?1 f# D if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
& u" n3 O6 I X& w8 j5 g* | {
0 S- I6 d& F: {9 W alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
* F+ l) c( G1 v& O! l- E7 U document.sform1.id.focus(); P" |% ]+ s, A# _' f
return false;
8 }7 O4 A r! n6 s }
9 G3 d6 b+ v: Z5 Q. k3 c } 2 `4 a) \, m4 |; E/ |
chineseid = document.sform1.chineseid.value; 8 {" o" Z# w8 V" |' j
if (chineseid == "") 0 r+ j: f, E& @- W" c
{ 3 a$ g: U4 N0 ?" F O) O# E" k
alert("请输入中文昵称"); # V3 ~/ u" ]6 X) t; ?( L
document.sform1.chineseid.focus();
9 L# t( C8 F* E# {* {& [3 `7 I) ?* l return false;
( L3 a/ W% c y, _! M$ S6 w }
1 ?* e4 g& Y5 ? t3 a6 L8 f password = document.sform1.password.value; / k. ~( L2 J" r, l
if (password == "") & l1 y: R# Y: w: p% z, y/ E* {
{
: H. C5 ]& f' r+ p3 v- x alert("请输入登陆密码"); ) Y# f9 B0 P- P$ N
document.sform1.password.focus(); 8 ^5 i& m, n, M/ T- z
return false; 4 }7 e+ w- d9 v& G v$ P
} 8 D/ ?" a4 w7 |) t. Q" v3 p4 p( y
password1 = document.sform1.password1.value; - l1 H" f9 M# z3 R. q7 M
if (password>password1)
% ?% t& q6 ]0 F. F" p4 q. c4 o {0 W6 \# h1 @( {
alert("重复密码与登陆密码不相同"); / x$ u! L' `' v* x: _, u0 S! ?
document.sform1.password.focus(); 2 P% Y/ N! X# E, w6 m J
document.sform1.password1.focus();
& M( p8 E+ `( F1 f: G) f) I return false;
$ z5 S" P5 n/ I T, F" I, b& e( s }
& P4 f. O3 K0 w9 v! t7 fif (password<password1)
0 i& p+ d: k2 E8 {- R {; O. x3 m5 u& j/ A7 I' W
alert("重复密码与登陆密码不相同"); % J9 m9 U' U- X$ m2 v
document.sform1.password.focus();
+ _' c1 Y8 T0 o document.sform1.password1.focus();
7 i3 Z8 b4 L& z8 P2 N7 Q& s4 n return false;
( {3 w' s9 l& l; l% }7 F }
" y4 ?0 v2 L9 [; T if (document.sform1.email.value == "") * a b$ v2 ?( z% O
{ 5 Z+ P. {( S7 i8 P4 {
alert("请输入您的E-MAIL地址"); 9 ?; A' X! O6 E
document.sform1.email.focus(); + l+ w( u9 B& ^7 @9 F6 C/ X
return false; ( @- m. A! q; q
} }6 e1 k# u' p7 C
1 q- ~6 N7 Z( T0 {+ l
email=document.sform1.email.value; $ ~* Z4 Q" E6 o" T: A. c
emailerr=0 7 b9 m' f& E8 M7 _/ J* O1 c
for (i=0; i<email.length; i++) - x4 H5 G+ Z/ t; K& Q
{ % P/ D) P! q/ W9 u& x9 U: f! S
if ((email.charAt(i) == "@") & (email.length > 5))
; {$ u: T3 E% M: ^1 D+ u {
( _" `: z7 Y1 j: M: D: s3 z5 @ emailerr=emailerr+1 . l0 q6 q# k7 `6 p$ ?3 D) j
}
/ a# }1 T& q8 _0 Q. I2 ^2 l } & [9 J0 \4 U- ^3 V: V$ n
if (emailerr != 1)
+ W, j3 u5 r) r {
{& m2 M4 q( s7 `4 f1 G alert("请输入正确的E-MAIL地址"); ' k3 i! ^' S: Y. v7 {: S& O# l) f
document.sform1.email.focus(); 0 x6 O5 Y' W0 _# _
return false;
" F7 R3 x3 e7 S3 s } . m* G9 o. i0 C2 P- ~, `
4 H" E+ z9 [8 |$ M if (document.sform1.checkask.value=="")
: g E6 f/ J/ b5 V* f" u- |* n: ? {
/ y% h2 l- r; n) ] alert("密码提示问题不能为空"); 3 _: T/ G1 ^ V+ w
document.sform1.checkask.focus();
2 s& u' @" c( V: Y) Y% B# q V return false; 0 n7 r' j. r* F
}
7 T, @3 U# S: U8 _ if (document.sform1.checkans.value=="")
+ [! J& a; l, F; o { # X8 _4 m% U9 X7 _' e: }
alert("您的密码提示问题答案不能为空"); 5 @* S" q% ~( n: j' J/ a, [- z" M1 `
document.sform1.checkans.focus(); & K! W5 r2 W4 A( Q4 m3 |2 \3 i, K
return false; & ]/ H k9 r5 m& O
}
. S6 d/ t) A4 p5 u) c return true;
3 N9 X% b# Z! l5 | }: H& _ , L7 m6 C# e; a ^
} 2 A9 v# H/ y9 F$ L( y8 c& H' m
</script> |
|