|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14341
- 金币
- 2456
- 威望
- 1647
- 贡献
- 1404
|
这个脚本对你可能有帮助:" f0 C2 ]/ p* I2 ~8 A! i5 t v
<script language="javascript">
) P( ^: u5 S- T7 b+ ufunction IsDigit(cCheck)
* s7 ^$ O0 w5 D7 L5 I1 E! o {
9 U& X( d Q' S; T9 N+ x return (('0'<=cCheck) && (cCheck<='9')); 4 _* ^0 ?8 ~. r( \( N5 o
}
% b% u# d7 d6 l) B/ ~6 V / E& U; [' h' E( l: O) o
function IsAlpha(cCheck)
# V) _2 P0 |+ Z! O/ G { 3 @% M2 B4 \) N! G& T2 I
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 ~* H) J; ~* g) H
} 6 g) q: G! X( o6 D# F+ X# t0 A
& c7 `" i2 ]7 ?! B5 q# Z) M
function IsaNull(cCheck)
9 x; A/ v7 |5 q/ @7 { { ) Z, {1 ~4 o3 y
return(cCheck != " ")
5 ] i/ c5 M1 N; F6 i7 Z8 q) F* d2 N7 v }
Y( M! d, o" j- c3 n5 p G G3 \3 M, g+ Q2 S1 S% R
function checkform() 0 B j! g7 h8 A4 n
{ $ D m, z2 z2 g0 A% T" L; v, v: j
id = document.sform1.id.value;
+ ^* [9 N ]% }$ K! _! y G if (id == "")
% d5 g( I1 \7 o0 p$ g2 G { ( j0 u/ @) ^" X7 M6 g
alert("请输入注册名"); , \( H+ N# y2 [; C" I
document.sform1.id.focus();
6 w4 R5 @5 z9 G2 D% A: J return false; , g9 o+ X( O# Z8 P& C" r
} % c) k4 B0 h# N' h
/ {8 I5 ?$ o! H( U$ x% {. S8 w$ v for (nIndex=0; nIndex<id.length; nIndex++)
* p; r9 B( B, }$ O { 8 {5 L. j: k' b. @
cCheck = id.charAt(nIndex);
* p n# h" L: H) ^' V& u6 o9 \ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 2 |5 \$ S3 H8 I- \0 P, h
{
0 }& D' V# R4 `. L% f alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , X. Z0 t" W$ a( x
document.sform1.id.focus();
4 M% D* q* O! B- c4 n return false;
8 m4 G% [+ ~# \- H* ^* \, P! j }
. @ P( y/ o/ {6 U5 \( c }
; ~% U/ B: {* O9 {5 Z" L chineseid = document.sform1.chineseid.value; 0 \4 q0 q* _6 l0 p
if (chineseid == "")
+ }, H8 i, y+ K' ?8 I { ; a" E: x6 k5 Z, _
alert("请输入中文昵称");
3 A- ^, |" u0 T* C7 r% ^& D5 D3 y" ` document.sform1.chineseid.focus();
9 _! E6 D! G3 `3 c7 v! M% z! J: Y return false; 5 _3 s. \* t# H/ O
}
@/ I8 ~8 F7 t5 p9 ` password = document.sform1.password.value;
( p) Q: s: U- _& p: [6 k2 ~5 h if (password == "")
* D$ z3 C" l% @- Z) I& ^ {
# M9 H( s- I' L ]. k x0 t9 G/ C alert("请输入登陆密码");
" x2 S: S8 f1 s s. ` document.sform1.password.focus();
. G1 E, x- Y* c; T return false; ) [8 N3 D% s6 V1 P
} , \, l8 Z4 a2 s2 q( L/ r; V) F
password1 = document.sform1.password1.value; 4 D3 w$ C2 J1 I! Q1 S2 Y! x
if (password>password1) 1 x J% T* ]3 y# Z
{
# O2 T1 e; J0 b- Y- w" Z alert("重复密码与登陆密码不相同");
, ?* H; N+ V& f* i- _ [ document.sform1.password.focus(); n( N# `: a; q" ]6 @5 L5 w
document.sform1.password1.focus(); ; {6 |' v, S9 k; G8 a
return false;
* X- U6 l" m; H# U; F$ G }
( B3 n+ v% [- j# A c3 {- xif (password<password1)
; t* B% T; W& I) B4 U: Y {; F$ _4 T2 Q6 |1 G9 a9 M
alert("重复密码与登陆密码不相同");
1 g+ S6 R3 o, U0 ?9 D0 X document.sform1.password.focus();
$ @: f5 Z& L- R$ l! ?! p$ t" M document.sform1.password1.focus(); . [2 g4 ^+ O B( J' g8 M T3 n3 p5 d
return false;
$ X; T* Y A( V( c/ s( K }
6 e0 \) R; {5 M4 q* h' Z if (document.sform1.email.value == "")
* J3 p; _! O. h* }* N6 I0 y. R {
! r3 @2 m/ s6 @$ K3 ~6 r alert("请输入您的E-MAIL地址");
7 Y/ a: `7 h+ C1 F0 z document.sform1.email.focus();
) s7 }) k' Q2 t( f5 h+ i1 ?; b- X return false; : l6 H K/ l7 r/ o8 p7 \
} ! R- i1 y& L9 U# n* A$ p
% I0 ]$ }# f% v! m email=document.sform1.email.value;
, d% W. P. p1 ~9 |' ~! Q emailerr=0
6 O! E$ }6 }" `7 D1 y+ _4 G- G for (i=0; i<email.length; i++)
# X. b, S# p6 u7 {6 t { 2 U- M: S4 P6 k* L3 U8 e" ~/ H, U
if ((email.charAt(i) == "@") & (email.length > 5)) / [! _* ]" Z+ I( ~- s5 K
{
7 B4 d A0 m$ m3 w emailerr=emailerr+1
7 _' I' k5 x+ Q; a }
3 G& l8 Z$ c1 X3 s! x7 h } ) {3 S% h" D3 V: H1 ^0 u
if (emailerr != 1)
. B1 w/ c1 t' @$ i) h- H2 \$ u { ; ~5 m5 U' u1 ~4 d y& g" z. E
alert("请输入正确的E-MAIL地址"); 2 C2 J/ V3 b4 U7 k
document.sform1.email.focus();
" p& t) s( q3 d$ c0 O9 B" I7 L) p) Z return false;
' e4 K% [7 @& t Q } ( U8 l" j0 ?2 k8 h" ]( @- i) U! q
9 J# Z: D; t; \3 ^( ]
if (document.sform1.checkask.value=="") 0 G( E/ d+ }7 ]4 J+ m- M
{
* r( K a! d$ O5 N/ Z0 N alert("密码提示问题不能为空"); 4 g8 s- @; A$ a7 j5 _7 d/ ?
document.sform1.checkask.focus();
8 [5 M6 {9 D4 f( x* W9 N& D return false; 7 ^# V! T4 b! _& d. {
} ; s4 W C- t _9 W, J
if (document.sform1.checkans.value=="")
* q% a8 ?7 n+ H+ X( G5 Z { $ q$ [- L0 y- W& o' T0 n- ?
alert("您的密码提示问题答案不能为空");
4 f: O- t3 h$ i7 N a, ]$ g9 A document.sform1.checkans.focus(); & Z+ O" `# H) I9 \; u5 W0 D
return false; $ c# D) D" e$ C6 P
}
9 T6 m7 ~! M; J# P1 m) S return true;
* ?. m- j; T) c% ] 5 l6 u" S- b5 Y2 A
} 3 |5 f+ D4 ]8 T' P7 \, q
</script> |
|