|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14399
- 金币
- 2485
- 威望
- 1647
- 贡献
- 1433
|
这个脚本对你可能有帮助:
& P, x3 Z; ?* C/ o/ m<script language="javascript"> 3 q& C. \# n4 r- ]3 A; x/ q# q
function IsDigit(cCheck)
! t8 w Q+ Z R- F1 M { # |6 D8 {6 l1 i( \
return (('0'<=cCheck) && (cCheck<='9')); 5 a4 X" a9 A+ M* x* T+ H# H
}
& q! r- g7 |% s) Y: w6 P& Q0 F " D4 Y& e& D8 V) |% {
function IsAlpha(cCheck) 6 w. `2 m! E- D6 y8 n" g6 V4 H& D
{ 8 `& g3 F3 q" F( q. R
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
1 w3 _# D w6 S! o" l: Q } 1 O6 n+ I$ E* p; i
( X8 x* x0 Y/ A$ w. Bfunction IsaNull(cCheck) % G, O, R* l1 l6 m5 I
{
5 U# \. @ n( k5 T4 |' B c return(cCheck != " ")
! M# K) u; k B5 i) Z } % z5 `: }9 g: l
) h0 h, r. D3 I( l+ J
function checkform()
/ N3 `5 m, V/ Z* C& U$ P1 j! i; U{
7 [; j3 v' c1 u id = document.sform1.id.value;
d1 N6 L7 v% f" [0 o$ u% x if (id == "") " j4 e1 ]; ^0 P2 T
{
) ? L, h: _! v; K" U* t) b alert("请输入注册名");
5 ^+ H8 V! |5 \ document.sform1.id.focus(); * T9 i( R9 u7 v9 k4 E8 t' f
return false;
7 ~5 X. P; ?; z( U9 u6 | } 6 u5 i4 P3 X0 C, ^* v4 h- X
4 |' [! K" e3 m& ^
for (nIndex=0; nIndex<id.length; nIndex++)
% c V; l% E5 X3 i { : l: i* Q3 }+ q: W6 `& K
cCheck = id.charAt(nIndex);
" M/ r* E- {5 u9 {9 P if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) + o8 ^9 G* L! U& F( I
{
! F! P; v3 D; a, I( j& {5 g; e, Y* { alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' A- n3 c% z% U$ m: d2 C2 e! E document.sform1.id.focus(); ! E5 q. F1 F. g7 H) U5 ~
return false;
' ]* Q% Z. r- d" C }
# L, Y' _9 n& a/ F2 s, R } 5 s. P0 F( v+ C
chineseid = document.sform1.chineseid.value; : `) O# b: S; i# g6 X% C
if (chineseid == "")
5 @+ l$ s! `" W {
" @) f1 D+ H& g* K alert("请输入中文昵称"); 6 K! G% E2 ?+ ]: t
document.sform1.chineseid.focus(); $ `$ W8 k5 B, S0 ]. s5 d
return false; / P: }0 X: a% q* k( x3 [
}
# P$ P& I$ n, D% h P( e: i: O3 y password = document.sform1.password.value;
% K9 X5 B5 t6 o if (password == "")
+ b: _: `; V9 V% R( A4 l {
- w. E3 p/ k2 k- f& b" ?4 m alert("请输入登陆密码");
% M P2 a' ]: T document.sform1.password.focus(); " S$ E6 G) K: J- v3 K. f( y
return false; ' W, |+ |2 m v+ Q* i
} ( J4 B) e8 Y+ c2 N
password1 = document.sform1.password1.value; ' y' G8 i! @1 `( G% h: c$ |
if (password>password1) W% m0 E: V* M0 n
{
, F6 F" }4 a7 `8 n alert("重复密码与登陆密码不相同"); * l5 t! Y+ p( e% f% l; e% G% n
document.sform1.password.focus();
% ?; O3 W* z, G; n6 }) P- @ document.sform1.password1.focus(); ) J- o" c( ^* a9 k7 s
return false;
* s8 p w; s$ P- W2 s+ p1 F } / U* c: k' s4 Z9 o6 R! [9 m
if (password<password1) 4 t) L8 Q" O7 s; j8 [. }
{* f+ m$ C( y) ^" Q* q+ p
alert("重复密码与登陆密码不相同");
- m3 N6 P& [0 ~ document.sform1.password.focus(); ; c, U8 p* Y8 O' D* \9 Z" N
document.sform1.password1.focus();
2 D0 B. P' c6 ]2 @# K2 h) R% n return false;" c- y# W* k# O' F
} - }) o7 s& |8 t, ]$ {
if (document.sform1.email.value == "") ' U, s4 c! `; f6 B) Y! b
{ 5 ~$ M* w: A4 O7 V. c4 _" ^3 j
alert("请输入您的E-MAIL地址"); # }6 t M0 h/ I0 {
document.sform1.email.focus();
- z6 T+ G/ `) ?" ?5 X/ k return false; ; b" d2 S2 \2 [3 X6 u5 R* Z B
}
' I: C+ O6 u+ _6 i: }. X' U+ D * \ P8 v9 @. O6 c) ? h8 M2 U
email=document.sform1.email.value; : x) w& E6 \' f, n6 Z
emailerr=0
/ w3 c1 v* V; T# T; i# a& B for (i=0; i<email.length; i++)
! o/ ]8 `% J9 j# W; r$ j3 i { 5 q7 G& I- o w* R! s9 t# Z
if ((email.charAt(i) == "@") & (email.length > 5))
5 C9 j1 g& W5 x8 e6 P. X { ; J( ~- E# M1 M+ u: v8 V
emailerr=emailerr+1 % J0 t" ~# D& K1 c6 ?8 f, d! K1 o
} : f& c" f( S/ F0 ?# ]4 U
} 5 C: \) F# G1 A! t" e1 X
if (emailerr != 1)
* {+ x8 y9 n# C% ]0 C {
1 l; }7 W3 A& y6 f; [% v% i alert("请输入正确的E-MAIL地址");
2 ^" l3 X6 |8 O$ e0 L) G% M( z9 @ document.sform1.email.focus();
! \" w/ M y5 s return false; " y1 p1 E& ~& Y
} . \" d' @5 m }' n+ }& E0 ~" P9 h
( n" E, [+ R+ E5 Z# q
if (document.sform1.checkask.value=="")
" q+ {7 d* p: ^+ u6 _ { + m& Y# z# C% W; R" \, `
alert("密码提示问题不能为空");
( x; {7 }& g) U1 S$ ]& N document.sform1.checkask.focus();
7 }$ A. a3 U; U return false;
! s5 f, _' Z% `5 X } , J. A6 G+ c) V0 m% w: r/ B
if (document.sform1.checkans.value=="")
5 f1 [+ l, v/ J2 Z {
: J5 S* t4 Q8 ^. E6 B! @# S alert("您的密码提示问题答案不能为空");
1 f+ U* a% ]) G3 I+ L Z+ c) g document.sform1.checkans.focus();
9 ^) u0 y* k* n# { return false;
5 |6 s; M- s% Q; |0 D }* ^3 G" ~# W! e, S$ T
return true; 6 Z* }! W1 F1 F9 a) X
, a' Q2 y- y! R4 _6 z} ! c4 `; D/ C) B& ~3 o* b
</script> |
|