|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14371
- 金币
- 2471
- 威望
- 1647
- 贡献
- 1419
|
这个脚本对你可能有帮助:
# g2 n2 R0 Y! g! |) q$ J; }* X<script language="javascript">
0 U# l- [: [2 R+ hfunction IsDigit(cCheck)
4 P8 }6 o* E+ m% j {
% C9 V$ v" [3 Z0 t; D5 A Z7 l return (('0'<=cCheck) && (cCheck<='9')); 0 s0 ?0 \- Z3 V8 O% N% _0 _) q9 o
} ( z. y5 G0 _% ?' @
6 j% [7 P, \6 W7 Ffunction IsAlpha(cCheck)
3 W* p/ @8 v; z9 O4 [6 [ { - g2 t2 F; O6 Q3 K2 W+ p* Y
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
; O; b5 @9 A; y7 s) U5 z! T } & K- E8 O) e7 O
( r: S7 I+ x( C' v9 |
function IsaNull(cCheck)
1 A6 Q6 C+ Y0 r9 M {
& [6 Y- y6 C. S! G$ Q* t return(cCheck != " ") , A( [ J# k. e& E
} 3 X/ i& _4 z2 k/ ?; i
: F) v: q1 T( X/ _9 Vfunction checkform() $ N) }* j! w/ t/ W/ G2 f2 S
{ ! i1 Z) t$ C; C% S+ F4 r* O
id = document.sform1.id.value;
0 S8 g% D+ H$ L" i) h6 r if (id == "")
( \+ {# p T' @2 @$ [ {
0 o& [( ]+ r* A alert("请输入注册名");
# N, U5 k0 S# h0 h" r: E9 v document.sform1.id.focus();
* K, U" t2 g2 ]. C return false; 5 G. k, L6 V" ~8 h9 s* g' A' I
}
8 j3 x( j& ~0 N1 ^ ' }# {1 p1 j( {/ O j! X
for (nIndex=0; nIndex<id.length; nIndex++)
( W8 p" V: E- U* x7 e { 5 C3 }5 k" L* b$ r
cCheck = id.charAt(nIndex);
* U3 @( U# H1 {! Q9 E5 R if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
G- I, ?/ O9 O4 C/ L {
! T( ?, p$ B( h$ ~* a* H alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
$ o# e* }$ j" I1 n document.sform1.id.focus();
# v1 R& {) \" ]+ m- E3 ~ return false;
5 Q- {$ x5 X2 q! V r+ G8 u }
" p1 l1 D! P7 H- D; C& _$ W }
1 f( g7 P8 ^4 ^5 ? chineseid = document.sform1.chineseid.value; 0 d* u5 y- n5 s1 ~. K
if (chineseid == "") ( n/ t1 T* S) L6 I& V2 c% Z# F4 c
{ ! g; U& ]; F- o! [0 X, c
alert("请输入中文昵称");
0 r/ B$ F4 c4 `6 e$ {+ N document.sform1.chineseid.focus();
4 T7 i& j1 [1 h9 l3 Z6 a+ H7 t& N* U return false;
( Y5 f4 o4 n8 d! q } 4 k3 M9 G& ~& W
password = document.sform1.password.value;
# f) S. I6 o7 W% O if (password == "") & v2 ~1 Q9 |: L* {
{
1 |' x/ `: C: r1 @9 F alert("请输入登陆密码");
6 g* _; s$ n8 ` N1 s& @ document.sform1.password.focus();
0 {* ^0 r9 ], x' v* | I' i/ R return false; ( {* o5 h! ]0 w8 J
} ! t" E U6 R$ K8 u
password1 = document.sform1.password1.value; / C4 Y s" X4 l4 C1 ~" A: O/ u" t
if (password>password1)
# D# c. g; |- U* h {& h( D4 } H* s v
alert("重复密码与登陆密码不相同"); 7 t9 w2 ]$ F6 R* d" Q8 `
document.sform1.password.focus(); ! c/ a2 D9 L) n. l! [8 G( V
document.sform1.password1.focus();
2 x- x/ n5 g1 R$ i return false;
?; T/ n0 V4 ?6 |8 e; L( d } + ]3 h+ f3 C% p$ {# q/ r
if (password<password1)
% @: o; ^% q3 N5 }, g& b# D+ I {
8 U: `! b/ H7 ^ alert("重复密码与登陆密码不相同");
3 V# J& n/ b$ C. X5 Q! @; s document.sform1.password.focus();
+ l1 N- b1 H, T* @' C: d document.sform1.password1.focus(); 1 X* @9 r/ N. O/ D
return false;
) d# g Q* k7 J/ K5 D8 @1 T$ Q }
. V; U! s2 h$ w' n4 }( ~3 [3 j if (document.sform1.email.value == "") + u$ n5 x2 V3 p1 h4 u
{ % D5 _; T% X7 ~1 t1 w) H
alert("请输入您的E-MAIL地址"); ' c3 o: h" Q# }# v0 P/ g9 q6 l
document.sform1.email.focus(); " | `' C9 R8 i$ c: w' B- `
return false;
: `9 l( Q8 t3 A# |$ D9 L" R8 Y } 9 s2 v1 p1 L9 m; ~: G: z' [4 f& ~
: c- s) W; ^9 w, ^% y3 d f$ U: N; ~
email=document.sform1.email.value; ; ?5 J( D: G( w m: G/ W' m8 Z
emailerr=0
" z1 L. Z5 |, T5 C2 c3 ]" C for (i=0; i<email.length; i++)
/ F; I2 u+ {+ _8 x9 m. Z {
# A- [1 b& N( N! W if ((email.charAt(i) == "@") & (email.length > 5))
- U! X/ \. c# V9 r/ F {
% A: E2 r) o \9 N emailerr=emailerr+1 5 R# V# N: @; j. Z% q* K8 }
}
. o* ^8 G, |) p$ k0 {( i; Z; C }
0 ?( g" T' m7 V! |& { if (emailerr != 1) # c R- j4 A6 {, J5 K& b6 x
{ % U1 {3 f7 d9 {, K- g; O
alert("请输入正确的E-MAIL地址"); . q" K" ^( B) f( c1 g' F7 v8 s3 B
document.sform1.email.focus();
- M( L+ ^ {1 L' ~; b return false;
" {$ c8 V; d+ D; x/ Y; f/ N }
: U1 ?: @8 k2 a3 e( v$ ^# U! h9 C
H( C. n7 V0 h: D( u if (document.sform1.checkask.value=="") / L6 t0 b8 c5 B) _* ]* Q( L
{
2 @. V9 r" ?- N' h4 o# T) O alert("密码提示问题不能为空"); , `( I3 v7 |" o
document.sform1.checkask.focus();
, \4 V# P. l4 u return false;
) Z5 A2 P7 n5 O/ K } 3 N0 H+ y: ^$ Z& @5 n) D P
if (document.sform1.checkans.value=="") % a* E# H% ~9 Z# r& x9 ~: S
{ 3 {# `2 F& V- h1 p
alert("您的密码提示问题答案不能为空");
% M, D9 M2 v* F' z* q* n+ O. W document.sform1.checkans.focus();
2 K Q a: N/ x. U# x3 r1 I return false;
! E) ~& k3 R7 Y$ c' u( H# z( a }
5 S9 h# V1 e0 f3 f2 r return true;
1 n9 y- l( Z& p$ K% A' [
# x0 W4 P- `' K6 l3 b; Z* n! o8 M} / @ G" e0 X9 _& P- v* W
</script> |
|