|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14349
- 金币
- 2460
- 威望
- 1647
- 贡献
- 1408
|
这个脚本对你可能有帮助:
& I) j! K/ X5 j0 c<script language="javascript"> 7 \4 G% s- w/ i. { d1 d" `$ o8 S
function IsDigit(cCheck)
6 _2 A; s. b- b" l( ]3 K { 0 u+ D- c, o( F* @, v( g. t! _1 _: C L
return (('0'<=cCheck) && (cCheck<='9')); ; i+ c0 t+ @( W$ i
}
0 I i( u" ]7 T! M' M( h+ o
/ h; M2 _3 ?* Q v) _& m; _function IsAlpha(cCheck)
& m/ ~7 O4 T, Y6 T" A" k K {
; ~% r e1 T! O& ` return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
/ k3 k+ i3 R& G( h/ b5 s } % l# r) P! ]; {2 b% L
# {+ X4 W) @6 M) c9 m- ]
function IsaNull(cCheck)
: M$ B& X/ k4 o+ j6 g( ?3 O { 5 k/ P1 r* L4 F
return(cCheck != " ") $ b% j9 S" m0 t# }6 a, C& C
}
/ L o+ {0 Z: T' I - {1 R, _2 a/ B) j. U) N
function checkform()
0 P! e- c: G; [, H{
* }/ ^* A6 U6 M' ~- y id = document.sform1.id.value;
' `3 V+ E$ x" ~6 I2 y& Z X) G if (id == "")
7 ?! T3 `& A7 h; @) e" V { : I% J+ D5 @4 j9 h, @1 P, J, K9 z
alert("请输入注册名"); 4 K+ b( R4 Q& V) g9 E1 l% a
document.sform1.id.focus(); , h( L8 A; x! j
return false;
D. s# d( |2 p; w g }
9 c" I; G7 |& U
1 w o0 _. [, t5 v4 g' u for (nIndex=0; nIndex<id.length; nIndex++)
% b7 B a6 H( x {
9 k) H6 Q% f. U- [- A5 f6 C cCheck = id.charAt(nIndex);
0 ]' B) H0 o/ z+ |% Q- k if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
" a& C( x6 u" ?4 H {
! C. l0 j" `8 e) t6 Z7 a alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
$ k( [$ E- Z2 T$ ]7 i document.sform1.id.focus();
' U2 m: B$ }3 m return false; $ L. \" |6 u! i
} % e, x0 W l0 X" ^
} , Z. w O. `" v$ P+ e
chineseid = document.sform1.chineseid.value;
! `3 m2 _4 l$ a' e if (chineseid == "")
+ t& ]! Q* m) w3 W5 f {
1 Y% K w7 L( G9 o alert("请输入中文昵称"); + T0 A+ y- C5 o. H% \: _; L& `
document.sform1.chineseid.focus();
4 o9 s1 D8 u1 W return false; ' m+ f! @) a1 [' Z5 o
}
8 I9 v/ f: Z7 V+ I& ]$ X password = document.sform1.password.value;
% Q: i9 z( i; I2 @& G8 a' V9 e if (password == "")
3 K D7 {8 u. S5 n {
( V, M5 \7 \5 D& t alert("请输入登陆密码"); / B, J9 e. `% X& |
document.sform1.password.focus(); 0 |$ M5 B5 W" \! z2 v I9 y8 Q
return false;
: J6 v% @% q, H0 ^ } K' U1 `2 p1 [9 X; b3 V5 j# o
password1 = document.sform1.password1.value; ! c5 u+ b% f4 S9 ~8 \
if (password>password1) " W# O, W! x# c! J- V' |
{
! ]; f$ Z. G1 C! q alert("重复密码与登陆密码不相同");
3 Q4 d: E f t2 o# L6 q: t document.sform1.password.focus(); # L2 {& T5 v/ s: x! |
document.sform1.password1.focus();
# m( T# w! j7 p- f' z return false;6 s7 z# V, e8 |. l) q
} $ {; v: E! f, @" d
if (password<password1)
; W- ?# K7 O6 W {& s0 U; g( N6 l4 j- A
alert("重复密码与登陆密码不相同"); ! {! F, D1 M$ M4 q/ F: r
document.sform1.password.focus(); ! h5 G) e h) M3 W- M
document.sform1.password1.focus();
, V) C& X/ i* I) W return false;
/ N% ^- G3 @$ V" O) p/ }* h }
' [) l4 J1 l: o. d! w5 Z0 V if (document.sform1.email.value == "")
A, S9 O( c7 _- r9 A' s* O { ( C: M5 M% b5 o/ }9 W9 ~. V
alert("请输入您的E-MAIL地址");
7 l- Q/ w0 O, Y4 z! Y document.sform1.email.focus();
4 K3 w4 `0 ^, N# _. S return false; $ ]# _$ Y+ Y, Q8 u
} 2 Y, J$ ?- |7 g% R) j* U+ e2 k
0 D! X" P, t5 {- S% P/ ^ email=document.sform1.email.value; # u) X1 ~5 F& z7 T" b4 l) f3 ~& @
emailerr=0
+ w0 c5 e( E( _, X% r$ o for (i=0; i<email.length; i++) - ^+ q+ v+ W- O; y
{
1 p5 P+ v. s9 N9 g1 q if ((email.charAt(i) == "@") & (email.length > 5))
0 S: v- J9 K) R! e9 V { $ e9 s3 P" j% ^% i. Q& t
emailerr=emailerr+1 2 z9 P* J3 a& O# u+ |% ~6 c: A
}
" N' J. A, [+ l$ ^- y0 P } ' t3 ~# a+ V6 z# T
if (emailerr != 1)
4 n; i/ \6 s' @+ y3 ^9 T0 D { ( k2 f% _' `$ V
alert("请输入正确的E-MAIL地址"); ) I) g& i$ L: e# _2 R4 i6 W
document.sform1.email.focus();
" q6 I6 y* M. ?' F+ P! w* h return false; T' K1 z4 P2 z" R6 u+ w
} / R) m7 b0 X/ t' [( X
" d* i' R9 x- S2 o if (document.sform1.checkask.value=="")
" ]# T5 c9 m) P Q n5 s+ Q { / l5 i6 R# c1 P. v$ n! B
alert("密码提示问题不能为空"); 1 I. c, e9 V3 g- ^* T2 l
document.sform1.checkask.focus(); 7 e: |: g% W. q9 B O8 `3 [
return false; " T1 U* u2 n+ w. G5 j- w/ g
}
- X7 t. G& p- ` if (document.sform1.checkans.value=="")
/ _9 W7 _3 t8 Y& M4 m/ B0 v {
0 h4 |4 B4 f6 v+ u4 I1 c7 _ alert("您的密码提示问题答案不能为空"); ! U+ y1 a% B! j; h9 B# H& }# o
document.sform1.checkans.focus();
8 J* E4 `; t0 N2 z return false;
v4 E7 Y, g# W$ q* s- k }
1 ?7 M+ M8 D( p return true; ; h4 u P& v9 x; f( ^( k
& a$ F1 ] n# Z5 E}
7 u6 a) `! X4 B1 J, h _. I" e</script> |
|