|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14435
- 金币
- 2503
- 威望
- 1647
- 贡献
- 1451
|
这个脚本对你可能有帮助:
/ {; f1 |1 H5 t7 N9 g<script language="javascript">
3 }% o! p. B: P0 }( `function IsDigit(cCheck)
" q& {7 ~$ [* Q9 o; c/ @% B { 1 s1 H& U# ?, f# f. y
return (('0'<=cCheck) && (cCheck<='9')); 6 r! p* l' [8 g0 E( X
}
6 i. n7 p/ ^/ W; p- Z. x, j
' ^# V8 t9 U' g6 C. X# Sfunction IsAlpha(cCheck) # b- k$ [1 j# k2 P, }- \ t+ y
{ 0 z- a+ }, B( u+ ]- h6 U, G* X
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 }0 h& j" z) x- }
}
# [, u7 ? |" @; g + V4 ~5 k% y6 o( @
function IsaNull(cCheck)
5 x- i p. S) R. K( z; E) D& I { ) u, I# v2 ~( X
return(cCheck != " ")
9 L }: }" | D } 9 b# ?: u% w+ ^) {1 b3 c
! ]# E4 a$ r8 n. T' L& X/ A! G1 j+ o
function checkform()
8 ^& L4 v% L" O, ]. N$ F! M: d{
! N! A' w c- z, y" H8 v id = document.sform1.id.value;
& | y& J, f& e* n: {% z if (id == "") 7 _+ o4 T2 h& \6 _
{
4 n1 q' M- `/ b3 N alert("请输入注册名"); 1 y1 r& s9 G' X0 b/ {8 k) o" M
document.sform1.id.focus(); ! T+ J* s1 [9 \3 q6 |5 G
return false; ; ^! T0 Z% `6 x4 Q, g
} & n# U% w8 k' r6 f% N* o
0 i. f$ z) D1 @0 h for (nIndex=0; nIndex<id.length; nIndex++) ; w& C' X. `8 a- I
{
( s1 B- r( w g1 j/ D ]: W* @ cCheck = id.charAt(nIndex);
8 i+ ~4 \/ w; Y1 P8 m if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 6 M6 F" x8 Z$ ?8 p- c, I
{
# D' p d' q! Z+ m' W! h1 i% O alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
& |" K9 J1 p; H+ V/ `8 C7 b# U document.sform1.id.focus(); ( S: f e) C5 n; W- L7 C
return false;
+ W- b: |$ a: W3 I } 4 H7 A" c0 `' K& d
}
2 \2 ^) h5 W' a4 G! P chineseid = document.sform1.chineseid.value;
) {& w9 Q+ z# Y5 N8 K- q8 h if (chineseid == "")
) p* M3 x! i7 C* o) X {
5 h% p! s: W" {4 _/ e! H alert("请输入中文昵称"); 3 I8 w2 H3 \% Z* P# J
document.sform1.chineseid.focus(); ) Z) f) T+ G! ~
return false; & `) _) ?( ?" y1 K& d* n) o
} ) J- H4 Q+ U. O
password = document.sform1.password.value;
9 N3 U) H& }% A3 H# w& M' W if (password == "")
' S l$ Q7 }. W8 O+ G+ S% B {
$ F" ?8 u# p/ A; R$ d; f* p* F7 p alert("请输入登陆密码"); . i6 P3 T$ d. z d' u9 w; w+ v8 B8 o
document.sform1.password.focus();
+ F9 v! Z: K" E1 V return false; / ^$ O. l/ Z0 K U( N0 [7 V
}
- l s# q" ]" [4 B, I2 `' @9 W password1 = document.sform1.password1.value;
1 ~; S( H, S) S3 @) w if (password>password1) ' p! d; \# V: K& v& h
{3 f+ t1 y1 E: F' m. S# f
alert("重复密码与登陆密码不相同");
6 k: X7 }3 ^- B. j document.sform1.password.focus();
: b9 \2 G% x- H9 S document.sform1.password1.focus(); ) P6 s w! {$ u" o* n# K% c
return false;
5 \! j7 E' m: ]. T }
. U, \- j9 r5 l2 [/ ^6 z# S9 Pif (password<password1)
: F" k5 z7 N! N0 R {
! k, b+ s! w) \) c7 n4 p- [8 r alert("重复密码与登陆密码不相同"); - e# ]1 F3 j- T( S
document.sform1.password.focus(); ( L# g) E! y" Z0 A* m
document.sform1.password1.focus(); 8 z: j4 y: u' L# j" u: x
return false;
9 T: E" C) a) t6 Z1 @& V' Z3 z }
2 O+ ?4 a5 q1 P. s if (document.sform1.email.value == "")
9 }6 f( D7 U. k {
$ h- S- G$ k3 D alert("请输入您的E-MAIL地址");
' z4 d& p4 u, m' Z ~; ~2 [ document.sform1.email.focus(); 6 F6 s+ u# X% K9 a; C9 u! c
return false; / C: J! Q0 M8 G( B, f" h
} 7 O3 c! f4 V/ N( V8 d! i# k G
( k7 P$ |& D( o* h) g! S& c- } email=document.sform1.email.value; : W. K0 ^1 [" Y
emailerr=0 . T& a7 V1 x3 C9 V9 K( g
for (i=0; i<email.length; i++)
4 W9 y# x# a5 w {
. x5 K: |% O4 O/ [* H7 Q if ((email.charAt(i) == "@") & (email.length > 5))
: c" p! u& m+ r- j# K { u. J( D# p. |3 ?1 S& i
emailerr=emailerr+1
/ \6 j2 u0 b, i) r$ r2 b } & A, [7 V, V) {
} . w5 E3 d. r! A5 ?( H" S D
if (emailerr != 1)
" ^2 S+ q' s% R4 c1 m2 b { : G/ @9 h) A: f+ y' F3 l
alert("请输入正确的E-MAIL地址"); 9 t" j# [- B) |% _
document.sform1.email.focus();
2 h" C3 A9 O5 l4 @/ W7 G; v$ ` return false; $ x9 f% u; q7 L
} % F, v% F4 P3 A @
' W- a+ D$ j/ Y' T% A: s( M
if (document.sform1.checkask.value=="")
8 G8 V3 I8 W- t \1 ^0 n% Y" b {
, ]" _: E) R' I4 E alert("密码提示问题不能为空");
7 \% [# {5 F6 p7 D' y document.sform1.checkask.focus();
3 @3 G# O: i8 g4 ]' w return false;
: ~0 D7 _8 Q1 t% [4 r/ g- z" Y' [5 i }
D' h3 j8 ~# z5 H if (document.sform1.checkans.value=="") 0 [5 |% _5 w0 C" \7 w& W
{
; ^% K5 L, s$ E* ^5 ^& M2 D0 h1 i$ i alert("您的密码提示问题答案不能为空"); ( z3 e0 {- M0 s# F# T
document.sform1.checkans.focus();
0 Z1 H5 G# X) Z( _& D- o return false;
- o% w3 S( q+ h! P }
: Q$ ?* E4 r7 r' S( x3 W+ E return true; * V, D& ]: H1 }% i2 b( e
& X6 w2 r& r( ?; [
}
: f4 Y* O5 z9 Z, n% E* f) t3 ^) r</script> |
|