|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:8 w; U$ h5 U7 {; \
<script language="javascript"> ! N& h6 a/ M' f) D1 P/ m
function IsDigit(cCheck) ( v; |! R$ y7 T1 O4 q
{
! a. i5 }( X- q8 b. V; Z return (('0'<=cCheck) && (cCheck<='9')); ; q% B; B( m! n
}
. ~ U2 m8 Z- X8 r; K7 k# }
$ i6 S" u3 a1 R1 Ifunction IsAlpha(cCheck)
& ~& x' }6 k& j: i# H6 I; ~ {
- T! [5 R6 Z6 N# N! b. Q/ E return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ( l, u4 A! L- R8 B/ @4 }* N- |
} $ [2 V' t. j* I+ I/ ?. K
; W3 R1 o3 g3 T6 _8 u7 [+ [
function IsaNull(cCheck)
" ]0 m3 `9 n4 a, u4 Z {
# w; I C% C4 e" u) T return(cCheck != " ") " V* a! Y6 L: u% g3 C
}
# v) ~# o+ K( z' `- J( j5 k
1 D8 Y3 j) e2 A" a' u& w3 J5 s0 Ufunction checkform()
8 b2 W" b1 o/ l+ H3 b{
$ b3 W% [ U& V: v id = document.sform1.id.value;
8 o& c* z# C- N if (id == "") ( ]$ n' Z3 e0 {" |2 c9 z0 z- u
{ 8 ]) w9 s! o0 V0 M& u
alert("请输入注册名"); 6 ~5 G# Z# L- P
document.sform1.id.focus(); 3 b, D: e+ D+ \4 U- g* J% Q% C- T
return false; : \: O+ }, v. r: r" \; I6 n+ c
} . g* O9 Y4 b7 W- a
) ^ G/ @& P7 S& W0 g
for (nIndex=0; nIndex<id.length; nIndex++) - |9 B- B- f! W! r
{ + U, }# k. t8 Y( T/ E! C
cCheck = id.charAt(nIndex); : ^! x J0 {& {( |
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
! J% p' `* |! q; @$ M {
V" \7 j6 J1 @# A* ~ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : d. z* f+ v8 d- S% i
document.sform1.id.focus();
5 I9 I" ?6 R& e ?/ O, U return false; ! s# L: \- i" h$ _- x. ~
}
" k! L" I n; ?& r8 j1 A } 0 \& U5 m5 s9 t7 b' Z' l# ]; F
chineseid = document.sform1.chineseid.value;
- K0 `# L8 ^0 U8 d, R& j& Z if (chineseid == "") . }8 `+ d C+ v9 s8 d* u$ S- f
{ E2 z4 j/ t4 J2 A- }4 N
alert("请输入中文昵称"); ; K' n! a% K, z
document.sform1.chineseid.focus(); r- U1 V2 ~9 w7 `
return false;
, y" P; Q7 s% g }
# h" b0 s) @3 j5 K* j( V password = document.sform1.password.value; N9 b0 \7 |! z6 ~. B5 G. x! K
if (password == "")
+ |" z/ t. J- d# s. w" J { 1 e3 A3 }9 o+ \$ \% i
alert("请输入登陆密码");
$ M! M1 S: c0 e- ^* G document.sform1.password.focus();
$ F" z% \- R! Z4 ^) S. L4 T3 g/ t F return false; % r7 _8 w8 W, {
}
+ U3 m5 h8 E5 a, n; L password1 = document.sform1.password1.value;
' L% s( X! u6 J; t, I; B$ x+ [ A" N if (password>password1) * D( U% ^! I( l, _ V
{
. F( o" {8 E+ g! V5 I; D alert("重复密码与登陆密码不相同");
, X- l+ G0 u: b* O document.sform1.password.focus();
~5 k! f* L& p" P2 c- u$ R. J1 `/ B document.sform1.password1.focus(); ) A! @2 ] X" |( ~7 [8 k( A9 @# }
return false;- G( Y; j5 M: f# y& |
}
. E% j6 y. y( W4 d kif (password<password1) 0 p/ h, U! ^: X* [ H
{( ~ P- e* C0 n0 D9 D
alert("重复密码与登陆密码不相同"); 1 L! E' _ Y4 f v1 U( q9 S) M+ m
document.sform1.password.focus(); 5 Y6 n3 X- r6 i1 ]' r6 m% P7 X7 V3 t7 s
document.sform1.password1.focus(); 1 T: d: c" I0 E$ d- t7 `( Y1 m8 j
return false;, r! s! C% T* b8 |0 S. J+ f" `
} " V+ i* u1 j: P% `
if (document.sform1.email.value == "") / \# T1 j' Z: [& L
{ $ t3 a! }/ I- T. A3 X5 ^
alert("请输入您的E-MAIL地址");
0 [- _* w0 x" i document.sform1.email.focus();
5 v$ W/ W$ }0 ~* B7 n return false;
) l1 @) D T3 Z } # j6 e! @: y* i
) q! @$ C4 L) f4 d- Q: L6 G email=document.sform1.email.value;
2 ]4 e' C' r: E4 T emailerr=0 & `( `) m4 S" q: f+ Q8 v
for (i=0; i<email.length; i++)
! C# s7 w9 l, E! ^* s1 { {
7 X5 [% G! U& i4 h if ((email.charAt(i) == "@") & (email.length > 5))
, D8 H" x( N9 h$ k- K% h/ _( W; V* i { 7 b; D a6 B% G" p
emailerr=emailerr+1
- |9 m* r; ~" F2 `7 J9 e. b; K8 l) t }
6 D# ]& r ]3 x7 ?- I }
# W: @, e7 k/ J if (emailerr != 1) ( h4 {; i( M: A
{ ( @- W/ c% R; ~: s+ K8 d
alert("请输入正确的E-MAIL地址"); + W- @& W: a4 k
document.sform1.email.focus(); 8 @& u8 p+ o! R' M$ f) {( ~ o, M
return false;
5 ~/ |* X) g/ K$ a8 \6 C8 V }
; d9 q! K& q/ _# I5 p 3 u- _: B, W9 o8 b- [5 p! V7 T$ o! o
if (document.sform1.checkask.value=="") 2 ~! A1 t9 z1 S& V9 `) {7 T
{
+ C% ~" ^. t( J. N( N6 i alert("密码提示问题不能为空");
% J( h/ Z$ m0 M document.sform1.checkask.focus(); 1 n( w) ^4 `3 @! _8 P4 b6 e2 r
return false; 5 f+ f" j7 c7 `: q4 @; z
} 2 u! q1 j( x) {$ p, W& H% b- Q
if (document.sform1.checkans.value=="")
/ f& a+ S3 i: F, E {
8 a6 M3 ? F- b+ L# B8 |* |4 ] alert("您的密码提示问题答案不能为空"); 3 _ L) L' l8 b t$ M
document.sform1.checkans.focus(); 4 [ R8 P* Q5 T# S: M- T5 r G
return false; 5 ^, x& h# T% a( v# r
}
5 ?" w- i% F+ W! S/ q% m, C return true;
- |# d4 N& v5 H8 v$ e. A% U 2 |2 Q1 b' }. i. X6 L
}
S8 F2 |5 Y$ a/ s( }) P/ k( K9 B0 Q</script> |
|