  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14171
- 金币
- 2376
- 威望
- 1647
- 贡献
- 1324
|
这个脚本对你可能有帮助:
1 c p+ o- M, _7 u6 H<script language="javascript"> 5 K# u- p9 W! T" [; p9 h. b; V
function IsDigit(cCheck) 1 m% ~( a' o+ b5 L( w0 { H
{ ( h; `1 f; L! ?. Y& M4 e4 C) B
return (('0'<=cCheck) && (cCheck<='9')); 9 B% H% A+ s! L% p# O2 [* u; ~ p; L
} + }! C9 C0 D' |: E
* P3 N6 H6 i% M' b! I" }$ Sfunction IsAlpha(cCheck)
& r8 V5 Z1 B ~/ t* ?3 O- d" G {
' b4 q% C4 Q+ Z0 T, g$ S return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . h& `/ ~0 f3 C+ r- M
}
" G6 ]' A. a) G) }3 G* o$ G& A + q6 Z" L) y6 Q1 u
function IsaNull(cCheck)
4 q* i$ D" k8 ?* {9 a* Z { 4 W5 ]) u- w# `, W3 h
return(cCheck != " ") 2 u. n+ y3 p& B) R
}
1 b! i( v7 n+ |% V5 d8 J 0 W1 d$ R) E, ?. ]
function checkform() ! w* m; }6 D$ G1 o8 A/ K6 ?
{
& U! n% L7 w2 Y. i id = document.sform1.id.value; / D& M& E( g% n
if (id == "") 9 `2 X5 I& O1 W
{
- x! p7 a5 U; u* l alert("请输入注册名");
2 p2 E" W5 S8 r. j3 N document.sform1.id.focus(); 9 O# F& a0 x K
return false; ! x. Z9 W' d9 c, z: W4 D' V" k$ Q5 N
}
: h) L2 H6 r2 e5 U6 D9 a " g4 n. G; I' @- G
for (nIndex=0; nIndex<id.length; nIndex++)
5 D2 b0 b3 l3 n; _- A {
2 v$ w( h/ B( ]! S( {& v cCheck = id.charAt(nIndex); ' T/ W5 L( y5 R b5 _! n
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) D" S0 S6 p; Y1 g# D" H1 g0 d
{ 1 W0 U8 _2 A; E) W! d, f7 z$ ^4 Y& F
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) A' ~2 a2 ?+ Q: q document.sform1.id.focus(); 7 M$ P9 v: K3 ~- H# Z, G
return false; ! B# n* j+ [" |7 [# a5 ]
}
& M% z' K+ {/ c4 Z6 Q; o } 8 p( E% Y3 e# p5 B
chineseid = document.sform1.chineseid.value;
! I' {6 s4 V6 e* Q9 E& h if (chineseid == "")
7 n7 O$ @: p7 ]8 d' X e- q { : [7 D R" ?* B5 C+ v I
alert("请输入中文昵称");
. o% S Q v) i" N6 K7 M3 ~ document.sform1.chineseid.focus();
/ ^/ u1 Q. l! W c return false;
/ ?( ~5 o" [8 s0 o Y8 n% A }
/ d9 s! Z3 [0 V% m# N7 M# l8 \ password = document.sform1.password.value;
: S7 C) d% R: r if (password == "") . [% A: D# ~2 z" m9 N: i3 t
{
+ `" D- r1 |9 s alert("请输入登陆密码"); 7 {- L: v, i: Y0 X( k
document.sform1.password.focus(); 6 C, v* _: f4 f) ~- A
return false; . q! z$ \( V, H* B" A
} $ W5 s) d& } p0 N
password1 = document.sform1.password1.value; 9 u9 y" F+ G) m- p& K. I! ?( \1 r+ h9 k
if (password>password1) k: m% r1 \+ D/ V' G7 ^
{1 ]% f; V+ o- S% D. Z
alert("重复密码与登陆密码不相同"); 1 l e% z0 C' `
document.sform1.password.focus(); " L3 ?4 H$ b6 G* G* D# E. K
document.sform1.password1.focus();
8 ]/ H7 q) E* j5 \0 S return false;
+ Y H: n9 d9 ?- i }
6 W, N/ r) f0 L N# N5 |. Hif (password<password1)
! w* a2 ~& c7 [7 h) \: K t {
* G3 K, C! @# V8 d alert("重复密码与登陆密码不相同");
, F( { L) e/ c% y3 @5 v document.sform1.password.focus(); 1 o% d8 R8 ~& T( Y( ^
document.sform1.password1.focus(); " ^: h: _7 [- S N( a
return false;4 O- M" d* Q5 A7 J$ L) d& M5 O
} % a9 t/ ?" }1 U9 c0 x5 m* H+ G. a
if (document.sform1.email.value == "")
- Z8 d. _8 I. W3 [- u& R { ( W. k7 i0 G, |: a* h
alert("请输入您的E-MAIL地址"); 6 }/ I' g8 f4 v" ~0 N
document.sform1.email.focus();
* x- R! l( }7 y- m7 g" k& I7 N$ J return false;
1 N3 s3 `0 Q) R2 {4 r+ C# U }
. f/ [5 o( F1 _& I $ P7 o* O% a! \3 A' a
email=document.sform1.email.value; 0 A J; C4 d, G
emailerr=0
% _0 q- N9 g$ Q) H for (i=0; i<email.length; i++)
' u; F2 u5 O7 `5 Q) | { + L$ j) Z" `) u* Q
if ((email.charAt(i) == "@") & (email.length > 5)) 5 D1 G- o {& A1 i/ ~0 `2 m3 V
{
: V( g4 K- e( T( `$ p$ T | emailerr=emailerr+1 $ y- o* P1 @; X: ~3 T: y
}
3 _5 C- ~2 ]9 \, R }
: _% S2 V6 V: f4 g0 A9 r if (emailerr != 1) 5 ?+ Q) I% @8 o: g! w/ L5 k9 i5 |" \
{ % U! D& S+ L: a1 l8 w \9 m& N
alert("请输入正确的E-MAIL地址"); & C/ h$ M5 u- d& y6 r' Q' O
document.sform1.email.focus();
# z5 t4 H% v/ j# R" x* o/ w return false; 4 H# Z7 F* o) M1 ]+ X4 n5 e
} * ^6 |3 ~* T! p7 h" v
: M" C8 ^( F, |# r+ d w/ N if (document.sform1.checkask.value=="") 2 \3 S; Z$ @6 [! v; Y
{
1 \$ x- r9 q+ W# n8 u alert("密码提示问题不能为空");
% D# `' @6 O3 w# U$ Y2 X document.sform1.checkask.focus();
5 f" c# `" \# C% z; p% B return false; 0 n/ K! I2 |* E1 X t2 v
} # }, I' L. M7 H' B) d- i
if (document.sform1.checkans.value=="") 9 ?# @! p5 E7 ?" Y5 N
{ 4 P5 D* {( K1 |4 X) U
alert("您的密码提示问题答案不能为空");
( s6 k S) m7 f( [' T2 N+ {& |8 Y document.sform1.checkans.focus(); : g0 \: X0 J! G8 L- H0 s
return false;
9 u- M+ P* i" c" ?. W3 T9 V }
' J0 |- ? ]7 x% w, g return true;
( L- P( P! B1 A. q) v) ~. C, s : N, W+ w: W. O$ B$ C: s, A8 G
} 3 R: p7 N) H q. y, g2 w( q- F2 y/ f5 Q( R
</script> |
|