|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14339
- 金币
- 2455
- 威望
- 1647
- 贡献
- 1403
|
这个脚本对你可能有帮助:4 _- C7 G+ p/ p; Q+ X
<script language="javascript">
. t$ R* B7 {; v7 w8 ?function IsDigit(cCheck) ! X; h; P3 C& ?
{
2 c/ ~' w$ d3 s) @ return (('0'<=cCheck) && (cCheck<='9')); , J0 A! S$ C% h/ f R7 d2 v- x
}
. ^" x7 [) f3 f$ ^. V; ~
7 q5 |& i: x1 Ifunction IsAlpha(cCheck) # E r' Z; D1 P
{
+ E" U. t' i8 E8 o# V4 k! U return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) / U Z6 }* I- m$ Y
} 1 D1 ?, [1 W2 `* p/ @
( r+ Z; H/ e! W" G, Xfunction IsaNull(cCheck)
' k+ I: X9 _6 y! z { ! a8 D4 C) G4 b- d% F
return(cCheck != " ")
% X K7 O: ~( \1 d! C5 m7 { } - e0 d+ M9 E3 g* e
) z% P8 Z, z. E. `' _* r
function checkform() 0 `( ?0 U! w0 X# |! r- M
{ ( Y5 O0 l9 `9 r% P9 O
id = document.sform1.id.value;
% T; y) l: r6 {' l% Q" v& G; d. R if (id == "")
/ ~( |$ P8 ~+ i7 x/ S1 I! i( v0 @5 O { % n- z5 x3 L3 p4 K
alert("请输入注册名");
2 e J4 c' t3 P document.sform1.id.focus();
. P, L7 [: G& }4 c& J5 L) E: Y& c return false;
4 }6 x" D3 z2 t. s( F! y3 J } 0 d% k7 k( W: E+ H3 M; Q
2 f( h/ d' Q' ^4 [
for (nIndex=0; nIndex<id.length; nIndex++) 5 z; a& x e6 m$ R. ^
{
/ n0 O" W' R! V; @4 R. u3 Z$ S cCheck = id.charAt(nIndex); ' ^3 l+ L6 g0 c) f; r' V; K; J5 K D
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 4 \$ ?+ `$ H( u1 l
{ 1 {; |$ D+ m' @8 ^7 g
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' n' ]# o5 W8 _$ q1 U6 ]
document.sform1.id.focus(); : D+ E7 ~- W/ K
return false; 0 Y3 A" B7 x0 x+ V% z
}
! E) `! U" X# ?4 a, p' m } ) q: U1 {# N4 y" y) g& ~) _6 X
chineseid = document.sform1.chineseid.value; ! S7 A% @- ` x2 W* A! N
if (chineseid == "") , d4 d% J$ F" p, r" \6 h5 j* t$ G
{ 8 ?. a/ B* b' g5 |' v; t: m9 O
alert("请输入中文昵称"); " s" b' O% P0 S/ e' ~
document.sform1.chineseid.focus(); " \* N$ L* \' A/ H4 C" r
return false;
/ X; c+ }/ ^. F- | g+ G }
X4 b; y6 E' T! W( m7 X4 a) W password = document.sform1.password.value; / w* j( ]; @$ g/ |" \3 R
if (password == "") : Y- b" s& p* ^9 ]/ [
{
) K$ i; t" b( Z alert("请输入登陆密码");
, h N* m8 h: y' h/ B# m) H/ W' B1 y document.sform1.password.focus(); m9 h$ T) m/ ~: R( ?3 y
return false;
6 Z/ R* {% m# r% `' K4 U }
* h- f! V$ D7 s f! }2 ^; u password1 = document.sform1.password1.value;
4 ~# S3 n0 z2 G6 t/ C if (password>password1) # _$ A+ a, W3 w; c
{3 Y/ r0 ~6 }; B+ Y
alert("重复密码与登陆密码不相同"); 8 l: _% D" l; @% f
document.sform1.password.focus(); 5 B$ Y' Y! p1 n3 r9 z& n' L% j7 b' C& E$ X
document.sform1.password1.focus(); % Q( n7 y; W e& k/ P9 S% v3 K2 [
return false;
5 W) j7 ~, W4 | } f) h" i& q) Z
if (password<password1)
6 d2 s9 }2 W. @& @ {
1 p4 T5 s: R5 J% u) z alert("重复密码与登陆密码不相同");
: y e' D4 m; v6 e2 P: t6 o7 M$ h- m document.sform1.password.focus(); , I" ^; y/ |5 ^/ T$ X
document.sform1.password1.focus(); 0 i4 F F }& M
return false;. H- m( x& Y! Q' D
} . s9 o1 N B! E y0 b4 N; ^
if (document.sform1.email.value == "")
) Q" b: E& B' t2 _* e; S8 e: v; ` {
/ S/ {: i- Y$ P, s& U alert("请输入您的E-MAIL地址"); ' j# x7 A3 a5 V5 u: p
document.sform1.email.focus();
/ _# k* x, I! e( F9 D return false; 7 ^% @- z0 O3 N9 Y5 A
}
4 @! W+ f, e' \0 z
3 x7 v, x% Z0 ^% {$ j( \) g8 d- E email=document.sform1.email.value;
" n9 @" K* @- H/ d! | emailerr=0
' x/ X9 v; P7 q5 n+ y) S) E" {. k for (i=0; i<email.length; i++)
8 \, s. U; k/ m3 `$ L { * j }+ O) e: l8 |9 W/ P6 W# m
if ((email.charAt(i) == "@") & (email.length > 5)) % S2 H9 Q- v' _4 ?6 ^' G
{
& c2 J4 a. z0 c: b, ~* h" s emailerr=emailerr+1
i q/ F* A) b, ~0 K$ @ } ) e8 y2 n, R. F* ?& X) q0 G
} * j' s! l5 r" A2 _" _$ t
if (emailerr != 1)
! M5 y4 t8 t; Z {
1 o" X5 d2 y/ X: O/ q; a alert("请输入正确的E-MAIL地址");
( K- y" t+ k/ a Y* c, e9 U document.sform1.email.focus();
* A; m6 M1 {) ^9 F- u2 A* C return false; 8 f7 m. C" p+ i1 N/ w
} 2 B' V9 }# K4 P% `5 [( M
; ~$ g( ^: ]: ]+ Q
if (document.sform1.checkask.value=="")
" U9 l% W) t0 b: Y! k Y- Q {
1 b8 w' v0 N- S# G alert("密码提示问题不能为空"); ( c5 I& I( ~0 M. t
document.sform1.checkask.focus();
( W j( r4 A9 P* J' k" N return false;
1 |" X" x# \; W } ' Z L8 g* a% E* w1 a
if (document.sform1.checkans.value=="")
+ [& C" h# ~- i. C* c$ t {
, n. M# z( W" P1 l alert("您的密码提示问题答案不能为空");
- ~ W/ c; Y# A8 P2 Q$ `7 n+ w document.sform1.checkans.focus();
^' E: O& [1 ?. }5 u return false;
1 K# S3 _, E! f5 m f5 l }
5 v9 N R V+ n0 F return true;
9 e o& ?& r# ^. z) j. Q' c
! Z6 l: Z# u5 l5 @# `' ]! O}
" O3 s+ U" ~* K$ X</script> |
|