|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度9 w) v3 z+ c. B$ }! q/ ]
var marqueewidth=300% e/ [4 y2 u: z$ Y6 H
//高度* H" |! H8 r) u; ]3 m
var marqueeheight=25
0 y2 m: ?9 ^ D9 I6 E" h//速度(1-10)! ^$ ^) v, \) n$ ~. }
var marqueespeed=3
" s0 z3 `5 P0 `. g4 A4 q//背景颜色
2 d" J A, i: K& W0 O& x; ?var marqueebgcolor="#FFFFFF"
0 b4 q1 f2 u% P$ P8 T' v* o//是否能暂停 (0=no. 1=yes)?
( L1 N$ z7 ]5 `! v; |7 H% ~5 tvar pauseit=1# t& r+ n2 y" Z5 T+ B% ^! {
: P& Z1 ?# c* }( a- ^: q$ r @
//修改显示内容3 a2 _3 F# g' s# W# B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# S5 g, P" r5 b( N9 j [* b% s+ p
, V6 _. G) U, M0 L R3 q
- o k' R! `% Y- P% ]////下面不需改变////////////
\3 f6 E+ Q2 Z) m5 W p! @. H9 |& u' J" `# ^) u
var copyspeed=marqueespeed g' z# i: Y+ r8 e$ Z1 w, {
var pausespeed=(pauseit==0)? copyspeed: 0
1 S! h& K, Q! q; ^var iedom=document.all||document.getElementById
( q2 Q) S9 Y7 C5 X+ E) B. Bif (iedom); K/ ?# z3 c7 G0 }" b# G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 r7 D# P+ R% y" E, q: x: ?var actualwidth='' h( s% \, x8 i* _3 l
var cross_marquee, ns_marquee
) w* f; v; r4 y8 a0 w
6 z' P+ S7 Q" X- Efunction populate(){: Q# }$ U; H. M$ S1 _& l
if (iedom){
/ h. C( L6 a# X* K5 B* pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 t( Z3 t, f1 S5 ecross_marquee.style.left=marqueewidth+8* v) Y9 U5 Y+ B3 @1 `: ~6 K
cross_marquee.innerHTML=marqueecontent
; W. u3 n. b2 y5 \# K8 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 A1 p O1 O! c
}
. D1 b2 {6 x* {6 Y3 |& ~% _( zelse if (document.layers){
# W% c3 b9 [0 G8 }3 Rns_marquee=document.ns_marquee.document.ns_marquee2
( L$ f5 z) ^( b. Lns_marquee.left=marqueewidth+8
/ L5 { @7 ? h* N r4 u% ~ns_marquee.document.write(marqueecontent)* V5 M2 L$ I% B
ns_marquee.document.close()# I% l* J; S: `+ X: W
actualwidth=ns_marquee.document.width2 \/ u* k2 p7 f9 `) w9 m
}
$ J/ p: Y K ilefttime=setInterval("scrollmarquee()",20)$ G! F( K& G& D9 ^
}
* R5 l" G2 u. M# Swindow.onload=populate+ R$ S( K! o( U# ~" h! i: q
6 K, N8 \& c# q; lfunction scrollmarquee(){
$ M3 y6 c) I2 t5 U( pif (iedom){
# j! @4 B8 A3 x _& q3 S8 L2 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) W$ [7 Z! b2 C! h' e g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; j i, Q! B% u6 i W
else
/ ~# U4 p3 D1 F' P, V" Dcross_marquee.style.left=marqueewidth+81 u* c- i# w4 C- P6 p3 m) b, b
K7 G1 e: a8 r b$ v}
( q) ?" k/ \7 Q helse if (document.layers){$ U- e3 B( N3 S1 ~% M
if (ns_marquee.left>(actualwidth*(-1)+8))- x/ e* E& @7 B( I* P0 U1 V/ ?
ns_marquee.left-=copyspeed) o) L- {4 F3 ]9 n' L
else% n+ a {" d/ Q) P8 B F
ns_marquee.left=marqueewidth+8
8 m. e# Z; W) J# E' \* ]. ~}
+ u, e* `( i6 ?/ D2 B}/ d/ O: R* N4 E t
. U. f! V3 S+ h+ V6 N) V
if (iedom||document.layers){4 Y) ~' b4 u* A+ I$ {6 d% i+ o
with (document){
6 p, O, q2 _0 P$ y- r' d- odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' A, g' T4 \( |. d
if (iedom){
# [, t, f/ z* Z5 @$ V+ Q! vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( Z4 Y$ c2 ?5 B9 l1 t: Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 c; g0 l4 h3 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- l3 @- V# p4 E, I( ]0 U
write('</div>')
, G0 M/ ~5 h9 n n}
% G( K7 J, v9 L* Eelse if (document.layers){; q1 V4 ~9 ?. Q6 M7 _+ y! Q" q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* {9 t) c: C& y; V$ \; b" U6 a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 p0 a, C! i& t! c$ D2 B1 Jwrite('</ilayer>')
- w" H5 g) j- t" G% E) K}" G! P" e" P- B
document.write('</td></table>')
7 k' i6 p* V0 t- ~} M0 S, ~' I8 _( s- ?
}$ ]* e% \, r% U" ^0 U F6 v+ R
</script> |
|