|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14421
- 金币
- 2496
- 威望
- 1647
- 贡献
- 1444
|
这个脚本对你可能有帮助:
* r5 `: Y% `% z5 z<script language="javascript"> V. o/ R; z( L" C8 u. _1 s# t
function IsDigit(cCheck)
# B3 L; F( T4 a& m3 P3 [: P {
; b7 G P, ?' o( a+ d return (('0'<=cCheck) && (cCheck<='9'));
4 Q7 e; O% N8 w$ [( E }
8 v8 Y) X. f- f9 `4 n3 t ; C/ S! B. O% B3 S% d5 @
function IsAlpha(cCheck)
# |( i7 s7 [) ]3 P {
/ _- s4 ]7 q- H+ Z+ S/ G return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" o7 ]& L0 ~$ Q5 s4 z }
5 m' _* d. |# L. g- Y' ~
# z# \5 x; ^: \+ u$ e2 }- Hfunction IsaNull(cCheck) % I6 M/ A/ v7 s
{
G+ u0 r- m' d1 C0 e& g return(cCheck != " ") + P9 s! g7 C7 Y+ e. t7 e2 \/ S9 N
} 3 }7 ^) J+ s8 P- H1 ?6 s, O
. s! |( G B$ h3 T9 |. @( r
function checkform() ) v( t# C6 `2 M4 ~5 l& Q: h, z
{
; B" s7 Q8 `. n& i$ r id = document.sform1.id.value;
$ j! E* u) D5 X; J! c. y( [ if (id == "")
* |; t+ B, q+ I2 J: v. T1 F: A! X2 g, t {
3 _' c( t9 M+ Y/ `0 o alert("请输入注册名"); 5 o& J1 ?' V, ~. r U8 r
document.sform1.id.focus();
, r* X5 l6 T) H# ]. O, e$ q return false;
! V. d" H6 h" D" Z1 v! J, ^ }
* D5 g; S: X0 S$ [& {3 L
( M1 J: Q( P" h5 M4 F C for (nIndex=0; nIndex<id.length; nIndex++) ) z/ r4 a! }2 L5 e
{ # u) U5 B) q2 \) @
cCheck = id.charAt(nIndex); * m. S, w" n! a5 Z% L2 u
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) # x) V5 M2 m7 I( }+ N3 r
{
9 ~- ]0 r6 b1 |- ]& k1 A5 R7 t- O; m alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 9 P+ c/ l% P) P. F
document.sform1.id.focus(); % t4 T. G1 B R( h4 b! N
return false; + ~' ^7 D1 n1 e; j# Y
} : S) m9 w$ r7 @ S4 [5 A0 L; Q/ ~
} 9 c8 n, C" @8 }' X+ W
chineseid = document.sform1.chineseid.value;
* r' g0 {( r! M% [ if (chineseid == "")
! I* g+ u& h; u% [+ I7 I! b9 c {
+ U: f$ S3 r$ D7 B2 b5 ~ alert("请输入中文昵称");
6 }* U6 T7 W. Y document.sform1.chineseid.focus(); + l% A) H8 n8 U4 L' k9 _' J0 U2 p
return false; + F1 S* b( P: X3 e1 W& O& V
}
# x% b& H1 T- P$ o: R password = document.sform1.password.value;
8 O+ C/ \) T$ z4 j* x, e if (password == "")
2 { z v! p2 {9 k# r! J {
0 E# } q/ y1 N( i k4 @ alert("请输入登陆密码"); 6 {) `) q ~- }4 g2 i
document.sform1.password.focus();
9 d& }# C/ X% X- W, C, t$ j+ | return false;
* W7 E( F$ l4 F; c" W" t' v } 4 }9 w+ ]+ X8 [: o
password1 = document.sform1.password1.value;
) ^: U+ t2 F( `0 B if (password>password1)
/ W# Z3 U9 o: a5 ~$ C& X7 s! E {7 T# B6 M! @0 x6 m% v1 `
alert("重复密码与登陆密码不相同"); ! ~6 N/ c: C( R7 r
document.sform1.password.focus(); / G# U/ n; | ?3 f% p
document.sform1.password1.focus();
. O) E: K9 g9 H8 k) M return false;
9 g9 F, p( A; e: } }
0 Y. I" O8 `1 ~2 j. ?if (password<password1) - s) V8 J ?9 }7 d4 q3 l* V
{; ~+ }6 u5 ~' [
alert("重复密码与登陆密码不相同");
3 Y% J6 l" `# n+ @! t: I6 I2 [. t document.sform1.password.focus(); - ~& |* D T y- j( n5 @ `
document.sform1.password1.focus();
1 B+ `( c* C4 G0 [! y1 h8 { return false;
% t% H! Y( ~# j& `* S7 q } 0 `! I: }* ? ?
if (document.sform1.email.value == "") % c" s* C0 s0 y, L$ z
{ / N; f0 z! R8 @( p0 J7 ?" z
alert("请输入您的E-MAIL地址"); ' t+ Y8 B8 X* h' Y
document.sform1.email.focus();
2 r& h' \ h N! i; @2 M3 ]9 |( d7 H) }6 n return false; / i `: D( J9 q: R3 P
}
1 `" e; ~: u n* ~7 ` $ C2 v& h; Z& g+ \ Z
email=document.sform1.email.value;
1 {; _9 w+ x% E8 K; p) u- ^* y& ^ emailerr=0 ) `( H) o! I$ n% C) [
for (i=0; i<email.length; i++)
5 I/ A* M+ M# i* ^+ G% C4 P {
" E- W1 V `' Z% ?4 n if ((email.charAt(i) == "@") & (email.length > 5)) ) K* c+ V& ~5 K- z
{ 7 n" [/ C% N) f4 ^, g7 o
emailerr=emailerr+1
" ~ U* Y8 a6 F& z5 K }
3 y0 L. }: l5 L }
1 L- M: Z/ n" U6 A, j" F& v if (emailerr != 1) ( F7 g1 M6 F! L9 P2 ~5 @$ c
{ 0 a, y; q1 F! h( a/ Z! J! }
alert("请输入正确的E-MAIL地址");
! U, O5 r' O+ j document.sform1.email.focus(); 0 G! W* ]- F% I: i, w" P+ r
return false; 1 o9 a- P6 \5 H4 Z
}
* [1 A% R9 G8 @, ]
3 h- J* j8 M! Y8 ?, q+ m% L if (document.sform1.checkask.value=="")
9 G% s& @ Z3 r! O4 M' h3 n n { ' Z$ C7 B# A3 r+ @4 S8 z$ @+ Q
alert("密码提示问题不能为空"); + a" `, b$ M# g* y0 B ?
document.sform1.checkask.focus(); $ z) s$ p2 b# t
return false; , r3 E( E% E9 M3 ~ \
} 3 _, ~1 m% f, Q& O$ A. O/ e" e
if (document.sform1.checkans.value=="")
/ {2 j$ \6 D2 ^6 f. x& k {
! i* S# b# T' \; ?! I0 _7 t alert("您的密码提示问题答案不能为空");
/ w- [- }/ b9 C C# C document.sform1.checkans.focus();
: ?* U% z7 Z- ^& y$ E4 I return false;
3 y2 h, w" Y1 w3 F9 K }
9 \( A& Y2 s* |' \' T; }3 z; d return true;
) P6 m, A: A9 u% q
1 F/ D( c6 e1 O; ?, w& R} " |9 f/ F0 d: ?2 r6 @$ r/ y# b* o L; ]
</script> |
|