|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14347
- 金币
- 2459
- 威望
- 1647
- 贡献
- 1407
|
这个脚本对你可能有帮助:6 v. l3 G. x- E2 {& U, u& C
<script language="javascript"> 2 s c! s: n5 y" }7 x/ h# F" n
function IsDigit(cCheck)
: e1 y, I% _6 V2 y1 \+ Y! ? {
* e7 j0 d' l& E return (('0'<=cCheck) && (cCheck<='9')); " ~0 n5 o! \/ b- r
} 3 v( H. \- c9 a s3 l' P7 V1 J
' W P, x7 z2 B
function IsAlpha(cCheck) % C! s! d: B/ g& O' }2 o3 @9 x
{
; Q% q. c6 [, j4 s F$ S return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 4 o% O) t# r# i/ Z; _
}
2 n) Z, e6 a1 ]* V
# T: Q/ o- i! O& @9 rfunction IsaNull(cCheck)
% C+ {# v" W7 m& [ {
9 l% y5 ?1 L3 {: |2 n return(cCheck != " ") " v; y/ y6 Y: m
}
, z+ e6 ~- w! _: P: t1 K
. v7 v( b* g% W( qfunction checkform() 2 P" K" o+ _# ?" a) h- K0 b
{
) _9 ?3 C. a) Q4 w id = document.sform1.id.value;
5 f6 P! c2 u9 s5 Q3 E* f if (id == "")
2 X& h8 V' U1 R! \. {4 S3 ]% s {
# d5 e7 w( Y4 s; ?( Q$ {/ d" S alert("请输入注册名");
$ \. C' S2 G5 V! o document.sform1.id.focus(); " S8 K/ w3 V S- g- X% G$ L
return false; $ p# @- ?7 G& s) w: G' x
} ; M2 R% P* I3 H9 Q+ Q7 b: ~: U
* b! } b7 }3 Z9 ~
for (nIndex=0; nIndex<id.length; nIndex++)
" v1 j$ l' E( v& V5 k9 ` { 3 Z3 P* Q! [9 k+ M
cCheck = id.charAt(nIndex); % r2 _& m+ }7 a- d C9 l9 `( g
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
* m; x3 \6 U! l0 A" d4 a! _ {
( ~: O A" c/ k+ U alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); & [; s1 b5 N& ~- |( M u
document.sform1.id.focus();
' ^8 C2 R9 D4 K* D return false;
/ B9 m& {* e3 w' F" B5 f; M" v! ]# G }
; @0 d1 M& d" R' r2 @- o8 W l1 g } ; C! M! I" o; }
chineseid = document.sform1.chineseid.value; $ l/ |$ ^9 [# V3 X' ?# j9 b
if (chineseid == "")
* Y# j6 x* r ^7 J! U0 Z2 f Y8 _ {
( ]" p I& G( d" y. J alert("请输入中文昵称"); 6 c- l2 G) T; |3 ^2 F0 l0 `
document.sform1.chineseid.focus();
. o% @$ l+ h3 S% q- [: r return false;
3 C1 s3 W, A9 l4 f- ~ }
5 S- }; I7 g. l# V4 k! f" S password = document.sform1.password.value; {8 C5 i3 J! m: ^4 }$ \, x6 z
if (password == "")
* J. b& z' q( y( s3 w { 2 W5 w: h5 t$ t& v- e+ w& }! l
alert("请输入登陆密码");
% l$ [" b+ M3 F5 O document.sform1.password.focus();
4 J; [. a* W3 e0 e5 ` return false;
' W$ G8 D U" ^3 @ } , s" [. a/ U- a, m9 T2 P; [- r
password1 = document.sform1.password1.value;
8 a5 U& d( m" p$ c9 Q1 U if (password>password1) , S' W; @. k3 Y/ l
{ a' f! V& q8 l" \* b
alert("重复密码与登陆密码不相同");
+ N0 P0 V- L6 P7 s9 X document.sform1.password.focus(); 4 W1 X+ O& s( F6 y0 \7 M
document.sform1.password1.focus();
) A7 b2 D2 ~% a$ @+ i; v1 L! Y9 @- F1 c return false;6 a6 {6 [0 x, ~0 {/ y/ V# W; J' g
} ) h7 v+ C1 c3 C) o
if (password<password1) . w# |( V" |/ m, r) e
{$ e: S/ ~7 ?+ v# {1 i. Y9 c/ |
alert("重复密码与登陆密码不相同"); ( F: W1 w7 K& ^; d2 ~) W) K; M
document.sform1.password.focus();
2 Y6 f# [7 | q. c$ Y3 x ? document.sform1.password1.focus(); 6 k( V( R& t3 {
return false;: Z0 M6 x" g* F
}
% \2 E. A4 F# H$ u8 g' Q% O7 L1 m if (document.sform1.email.value == "")
! ~8 N- @+ s/ I |5 P& A% r: d" K$ ]; D { ( P2 @5 Y4 x( u7 }" Z
alert("请输入您的E-MAIL地址"); $ _* W1 F0 R; i
document.sform1.email.focus(); 3 B$ n d( A. s! G9 T
return false; 1 ^( i8 n. z0 Y" S
}
+ V, D/ V9 g K1 M2 `0 d1 t: X / H" Y5 V# F/ ?+ @5 ]4 w& n
email=document.sform1.email.value;
. u2 |. a4 B0 b" V emailerr=0 , l ]/ q# x2 `# f# H
for (i=0; i<email.length; i++)
3 [4 B' e' i5 U. j) h4 W: ~$ l% t4 z { . `) _7 w I, F$ m2 q
if ((email.charAt(i) == "@") & (email.length > 5))
) L+ S) Y. q% |9 r U {
; p. Z% i! O0 p7 F/ S emailerr=emailerr+1 % [0 C) l( ]* T
}
8 F! P1 u& v, N! ], J } 4 M, [6 u9 d5 _- x. m' [
if (emailerr != 1) ! M% C) Y; g# T' b/ d" f
{
- x6 G% N5 \7 u alert("请输入正确的E-MAIL地址");
3 q$ R) z6 w1 v: R9 Z8 i5 @) m$ Z document.sform1.email.focus(); 3 j7 {+ g% Y, _$ `
return false; 3 E2 D% V% Y" U3 c4 Z
}
6 W4 A9 D0 q$ m4 V2 f& G( k8 d: n , q/ D1 O6 U3 g: t t* a) p4 o
if (document.sform1.checkask.value=="") : W- F& e4 t4 g4 D; H
{
2 a6 B0 y5 @ i1 d alert("密码提示问题不能为空"); $ o% Z7 V3 |8 l
document.sform1.checkask.focus(); ( ~- u4 J1 g- y5 p
return false; ( A. K1 J. \+ Q# `: ^. V8 g5 g4 {* D. T
}
( y% x# Y1 L7 Z3 s+ R& t if (document.sform1.checkans.value=="")
: n7 w' J' d- s0 j4 i { $ `8 \! }2 p7 _4 B. o. n
alert("您的密码提示问题答案不能为空");
6 y5 D! N% t- h3 b3 b' R; j* N document.sform1.checkans.focus();
1 Z0 E' ]& e1 f+ a1 o: k6 y% M return false; + Y. u' }7 S' \( x+ E! k- `
}
4 t! `% z: P( ]" }( o' I return true;
! A5 I/ ?. p4 {. b- Y4 h
7 E0 {* \2 n% Z" J% Z- `. y}
9 z4 H$ ^: E" ~3 y6 {# S</script> |
|