|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:
8 C* \# ~2 h# C$ L8 v3 B4 ? F<script language="javascript"> M y' T% h5 h. `+ B: [' q
function IsDigit(cCheck) 1 L% B8 E6 s) s
{
& D+ M; B+ J! L) }7 W return (('0'<=cCheck) && (cCheck<='9'));
7 M( ]+ K1 }9 V, y# ^ }
9 Z' P. w" k4 @+ `
e* G8 }6 O1 n! {) S/ ^7 v Mfunction IsAlpha(cCheck)
- A7 Q, v; h' ~ {
3 P* c! u q! x return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 T' G: V+ Z9 z4 m+ |
} % R" y2 t& B9 i u5 M* T( _
. X/ U% K. q" U% P
function IsaNull(cCheck)
' t2 I) p7 [4 p& v0 X {
, j9 J, Z% K) I0 j return(cCheck != " ")
' ?- }+ M2 z0 i) U, C3 I } / _ j% ]+ X/ E# \; m C
* ]3 d5 i# o% v
function checkform()
3 y5 x! n, W0 B6 h* B8 ~{
4 `7 k4 L; t6 T. h/ f: g0 y( W id = document.sform1.id.value; " f8 t9 D2 G" ~5 }: S4 J
if (id == "") 3 v! y, v: V! M0 x; x- f7 T
{ 5 k% d" Q I. p% {" }
alert("请输入注册名");
8 b2 }1 ]9 C- u0 G0 N document.sform1.id.focus();
' F" A! D9 u# Q. Y! k' I6 O return false;
% w: J0 R4 [ D% T% x6 o }
3 T/ ? L* ~4 \# z & w7 w+ u- D5 e6 @2 J; \- @
for (nIndex=0; nIndex<id.length; nIndex++)
9 G& e% ], }, D9 j { 3 |% C t# Q$ t( d0 w( u
cCheck = id.charAt(nIndex); 2 K- a7 T4 x3 c& b
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ; h/ ]+ x5 g% @$ D
{
! L3 ~+ H" H1 _& [' O' f$ Y+ ? alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 4 f0 e. \1 p% O9 F5 D- s4 Y
document.sform1.id.focus();
( X. z+ Y& x" U+ z ?+ t# f6 W return false; ; W. B* \( p, Y5 z& ~4 _; ^
}
; g+ \; E9 f" z" m$ m }
6 h* \2 x6 }* j1 E chineseid = document.sform1.chineseid.value;
. m k5 [/ U. X% W if (chineseid == "") # ~5 k( P1 @2 p7 |" ^1 e0 `
{
5 {4 ]- I- X9 i alert("请输入中文昵称");
, b+ r2 A* h% w! U: K document.sform1.chineseid.focus(); # L- g) `( b& h/ t) k
return false;
- b- @. Z! @0 |' _) } }
9 ?# }) e) M, d' H password = document.sform1.password.value; . y- _9 r- [/ ^7 |" j' s
if (password == "") 5 h a K; s' {1 X
{ $ ?/ q# C$ [8 x% P
alert("请输入登陆密码");
. `- t5 x& c7 O1 [/ `6 {( f document.sform1.password.focus(); : I" X9 }* [, x
return false;
. T4 D) n0 x3 [$ U( P' g8 H } / p+ y$ v/ V ] i
password1 = document.sform1.password1.value; 7 i+ i0 X/ @5 T0 M* L: c
if (password>password1)
" f6 J$ z" u. _! t* b {
6 Q+ O( Y( n6 D alert("重复密码与登陆密码不相同");
) U: W% [' V& Z# A9 I document.sform1.password.focus();
& w/ Q# H8 v9 u3 K document.sform1.password1.focus();
: M: |! A& t, L: D9 T/ ] return false;
0 _7 m) @' l' Q% i3 u p } , y7 r$ i4 @2 g2 |
if (password<password1)
3 W; H0 W% D$ r2 r! [# x2 W a {
$ h) k* ?- a5 d alert("重复密码与登陆密码不相同"); / D: q I7 \* T6 y
document.sform1.password.focus(); 2 X" N" U' ]& \" x
document.sform1.password1.focus(); J; z! A5 o; T" M B
return false;; s7 N |( Z! U! T* G+ A/ k
} 3 h+ W0 h% `% L' p F) T
if (document.sform1.email.value == "") , }% ^3 |' d; M5 Z9 ^" W. Z
{
3 a- v* o7 P( X4 p4 L3 @! n7 Z alert("请输入您的E-MAIL地址");
# v/ {8 ]* S" e& M0 z- x document.sform1.email.focus(); ; X% S" F/ E/ G; z/ ?
return false;
7 k; B- Y7 [$ C+ m. q' J! @( V } 8 O' H1 @6 c4 I$ ]6 l
; Z6 f2 ~# D. ^# g t! q( B" n* L
email=document.sform1.email.value;
$ @! L2 i/ t: L& k' O emailerr=0
0 n6 L8 p1 [: B y+ s for (i=0; i<email.length; i++) 8 A p$ h, q, _' Z! g
{
Q8 c! w; b+ [% l9 e6 | if ((email.charAt(i) == "@") & (email.length > 5))
- K* F/ p% [- V: D* i! J {
, c+ [6 Q) Y- R0 E emailerr=emailerr+1 2 ]; r, ]2 |- N; s! G
}
, h- A0 P) a! a% G* ~7 A+ M* }# R* D } 9 M$ {; h8 s; H
if (emailerr != 1)
4 `" d+ n8 |; {8 B0 w+ ]8 Q' {5 G+ a {
0 G5 a( ?5 P: g) U alert("请输入正确的E-MAIL地址");
( H/ H M! Y# o' i document.sform1.email.focus();
3 s+ V; j9 x. P! c return false;
* o+ d% ^8 k; k& b. ~ }
. }$ z( `; B! v8 j* }
, n" V& O" L5 [. C* X( T if (document.sform1.checkask.value=="") : B, r2 X3 ~. [7 e% [
{ 4 m! z" F1 f( i4 l3 g, ?& A% z) P
alert("密码提示问题不能为空");
( @3 c, D4 t6 X) Y6 F; b document.sform1.checkask.focus(); ! x" J- B% s0 j. F
return false; 5 V& F1 v$ l7 ^# u4 c8 x: _- `, N
}
2 S% ?# {( |, K6 I- h2 e. x if (document.sform1.checkans.value=="") 7 p& e4 O+ c# K# |
{ " M0 w7 V, H" W+ y/ s5 T. m
alert("您的密码提示问题答案不能为空");
* U1 J/ f1 e0 {$ [3 _; I document.sform1.checkans.focus();
! r+ r1 F4 D! k return false;
. E; a- d# G. d }( o3 a( p! J2 x/ j* B! Z
return true;
: L: Y( c6 W( |; W
0 }5 U4 `8 f+ ]* f3 u}
4 T8 A X; S W8 R( Y+ t7 S0 A; M</script> |
|