  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14159
- 金币
- 2370
- 威望
- 1647
- 贡献
- 1318
|
这个脚本对你可能有帮助:* u. W& V% L$ a# _4 F% t" n
<script language="javascript"> " y2 ^' n2 I8 O# |
function IsDigit(cCheck)
S3 l: {) g" g# }" } {
, T# k+ M/ m* ~ return (('0'<=cCheck) && (cCheck<='9'));
, m' W2 p/ @; [( ` } 1 j" Z* p6 N+ k/ G% k- | L2 f
/ D- E' x( g7 b6 {6 F; _8 M4 ^- w
function IsAlpha(cCheck) ; }& ?$ D6 z! D$ R( r4 ]
{
" ~ h9 O7 U5 K, @" H0 Q- n" ^ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
/ |1 ~0 i4 s+ z& q+ L, D+ S } , F, \ r" W2 e% C) @" L4 i' J
, V# G7 v& B m4 F. u* i& Vfunction IsaNull(cCheck) ) g' N; z2 F& ?
{ F8 [, k$ z# E9 t' W
return(cCheck != " ") ) z1 @% G$ x' j. C4 N2 W0 E1 \
} # J0 Z$ C3 P9 ~# J7 |
4 n& d; I. P3 R9 Y* z
function checkform()
/ d }4 D% I$ n8 G D" K% c3 u* Z{ * z1 h" N8 y2 D# j1 L
id = document.sform1.id.value; " d; f# c" [8 b2 Q
if (id == "")
, ^ o y/ I! G7 V( u+ d" r" D { 7 a/ ]9 B) q/ N5 Q
alert("请输入注册名"); ; b% q. y0 a1 I- {$ G
document.sform1.id.focus();
1 L. ^5 q% k. T/ Z, e% g% ]% f, Z% z return false; , \' G6 W. D. N
}
& n" Z9 B) a$ i8 T1 Q8 a3 G7 F 6 K- K1 S1 }3 e' U' T) }* a- m5 V/ Z
for (nIndex=0; nIndex<id.length; nIndex++) / Z- F$ C Z1 H) d! A1 G; h
{ ' Q8 ^% k, k/ W
cCheck = id.charAt(nIndex);
6 S# {+ p! u2 {8 L$ ]9 Z1 {/ g if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) @) g _; I, [3 e7 r
{
' f( ]$ m- Z+ [8 P9 M alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
" x& A6 Y, p7 [- I+ f document.sform1.id.focus(); 8 j6 p2 r. O+ N: A) X( ~
return false; 4 S* W" j; ?8 N$ D/ u
} # ?9 z1 }. s- Z( v- j% I- [
} ) [( K2 f% H% u) o5 S \" A* _
chineseid = document.sform1.chineseid.value; + v, { |8 _. w+ _. X
if (chineseid == "") + |5 n( P# S! h' m
{ / Q! i( K! i- C$ c/ J
alert("请输入中文昵称"); $ m: w; ^" C$ A- g' d
document.sform1.chineseid.focus();
0 i5 m! e3 h; Z return false;
% a- V9 E7 l; q ? F% y } ! _+ b6 u, F& ] d7 }
password = document.sform1.password.value; 5 L: ?7 Q8 I: z7 ]! j9 R J8 {
if (password == "") ( [5 J5 E8 r" B9 {' y; S* A
{
+ s9 T+ M+ u) D1 ~) S( Q alert("请输入登陆密码"); 5 y) q: b) P% e+ u/ {% h- A+ m
document.sform1.password.focus();
( j6 f8 W8 t2 _; k return false;
3 e$ g' w& ?, F9 Q- |% B& _* @ }
; o+ ~+ U9 X e password1 = document.sform1.password1.value; - \7 d( I5 G! o
if (password>password1)
5 ~; r+ B. y: h5 F3 i$ x% { {+ |$ M: u5 ?5 j e% c
alert("重复密码与登陆密码不相同");
: f, e3 s: f# _! n document.sform1.password.focus(); % p$ U+ ?2 ^$ w7 u J
document.sform1.password1.focus(); / H' {* j+ ?( j% W
return false;( W3 }2 g/ }" ]: J1 U* c2 I1 k
} 9 H/ w' C1 _' ~# [% a
if (password<password1) ( I& W" k& i3 t# ~
{
1 J) T! w* W5 y) a alert("重复密码与登陆密码不相同"); ' `$ ?5 b# j3 X' R- M
document.sform1.password.focus();
" `! X, s! C! G, d' B: {( i$ i document.sform1.password1.focus();
, [$ g( l/ D, X3 n% k* i# v, B ~% l3 c return false;
: g/ I1 s, L3 Y' N$ x } }% W! P7 G+ h+ [1 Q$ V
if (document.sform1.email.value == "") $ f8 |4 n1 s- M& V5 L& L3 O
{ 0 X& Z6 |! g& d( r
alert("请输入您的E-MAIL地址"); : r( ^7 G0 s# P! d
document.sform1.email.focus();
?& s) [+ h# ]) R) ~3 g# b return false; ) v2 E1 b2 G: j
} + @- c8 L* k5 q: P; V& w
5 j N7 Q% r' U' U# f: G/ w* ? email=document.sform1.email.value; 5 W, @" a9 Q2 m9 A2 k: J& O2 o0 n
emailerr=0 $ y* ~" o: T8 g( c3 s
for (i=0; i<email.length; i++)
5 n, O; I% ]; N- \ { & S( A! N0 W6 x, }' R& ]
if ((email.charAt(i) == "@") & (email.length > 5)) & N- T1 f2 ]8 E: K5 M' B- q
{
! a7 t' w7 g6 @, y% b) l: w+ V emailerr=emailerr+1
: A$ C: \4 C) x% E f5 ` } 5 p: d4 E6 d, A3 |
} % r" J+ v+ Q9 k" d8 i: H2 l/ A, ]
if (emailerr != 1)
% W; Q5 V4 c9 R8 a {
$ N- ]( c+ n B+ g$ n alert("请输入正确的E-MAIL地址");
o; ]" N% T% v- O document.sform1.email.focus(); 7 {! ]5 J/ ?+ z/ S+ ^2 U8 Y0 c
return false;
. G& |8 [2 Z& N }
, J8 ^; h0 L. A3 k6 S
+ ~3 O+ H$ l! N( Y9 ] if (document.sform1.checkask.value=="")
# R t+ j. i2 t* K { ! _! n& R' C) u- F' n; J" a2 G
alert("密码提示问题不能为空"); 5 @1 h, U! P, s: G: O6 P6 m
document.sform1.checkask.focus();
7 y6 y. q4 x6 n9 K; |4 E return false;
8 ]" ~( X" A/ _ } 5 r9 j6 x1 |" R& A- J0 c* L
if (document.sform1.checkans.value=="") : K2 I s9 C& J, _$ V1 Q( K
{ " E: @3 _/ S0 t7 Y
alert("您的密码提示问题答案不能为空"); $ E5 `4 Q7 G6 r7 F/ m7 u; T
document.sform1.checkans.focus();
; ~/ B: C& V- U4 S3 s return false;
# z; A( H6 E! k' j& A! O0 E; C* b }; g( a6 J$ L: h) p7 \ R
return true; 7 w( n: E$ w% n
9 A- b' Q3 k0 N; o1 W ~5 z' e3 N0 o
} : O/ g; s& [1 ^8 P+ t
</script> |
|