|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14407
- 金币
- 2489
- 威望
- 1647
- 贡献
- 1437
|
这个脚本对你可能有帮助:
* `' c6 h' {4 }6 A3 C<script language="javascript">
. E, F7 J$ `& `function IsDigit(cCheck) $ m9 ~" u6 K B8 N' \1 m- e& j
{
9 h7 x+ z2 Z& n- P* a* U( Y return (('0'<=cCheck) && (cCheck<='9')); 4 c M0 x# m2 f+ ~/ H# S
}
# X9 [4 j- \) K; W7 Z4 x
' [, m9 h$ d8 Q6 w, C" _function IsAlpha(cCheck) 9 D- c9 N" b' ^$ b' l' Y, I
{ " L8 }+ C3 A1 T% {/ z8 {
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 2 X) c: J; w8 @
}
, u, D J' n1 h % k4 D) k/ Z6 {& @+ h9 t5 }# r
function IsaNull(cCheck) ' W: W8 ?* P& f" o q, Z. d
{
( q+ M5 k: ~3 Y8 ~ return(cCheck != " ")
% [* l) z9 e9 X6 { } ) ~+ ^# x9 W6 x: T* y$ c3 b/ r' f
/ z% k% M f0 X/ j2 v1 G* \
function checkform()
]/ T5 t" H% L$ w3 R{
7 p. d2 F% g$ N! |# @ id = document.sform1.id.value;
3 P# Z# C/ _- W if (id == "")
# B' z8 N' u T! Y" w" \7 z { . \7 l4 E9 w6 M; u& u
alert("请输入注册名"); 0 j$ Y; g* E, x2 U: ^
document.sform1.id.focus();
6 J- F" N) y, ~1 ^ return false;
" M) h9 V q4 N$ k }
|& d7 ]: p/ o; L + A8 F" D( A2 Q' K9 A+ f2 U/ t5 E
for (nIndex=0; nIndex<id.length; nIndex++)
* a. `# s0 M+ z {
- L# {$ R$ R8 Q cCheck = id.charAt(nIndex); 2 G/ B X5 b' X6 ^( j8 j5 H0 V( X
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 7 X8 V1 z# u; c0 [4 I" n( k
{
& V4 t* W. E. c4 \ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
4 V) u, W _& b% {1 z3 @ document.sform1.id.focus();
3 U' \" I2 q e. K return false; & P( X" C: X! ]
} 4 R3 Y' f4 I# Y2 ^$ u* D. C2 p; _
} - j" g4 K. _% x0 m$ B
chineseid = document.sform1.chineseid.value;
8 t, k8 q! N6 v l$ s if (chineseid == "")
* s( M4 r$ Y0 ]( v { % E& _" |' Q) [
alert("请输入中文昵称"); 8 W/ ^4 ~7 g$ v1 ]/ S6 R3 Z
document.sform1.chineseid.focus(); * L1 C: ?# c4 F8 i% ~3 I
return false;
* j' y" f! G" d- G# i } 8 Q$ P4 a6 ]8 [0 v' m
password = document.sform1.password.value;
" L, j, F$ S. b( e) o" R6 ?1 K- b if (password == "") $ x# e+ D) O7 u* v/ I! W% `
{ - I* U5 A% V1 {1 P/ r0 s
alert("请输入登陆密码"); ' \1 z4 s- [; r( r8 _' \8 z6 K+ @
document.sform1.password.focus();
3 W! R$ N' E) r! c+ x return false; ' G& F+ ^2 w) r" w' N0 t2 z
}
' C8 \7 T& b( t5 L password1 = document.sform1.password1.value;
, T$ q6 W, |, r) j' q if (password>password1) 0 _0 Y7 V7 ^4 P
{
4 n% S e7 E1 U: S' d alert("重复密码与登陆密码不相同");
' R% U! D3 k8 [& _% F& b1 l document.sform1.password.focus(); ! k( T9 X7 ~7 t9 M' k9 k
document.sform1.password1.focus();
T0 W' o z1 f8 c( n. J" q+ r return false;+ M1 d3 S+ A" K( H/ q; R, t0 v
} - ~. i* L# [8 U- g" k: Q
if (password<password1) " f# n8 R5 B! z) u$ l
{% n% v3 @0 K1 q: U6 u* b
alert("重复密码与登陆密码不相同");
( c' p, n1 [7 } document.sform1.password.focus(); ' b+ V- W4 T- T' N8 a$ q# ^' e# w
document.sform1.password1.focus();
# E. p" u) s0 b$ ~! F2 Q return false;5 \; t4 d3 O6 f. L: t, x* z" \
} , A1 Z2 d8 \" r0 L# V
if (document.sform1.email.value == "") # W |4 m/ X+ N: U
{
6 X2 v9 o! u) K2 V) x5 l alert("请输入您的E-MAIL地址"); . p' w& W9 M% R; Y2 e# m
document.sform1.email.focus();
( ]+ b; Y- P8 q$ i1 r. R- t return false;
# y6 W. H& k) W D& M } 1 T2 G- B5 \' [% {" w5 J+ ^
7 F. b! B' j8 W2 m email=document.sform1.email.value;
4 u" f4 K* y. E4 L, L) Z: F; c emailerr=0 9 s, a8 S: W" q U2 O
for (i=0; i<email.length; i++)
7 Y, X, g7 q( d3 {% m+ k) u+ u( I { * G2 c/ N- n) d/ y
if ((email.charAt(i) == "@") & (email.length > 5))
; C- G1 i8 r1 A, ?! B$ o y( @: m { # M. p9 S# E% @1 [1 z1 _3 S9 z. E
emailerr=emailerr+1 5 O: p/ O ^1 k0 y
}
; X" h' J1 T4 h. `+ [. | }
]$ O6 R, V, t( y if (emailerr != 1)
e% g! R% ]) a( X; F% f, m' z { 0 p* V* K/ `* x7 }
alert("请输入正确的E-MAIL地址"); 5 i6 M6 {) \; p4 [8 t' [& [
document.sform1.email.focus(); # a7 z2 @/ Q& D% I5 n* b
return false;
/ P) r" H% b3 T$ X }
4 l$ ^; e9 h* Q$ N! q
D( {6 d( U! y& U, V& K if (document.sform1.checkask.value=="")
( V7 N8 c2 H0 d {
: f4 U. e0 {# Y9 V4 q' ^$ P# E; e alert("密码提示问题不能为空");
& G8 d. S2 ]$ ?% T document.sform1.checkask.focus(); H) G$ l' I$ z9 G4 n4 R& Q: R
return false; 7 I7 X( ]$ K6 X! D4 y
}
" i; ~: h) U, Y# j3 F# {4 v if (document.sform1.checkans.value=="")
* H6 w4 g& s. Z+ K- x {
7 B: S' d( M; M L2 D7 G alert("您的密码提示问题答案不能为空");
$ H' P/ i& Z% A4 a/ K document.sform1.checkans.focus(); : [! J' [ F6 g$ R
return false;
( G+ G5 U- w& U: p }
; a" h$ N0 m6 m return true;
3 Y( ^$ v$ ]$ ^' N# [) I
: e; M2 E* N K} $ q! y* K: w; E5 W5 W1 U7 Z
</script> |
|