|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14341
- 金币
- 2456
- 威望
- 1647
- 贡献
- 1404
|
这个脚本对你可能有帮助:
. `9 T8 O9 p$ ^# @. D" D# x<script language="javascript">
; ?' w. \* L; h$ k1 bfunction IsDigit(cCheck)
$ d1 T3 q' ~7 g8 M) E! {8 h7 X {
+ { k" v; l/ _" K' |6 @ return (('0'<=cCheck) && (cCheck<='9')); 4 c$ a% e, T# }
}
: T! U1 r3 o+ H: o* H7 y+ r 3 d" \0 v- Q$ m% ~8 g/ U* |2 e
function IsAlpha(cCheck)
6 P1 R8 a+ l8 D2 F5 M { 3 e. i4 O( Q( f' ]" a3 o9 h4 H6 r! D
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 H4 \# E }( O* n$ L }
4 t0 Y' Y! J- W
# c; `8 K# _ W& w3 ~% y, f+ C, Pfunction IsaNull(cCheck) % p2 f* Y% z! w8 w, D
{ d, Y4 r6 E3 S- U! g
return(cCheck != " ")
) L$ d# e! U# ]' w m+ a } ' ]% h3 @1 ^- @) Z6 n
4 O4 a W- k# \6 \9 afunction checkform()
) _6 f- N9 ^( ?# i. e{
! h) M; }/ ]0 x% @ id = document.sform1.id.value;
; b. {2 G, h# `1 {; Z& A B if (id == "")
& |% ?0 T5 s i ~# \% P1 J {
. S5 [0 O$ g+ R; F: ]; W alert("请输入注册名");
7 ~7 |0 L4 {2 p document.sform1.id.focus();
: O E: L5 `+ n9 a: ?# B return false;
u0 x3 X1 E+ a/ [ }
# W4 k3 z0 o3 Y3 J# A+ p! c* l% U ! m8 H3 _# P4 U, n5 A1 v6 U$ }
for (nIndex=0; nIndex<id.length; nIndex++)
* u4 t* I& M# R; }' M { : j( u4 p3 V3 e R9 E
cCheck = id.charAt(nIndex);
2 q( \6 L8 X4 I" j if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) q, e/ l7 t% \1 r
{ $ y# k3 ^+ X7 ^) r( L4 n- f
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); W6 S9 f8 K" t/ w! m0 s( L% a
document.sform1.id.focus(); : h, c4 z# [- ~9 p3 p- F, _
return false; , m% H. x! a8 ^7 l c7 T" k
}
( u9 Z- |6 t2 ?% E5 m4 w% d3 L }
7 z) \, g( U4 G& a chineseid = document.sform1.chineseid.value; 0 O! t3 d& j6 M! O9 Z
if (chineseid == "")
9 w( A4 b- j2 Z0 d& o5 f# j {
& ^6 v' V5 l+ v* |' p( I! R+ m. I alert("请输入中文昵称");
% \4 j8 I( h- K1 i: x C* h document.sform1.chineseid.focus(); / X: i- j( ?/ i" g
return false;
' k7 n3 I; Q! D P, a( Q } , r% x. p# L* X4 l% o
password = document.sform1.password.value;
# B! q1 ^ B6 l" S1 O4 x0 ]4 @: |# A if (password == "")
3 h/ @2 V/ `. g: J0 S {
: l3 J5 P9 [9 H A0 o$ T alert("请输入登陆密码"); : F6 ^, z9 X C) J6 D
document.sform1.password.focus();
! d3 R/ s) ]0 K( t5 y( H return false;
, x5 o" s; O" p7 j1 _ } ) ?/ l# J( j: {* a
password1 = document.sform1.password1.value;
2 E5 u5 l2 ^' y) i3 N if (password>password1) $ z6 n* G! Q: ]! Q$ E2 p b
{
: [6 k3 N! ?3 l% v8 F" r/ q6 e alert("重复密码与登陆密码不相同");
0 R& K3 _7 `9 |! ~, [ document.sform1.password.focus();
/ \ I& Q7 [7 g( C) K4 f document.sform1.password1.focus();
+ W' S: E( `- O$ y, A3 F k return false;
" l, A% Q& J: O3 b! ~' b) m }
; `. X! W) W5 Q" s& [0 ^if (password<password1) 9 d# c+ \4 V8 h; K ], P8 z
{
& S! ~( ^( r! y# {0 T alert("重复密码与登陆密码不相同");
7 L: r( v) ]& n( z document.sform1.password.focus();
1 i, q3 G! ]0 K/ \) b document.sform1.password1.focus(); 6 E& U1 U- z, C5 E6 a1 H
return false;
+ f' j' ?. A& |( I! g }
# f% T0 z# m5 e \( l+ q7 M, b if (document.sform1.email.value == "") ' m/ w- \4 [" D& z/ j9 d4 P$ }
{
# O3 d$ d7 Q; d$ P) n alert("请输入您的E-MAIL地址"); + j" U! X4 z+ J! `( x5 u3 R
document.sform1.email.focus();
# U t2 R4 _) J, d+ V return false;
2 c; A8 F7 D+ K3 L0 V0 N" n, ~ } - \( L# n% t4 H$ q- H$ M3 k
$ {2 q) y: `; }- T9 D" g. N8 e email=document.sform1.email.value;
1 L( U1 N9 J8 \ emailerr=0 / ^6 k. R8 ^2 A, {
for (i=0; i<email.length; i++) - W8 r0 d' |3 y3 s9 r
{ f& M! t9 E, F
if ((email.charAt(i) == "@") & (email.length > 5))
& `6 L" s. _+ m! O5 H: j h. N { ) X# @+ u6 c+ j, N: Z1 |& H& `0 y7 O
emailerr=emailerr+1
2 r( e" f% r$ k5 f8 n% K' G8 Z. u0 @ }
, t6 T: v3 u3 d; A% @ } ; Q! |; s1 D l- J+ [
if (emailerr != 1)
4 |# a, P) z" W( f { $ t- k* k; J5 k
alert("请输入正确的E-MAIL地址");
, d% H5 G3 O# t! P2 W document.sform1.email.focus();
5 e# t; k. G, `' L return false;
6 A7 y( U6 p0 p+ z4 _3 A. N7 b2 B }
# b+ a+ Z+ p8 J; _, l 4 J: T+ V2 v" p1 |* W) P8 Q. p
if (document.sform1.checkask.value=="")
6 }$ l- o2 a7 s) S {
' n- u; ]2 }4 C; z& j. J; K alert("密码提示问题不能为空");
! b5 V* y5 \. A/ T5 |+ E. J document.sform1.checkask.focus(); , l" C8 c+ e: f7 }1 c, j
return false;
4 i: V* `" U% w% @1 K/ ~ }
" \/ K- D* Q# L! A if (document.sform1.checkans.value=="")
# |0 B% m- F: C/ M1 M {
7 {" ]+ A5 v$ O7 g6 E! U# a alert("您的密码提示问题答案不能为空");
q, a% q: M2 Q$ s, p document.sform1.checkans.focus(); ; W: }# C0 A3 [- A3 b( }5 C; g( X0 |
return false; . E5 Q0 H$ [' L$ e& s
}
7 v. m1 R$ J' h6 j return true; . } |0 B4 f ?, u2 C* ]
/ \( k3 f" {/ m, [+ }}
1 a7 G$ ^ l! N2 i; {( [6 z+ \! `</script> |
|