|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14407
- 金币
- 2489
- 威望
- 1647
- 贡献
- 1437
|
这个脚本对你可能有帮助:* N4 Y2 s1 u% B
<script language="javascript">
5 v: @! o3 P2 V+ @4 ]5 Cfunction IsDigit(cCheck) 3 u% E* f4 [) N
{ 9 H& L3 i% X2 `" p
return (('0'<=cCheck) && (cCheck<='9'));
0 ^5 z; [1 c) L h, o1 \ }
4 A7 x6 ~, g; b) k% r, {
1 X/ Q/ Q% ~8 u) f1 xfunction IsAlpha(cCheck)
9 p- h: B* h$ e# h% I { , n4 X5 n" _/ f, ?6 z
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
1 ~( V" a# s9 I" A& P; I }
/ N$ H% J9 R% |" u! s
( r* s9 k* V6 X# @7 V8 P* ffunction IsaNull(cCheck) 0 U. T' p- w* v% U/ G. U8 F- d
{ - j- q5 d: x/ p" g
return(cCheck != " ")
) m! a* Y$ u4 o6 K8 l, Y/ h }
4 p* \6 V3 g& W) k% c, E
7 u7 p9 l+ Z+ U1 t6 ?4 Hfunction checkform() / ~0 N+ R: Y! F& L; @. l2 X: W
{
( N- k3 r( f, _* H) J6 Y id = document.sform1.id.value; - i9 f. V$ @! Z% U
if (id == "") 7 M1 `7 r/ q2 U& {1 e% b) N5 v
{ 2 r+ X# V2 J8 O5 Y7 j. A4 `
alert("请输入注册名"); : ^5 [( k% G$ G" N8 R
document.sform1.id.focus(); 0 r2 C' o- v9 W- x! ?3 h
return false;
0 w( Q7 b0 h: b8 C% y# _) j0 L }
+ p4 ]* r% f2 ]- _4 T
* v$ {. n) G0 t7 Y4 T. B for (nIndex=0; nIndex<id.length; nIndex++) ' x3 Y5 r# _3 f) _ b; ^
{
( q2 |1 {4 d& w$ }5 @. [" W cCheck = id.charAt(nIndex);
# U# i7 W% }* C, M9 y$ s if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 L* Y' c" Y+ b; }4 Q! E. s { & t9 s0 M! _$ A$ U" T) c( W3 g
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
4 ^8 t( l, [# n3 `, Z) T document.sform1.id.focus();
- z( b y* k+ S* H6 Q: p2 v return false; 7 X4 E1 V* v4 B o8 M7 F
} # H' W( ]+ \$ y/ ?) W1 O
}
4 a; h& k/ n: }! I) r- G chineseid = document.sform1.chineseid.value; * }3 i' g. T& `% c# u5 ~
if (chineseid == "")
; z6 g6 B/ y9 a2 Y( \ {
1 v9 O3 I+ A5 i3 D$ t# o6 [" ] alert("请输入中文昵称");
/ Y: d/ i& L+ Z7 r document.sform1.chineseid.focus(); * _% g2 _7 v) J1 V
return false;
8 y& O# K0 O; C. h8 P. q } 1 R2 f' O) o! l6 c
password = document.sform1.password.value;
, O- | A/ ^' Z2 b7 z# e if (password == "") 3 {- W: B) e1 \
{
% g7 p0 p! ?( {4 |7 j2 } alert("请输入登陆密码"); 4 Q( a0 F6 V8 t2 r3 @& {
document.sform1.password.focus(); ; a( o. R7 c, q9 V1 O) f* {( c
return false; * f |6 O; O' Q+ Q% T' d0 b+ ~
}
2 Z. Z( q) Q! p. l. z password1 = document.sform1.password1.value; 5 B+ V1 _! S# `4 c
if (password>password1) # t1 Y9 T9 z8 p$ u" E
{) b `( X/ e; a/ e; R0 S
alert("重复密码与登陆密码不相同"); & P2 e4 E, j2 R/ Z N
document.sform1.password.focus(); * n* P) P# ]) s5 V% W A- v
document.sform1.password1.focus(); # ?7 w+ u' L# `+ _( Q0 Y8 V5 y
return false;
. L3 Y1 O$ K9 D- [! Y: ` } * f; z1 k- ?4 h& f7 m- ^; I
if (password<password1)
7 f: J I0 O) d; n {
! U/ G4 v1 x! b8 c3 ^4 o alert("重复密码与登陆密码不相同"); " _* `' d8 o8 h2 b5 N
document.sform1.password.focus();
Y' i2 x9 ?8 k+ D% M, p/ G H document.sform1.password1.focus();
4 q; D0 o2 \2 Y/ K% E/ w return false;
Q1 f" [: S# C% d# D9 C }
4 e9 I |5 {- F" v' g if (document.sform1.email.value == "") % o0 C5 @4 W; f$ a
{ , ~! R: t/ s% Z( U6 `! d3 G8 P
alert("请输入您的E-MAIL地址");
7 u6 _! e" P0 Z2 _ document.sform1.email.focus();
$ w6 m" t9 P# y1 j2 ]4 f% D; \ return false;
2 d+ w2 ^7 v, v- u* h/ e } 3 ^6 [2 ]9 k" E: H+ D X) J
% J, H5 `0 r# s3 f
email=document.sform1.email.value; & X% _+ a7 I1 Q. M+ ]# A1 Z
emailerr=0 % ~. k# v, {" z6 v5 C" [! X; B O% P) c
for (i=0; i<email.length; i++) % s& p* f7 E" @/ w3 i3 v, U
{ $ L) \. Z" j C! u' v
if ((email.charAt(i) == "@") & (email.length > 5)) - j- G: j, d& `0 n5 h3 z/ E* b
{
% \7 F- B: V6 B8 x% ^: e2 t emailerr=emailerr+1
3 g& d" m0 @: W% N) [. s& x } ( y: @2 h @7 ~9 y! b4 j
} ( q1 W3 p8 x" x1 X( T- g8 a
if (emailerr != 1) " B1 k1 ^( ?6 j/ F# L" @
{ - T8 {5 T/ Y T( f" g
alert("请输入正确的E-MAIL地址");
8 u+ X5 C1 `0 \* A3 I* d& l7 M# X document.sform1.email.focus(); , s$ @2 V0 R& R
return false; 6 {! A+ I+ h1 h( ~
}
4 s S `/ k% ]# o/ k* Q
0 S/ _/ n! c& I9 ~/ t/ ] if (document.sform1.checkask.value=="")
7 D9 j2 ~. m" Q1 y r1 L { ; Q+ x9 |+ N! j% A0 W5 x& z
alert("密码提示问题不能为空");
, `$ Y _: h: G: R document.sform1.checkask.focus(); $ I8 h, ]- p x
return false; / Z9 l' h; r/ }6 X( [9 {3 h
}
: F. q* S) ^5 u& r# J8 ? if (document.sform1.checkans.value=="") 3 x* O6 T6 }! Z+ _
{
, r& ~( x: s( s. h) o+ @% M- B2 v alert("您的密码提示问题答案不能为空");
% |/ V& y; f2 f/ J3 E document.sform1.checkans.focus();
# ? n7 v/ g2 H8 W( t& | return false;
; M1 v; L7 \4 l6 P: W) [+ U }0 r% ?% F! P4 I( J2 A2 d
return true;
8 Q3 j! z" W% b8 f4 F
7 ~( f6 u' K8 C* d9 a3 w% }} 7 Z# B1 ^7 l- ~9 D `
</script> |
|