|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
这个脚本对你可能有帮助:& }% g7 k" u; t: W5 R8 b
<script language="javascript"> + r: Q1 y6 ?) |, H
function IsDigit(cCheck)
" z$ s( J. F/ I) A1 z {
: R2 S B7 P8 A. P T6 |) b2 I return (('0'<=cCheck) && (cCheck<='9')); & O% Q( o; a; N# n4 Q+ a& y
} ' w, }( t- J$ y
, T" E7 h y% k" k h
function IsAlpha(cCheck)
" Q' ?4 N, t* c( a" B; t {
2 @2 j+ t- w3 `. v, p3 I return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
+ [# [( M0 L! `6 _0 W2 ^ } ( m" G2 u1 V/ P. e( ~( }+ ] A
6 m, L9 @5 W9 @" e
function IsaNull(cCheck)
, J+ d2 I6 g- @ \) y { $ H! }; H! a+ }9 ^4 H
return(cCheck != " ")
( @0 }3 d4 d- { } , Z# r! {! S3 Q" k( Z
* R3 |2 ?( P) y) C3 w/ D2 a: K
function checkform() 9 l% h8 J/ y$ C8 R
{
4 J# M+ C/ p" U8 U id = document.sform1.id.value;
8 n: o+ s; } r8 d& a if (id == "")
/ y [" p6 K/ B# b {
5 w' Z1 S' O/ Q' M, f P alert("请输入注册名");
3 u4 P0 ^! k6 N9 W+ ~7 L) a# A document.sform1.id.focus();
+ m2 ~) H5 ~0 l* @ return false; ' ]; J9 Z* r! L
}
& w( u) Y2 B( R# r6 U$ y1 R* Q
6 f1 V# S7 h, ~( D* c for (nIndex=0; nIndex<id.length; nIndex++)
. v+ c9 Q3 k0 v0 I) [2 l: m {
1 r8 p* W8 Z% u! Y7 L5 {2 | cCheck = id.charAt(nIndex); 7 C; ?: @* t7 l- K0 {& @# X
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
. C2 Q( F% d( h* v q1 D& y0 F. m {
3 t P; d7 @: I( H* n2 B alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 4 Z& {# V# A9 o+ {9 |
document.sform1.id.focus(); ' ~/ l8 C/ }6 S4 ]/ @* {1 d
return false; M" c- Y9 r E5 k% E6 T/ [
} : K% d) p+ k$ p8 y! }0 b# i8 F) D2 N
} ( g; X- A2 ~- G3 a& E
chineseid = document.sform1.chineseid.value; 1 X( w5 e% Q- W; V
if (chineseid == "")
# m3 ^2 O; k% i5 T5 d { % H) ?" o9 H x0 S& W
alert("请输入中文昵称"); ( [2 C6 ]$ ^6 y9 y: l
document.sform1.chineseid.focus();
" }" W5 F. I m$ u z* e return false; 2 J+ I e e4 ?. Z5 ?+ |
}
) F1 y- a Z0 J# v8 g% ]3 a password = document.sform1.password.value;
& [1 `; c$ }. T" J6 F; O% c. H if (password == "")
j) s, [ Q. e { O% G1 j. c& s. r5 ]7 J7 U9 F) d
alert("请输入登陆密码"); 9 J# t" M- [6 L, ^* } l; w
document.sform1.password.focus(); - X7 J2 {; S) t+ ]6 w. f5 j- S8 Q' J
return false; / w; A6 d& j1 \
} `8 I3 i" P/ U6 q5 H
password1 = document.sform1.password1.value; * x! g/ q7 i+ V$ n
if (password>password1) 1 ]2 c/ X; [! u. \7 c T* d7 O
{
$ c3 m+ z6 M1 t- j2 a$ |+ m alert("重复密码与登陆密码不相同");
" Z; p$ d0 V) ^ document.sform1.password.focus();
3 L C- J9 ?( r; ]: S) H3 Z3 n6 y document.sform1.password1.focus(); 0 `0 U+ }" i7 \5 a
return false;
6 q4 U2 M: f& z' W } ( c C' N+ d( P2 G
if (password<password1)
) ^ ` U5 @7 \/ u# U3 P {3 g; G5 h9 h% m
alert("重复密码与登陆密码不相同");
9 i# |' X' i4 m2 [1 b document.sform1.password.focus();
0 D: \( U! ^& n( m document.sform1.password1.focus(); + U9 G" k- r$ V9 O
return false;
1 K4 t1 B5 G' w& O, U( h } 4 k5 _6 t" ~* l: c) \4 n6 L
if (document.sform1.email.value == "") 8 \8 D* @5 r+ h
{ 0 l0 W0 w4 I; _" n' Y4 {0 b
alert("请输入您的E-MAIL地址"); 6 J+ ~6 z4 o/ ^. c
document.sform1.email.focus();
) ~- ~9 `% W! L6 X0 a! V return false; / Y2 E+ Y m# ^. E' ^* Y
}
2 }4 Z" R8 d: P7 v& A/ F0 `
q2 U q! N5 a! m3 S } t email=document.sform1.email.value;
% L% c2 X- r+ E7 V7 Q' W emailerr=0
4 L- y0 h/ s" N* Y for (i=0; i<email.length; i++)
6 p" A6 x1 ?# F {
* s8 t* q/ E J4 [6 n if ((email.charAt(i) == "@") & (email.length > 5))
1 _2 S! F1 T( G! B( l, ? {
1 T" M6 D4 h# K5 Y ? emailerr=emailerr+1 2 U! K0 E2 g; p+ Y6 ~, T' J! h
} ' t: _. w- w8 W; D7 e; b i8 `
}
: @* }: r' E' v7 U- g8 m2 x$ l! t if (emailerr != 1) 0 r+ b8 Y$ M1 M" g
{ : T/ @: w+ U; @% j! k
alert("请输入正确的E-MAIL地址"); 7 X4 A( H/ h$ V
document.sform1.email.focus();
" y# C& G& v* `1 h4 l return false;
9 B7 R( } Q1 U" r3 G6 T }
, J: r2 q: J, V! J) c
/ H: L/ w) A; R7 F if (document.sform1.checkask.value=="")
' J8 L# j5 g+ @/ Z- B { ) p: X8 V x/ {% u9 Q
alert("密码提示问题不能为空");
_0 c' i9 {+ h3 q! L* U0 ~ document.sform1.checkask.focus(); % y- Q1 x0 L# ^) `+ B+ {5 A* p& H- I( ]8 {
return false; % T& b8 }* I) \# M8 v6 z2 |
}
( e9 P0 Y0 c( j! T5 C if (document.sform1.checkans.value=="")
$ |. Y9 \2 {: K4 k1 T {
' l5 F+ b/ }6 y! @ alert("您的密码提示问题答案不能为空"); + P" R! V$ ~5 v; }4 N4 {8 c7 I
document.sform1.checkans.focus();
! H5 U! m8 c. r2 |" U return false;
" l( m% a& R+ h }
" B5 N0 L; T6 |0 f; r return true;
2 k; I5 F* R' l% h' S , e: \) b F) ]+ `
} / \( ?6 {1 g5 B. Z4 d3 E f9 Z
</script> |
|