|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:5 c7 t1 G$ e2 o3 k7 y8 B% |
<script language="javascript">
8 I3 Y. w4 e9 Ffunction IsDigit(cCheck) $ m \4 [. ~7 u7 \ d
{
, m, d2 @- [# k* T3 X r4 l return (('0'<=cCheck) && (cCheck<='9'));
3 [& ~% A6 C; ?) K }
& Q& |! M' h* t! L( P1 w7 t
5 t5 G3 l8 u1 i5 J- `function IsAlpha(cCheck) 7 N9 x8 u! v9 y0 }' L3 e
{ 0 L: ~0 t2 A' |, M/ Q" I2 A. U
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) $ w1 ~/ W$ J! k( z% p! U$ {
} # Y* p+ Z- [" V q! Q9 k. ]
. c4 h1 {% B# n( ]1 j- afunction IsaNull(cCheck) U' F0 d- d- n' J) E/ S8 }
{ 1 w$ n4 _) B* ?
return(cCheck != " ") # B2 C& s# X0 K) }; q. C( g n4 P
} " N! @' A/ n ^1 Y% i3 T) V& P" C
+ z1 l9 x1 k- X7 Q0 ?
function checkform() 4 X# @. H- j8 C2 i2 o3 Y
{ + ^! d' h( M( f; g( R! O, D# @
id = document.sform1.id.value; 4 N! Z- G9 @8 p
if (id == "")
3 c! V/ V7 {# R. S {
( h2 C. s6 C, r5 u/ ?# y alert("请输入注册名");
) K5 k4 }2 O$ ] document.sform1.id.focus();
, i- J7 x6 N/ ?; V" A return false; ) {4 B$ c6 A# W
}
( N" x/ u, M6 I9 f! T
l r. |% r3 F" y5 o( \0 p T for (nIndex=0; nIndex<id.length; nIndex++)
: r% h& e$ C( {1 L9 p {
}1 _7 S, |# v5 o1 `" K$ n cCheck = id.charAt(nIndex); - X; h0 ?" b- B* }; K m1 V4 C
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! Z% j% `! P7 h& h
{ \7 C- A4 W, E# F o+ M* E
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
* z8 o1 B9 v& S3 j document.sform1.id.focus();
+ s o& B; t) ]% B# C/ b' q return false; , G2 M" t" {6 t- i9 t
} * Z! w# O3 W4 ^# l6 Z5 P g
} 1 B$ y! A. ]2 w0 ~7 o
chineseid = document.sform1.chineseid.value;
Q' Y0 C5 h+ ] if (chineseid == "") : c6 u. @" ]4 h% T% z& ^; t7 }) M
{ & `* G) ?5 k' K* V
alert("请输入中文昵称"); % @; z4 G6 T% r v
document.sform1.chineseid.focus(); ! i* M- m' f) F: r" V8 {8 A# y" B- |
return false; 4 c: p, A% \0 b+ v1 g0 ^8 p7 H/ @
}
, [ K; z, G5 w password = document.sform1.password.value;
c) n% Q5 @# d8 P: ~, j if (password == "") . ?8 E, d) A2 {2 C2 Q t$ |5 p9 a
{ ( S/ h! Q& i: t' d. o6 s: f
alert("请输入登陆密码");
B7 F2 D) T z& V document.sform1.password.focus();
: K7 i C, q5 L! M9 _4 ` return false; ! Y. ^1 n5 l- [3 l
} + S" P" E3 h8 B# j- o, J
password1 = document.sform1.password1.value; ( J! ]% K6 v5 A7 v7 U0 u3 U% Z- O# I
if (password>password1) - C, H1 B- d- f5 }: }1 d* n
{0 [4 ~1 b- H) e6 D6 M
alert("重复密码与登陆密码不相同");
4 ~* i; j0 N& d document.sform1.password.focus(); * A( A( q' h2 E! t' H
document.sform1.password1.focus();
6 l8 f# C2 p* A0 L3 w) ^1 Y return false;( J6 i# b" r8 `' Q
} ! {; R5 y" s5 }1 b8 N6 B8 q: t( g
if (password<password1)
; N( X# y8 P1 V7 Y) @% m" n {7 c+ ]! a, q3 E% n; M3 g Y) \
alert("重复密码与登陆密码不相同"); : n& [" M1 { Z( w$ o X2 d2 q3 h! r
document.sform1.password.focus();
. j0 E# H; k8 f7 Y. X document.sform1.password1.focus(); 2 W& o2 g6 O6 f. n* c. t
return false;# s6 W. |6 L/ N# K: ~; B
}
* ^; E. O' M9 d& v, C2 m. } if (document.sform1.email.value == "") # U1 g# O+ T/ k
{
" E# C1 D3 C; O7 o" m9 L- \8 Z alert("请输入您的E-MAIL地址");
2 A( G. a. d0 C X- G document.sform1.email.focus();
% e0 |% V* ?1 e8 Y return false; 4 l! l1 ]3 W9 R, o/ D) V& c# C
}
- a# P% q& Y9 `0 |0 O( D. K6 O* G4 Y/ j
2 v+ j3 l3 \, e email=document.sform1.email.value; 6 \' D# I1 K2 d9 a3 N! {
emailerr=0
- b3 I+ F, C0 \8 `' i" N" x for (i=0; i<email.length; i++)
; k$ K* B1 \% ?# h {
) v' {( a5 h( Z1 y3 P R2 l if ((email.charAt(i) == "@") & (email.length > 5))
: B5 P7 c# {3 m- C8 E { - E" ]! c4 D R
emailerr=emailerr+1
: C& P F# v m7 U( b+ [9 C } , `% q% f; x) p' r
}
% R3 A* m' O# k( [ if (emailerr != 1)
; z# k: X" x; ~9 l5 ` {
9 k1 X( a# p7 m- |! y, X) P alert("请输入正确的E-MAIL地址");
2 \- Y4 _- v& q: ]! I document.sform1.email.focus();
2 L0 O' ^8 c+ T- d return false;
$ d( {. J O% Y* Q' Y } 0 R4 d1 I! Q) T$ d$ c0 x
r0 S# {' y; n' x* M: e
if (document.sform1.checkask.value=="")
2 [4 ?. v% V9 ~+ H, w% t( S' _ { # M; r+ C# {% @( i# u7 `
alert("密码提示问题不能为空"); 5 {2 p* M8 O0 Z2 j" o" L. A
document.sform1.checkask.focus();
4 S: q& Q7 C' ? return false;
8 p/ O, b6 C3 Q: y/ Q }
* ^ N" ] X, D if (document.sform1.checkans.value=="") ' u/ V. l6 G8 Q' [) o4 w$ M% f2 }
{
( q6 K4 V: |; ?5 v alert("您的密码提示问题答案不能为空");
/ q" u" A5 k7 n3 q" |, o" v document.sform1.checkans.focus(); ( O/ e/ P: A1 H3 l
return false; 4 b! v! Q0 f& A6 T1 Z
}8 x6 C- L# w: H6 m, N! [
return true;
, {0 K+ h: P6 p4 G8 B& x
1 U& {# D4 w1 H8 ^3 {9 y) `' x4 @9 K8 _} 0 Z, _8 }! H, ^+ {4 t. _! N' `4 `" \
</script> |
|