|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:5 e- |! w- K0 N. g4 C
<script language="javascript"> 5 w8 B3 K: x: M0 a- j1 t4 `; s
function IsDigit(cCheck)
e0 b; W: b: A# r {
# |2 a7 K% R9 _, q9 X return (('0'<=cCheck) && (cCheck<='9')); 7 l" [3 z! O. V m
}
2 g7 O+ p2 j1 e' n, y: ] 2 p8 F/ j: m6 P9 Q! I/ U" p
function IsAlpha(cCheck)
) A6 j7 [7 c" Y% ~4 W+ E { 6 ~3 Z3 L; E/ u( n. R4 S) C
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ) r" h9 E; U- \
} 8 i$ y: \* a# A7 c9 D
8 \% |) x& n* ?8 V
function IsaNull(cCheck)
f. y m7 C- H { ( i6 d% }4 e1 L( w- c6 |
return(cCheck != " ") : }( |& c, {" s: Z5 X
} + ~2 }6 G" |# H( A/ Q5 K
9 i5 ]; `9 i( Q' Z( tfunction checkform() `: V. z% C3 E! k- u6 a
{
( S' k0 ?) o8 |! N7 k id = document.sform1.id.value;
! y* t' {6 ]* d if (id == "") 7 I& ?7 s$ e) O8 [1 h( Z/ I
{
' B/ _6 `' g1 U. a2 Z7 R alert("请输入注册名");
" E+ c w, z- X" F5 | p8 I# } document.sform1.id.focus();
9 H' m! n) f8 i+ U return false;
/ V# }1 [( d# h, B' [! Y } 9 C/ W+ b! P0 c- a5 g% h; H. a3 g
; e. J' g& I9 Y+ v for (nIndex=0; nIndex<id.length; nIndex++)
8 }: [6 c1 K; i8 y! P" }1 Q { 7 y* T1 F. w9 Y* J, @2 S
cCheck = id.charAt(nIndex);
$ a# H0 F( \5 M2 L' @ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) / i& i( N7 C0 ~
{
' c; k0 g3 ]5 S8 w" `; z. Z, }3 | alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
: X$ i' |3 C. [ document.sform1.id.focus(); . ~( D3 ~! N; F+ K ^. S
return false;
, m9 Y7 C8 i3 h, c6 F }
9 B, i9 x9 a# q, Z/ W- U$ M }
* D7 f+ W0 }$ |) M2 } chineseid = document.sform1.chineseid.value;
; d4 p* @9 y; R4 K* r if (chineseid == "") . p& R) z( ?( Q! N7 }
{
! U8 H. { V: g; S; M1 {1 F& H alert("请输入中文昵称"); , a" B$ P+ D m, D' W' Q) c
document.sform1.chineseid.focus();
: ]+ U5 U, A/ U. N g1 D return false;
* s& x) X- Z( C' E% r } - e& i* H2 d! d; Z
password = document.sform1.password.value; , j0 _% j6 `: C1 H- X- t: i0 x
if (password == "")
, L2 {9 k7 G, U4 z, L0 B { $ n8 A, x$ D, ~2 k* l1 h( A0 M
alert("请输入登陆密码"); 2 A( t5 [# j* V! ^5 {
document.sform1.password.focus(); & ~, q$ b8 C- F! ~7 V3 j" F
return false;
& z" u3 i4 K$ M4 E' } } $ k" s9 H3 s8 C) L6 ~
password1 = document.sform1.password1.value;
+ y; t0 f0 Q. W* ?3 }; D if (password>password1) 3 H& J$ C/ f. J2 d% H
{8 f, ?* K1 o) q2 x4 p5 Q
alert("重复密码与登陆密码不相同"); # Z9 ~" m& V* v* f- R
document.sform1.password.focus(); 5 g& y: ~; C; u' o
document.sform1.password1.focus(); & O% p* m5 d, Q7 w+ S
return false;
! U3 _" H5 o. r/ ^! h }
7 a6 _/ ^7 z, f& Dif (password<password1) 7 B8 K% U# {# Q8 S5 M, I1 ?% T
{! E( B+ ]9 y' F) z7 B- P) A( Q4 G
alert("重复密码与登陆密码不相同");
* p6 {5 k) K& N. ]& Y2 S7 r document.sform1.password.focus(); $ z9 x/ r2 r M2 h1 ~0 M0 K2 V( }
document.sform1.password1.focus();
9 I5 C$ t: B( }" S2 ^" V return false;
' q8 Z$ n) c D; l } - d( ?+ C! [# ]9 W
if (document.sform1.email.value == "") * z s A+ ~0 A2 k
{
/ b9 _. N3 L. ~3 ^- H alert("请输入您的E-MAIL地址");
7 [9 D' } B0 e8 r, c" R5 A1 C' v document.sform1.email.focus();
3 B; x' ?! O$ h" l: t2 A' R return false;
* a' K: U1 p1 P1 R5 T4 N8 \5 x6 X1 o } ; _/ b% M) j+ R9 l) u
: y, {# W% K h* j. o8 h email=document.sform1.email.value; 8 j: l" J' d6 D# \ }& `8 e
emailerr=0 8 ]) l3 l3 Q: K( n b/ n4 e
for (i=0; i<email.length; i++) ! E6 N- N+ |6 I% Q0 L1 p
{
2 a3 r T' }/ ?- l# b if ((email.charAt(i) == "@") & (email.length > 5))
; \ J; ]( Q3 j& C( a! E { 6 W. C1 {3 B& V2 O, `
emailerr=emailerr+1
5 M$ J2 C+ s: Z" F } , ?$ [4 C0 a( D8 ?" E* V$ }
} 1 R# T' N+ V7 M- w
if (emailerr != 1)
* M$ V: ]$ J+ A* J! o1 P { 9 H. e2 h( b# @6 }) y4 p1 X& @
alert("请输入正确的E-MAIL地址"); ; b1 x4 j5 W- r1 o' ?
document.sform1.email.focus();
% ^1 L7 T- U! p4 h/ ]! H6 a$ t return false; 6 q( X, d2 L8 {# j
} & b! c, C# \ U: z* X
/ e) }* `0 [+ Y2 V! i1 Z if (document.sform1.checkask.value=="") 6 n% b: G, |* ]0 s `; j$ k
{ 7 w( D" ]$ [! s9 H
alert("密码提示问题不能为空"); - T: F" u. n' k, ?# F$ @
document.sform1.checkask.focus(); 0 g0 U3 @; E1 e" }$ ]
return false;
, ^$ {3 ^- l* g. F% B } 1 g' {8 w* v' ^; Y5 O8 }
if (document.sform1.checkans.value=="") * a( S5 n6 M, l% {
{ $ |+ k: z( t: z
alert("您的密码提示问题答案不能为空");
1 u/ M$ E$ i+ ~" g document.sform1.checkans.focus();
- M* F7 R5 O3 ^1 o- O return false;
, i2 j9 C5 U) Z1 k" H3 s+ h/ ` }2 q. C0 }/ ?& ~# E& A0 e
return true; " Q. F5 g" o5 L& x# Y
8 e9 s3 n" q7 G# s g2 E9 N
} 6 o: A1 f n& r: ?& r. O% R
</script> |
|