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

|
网页之跑马灯文字特效
//修改宽度
" n3 L( m2 B, Evar marqueewidth=300
# l4 o# h7 Y( Z, y//高度
, g2 I8 n9 k) x/ b( \* @var marqueeheight=25
* x# ^% |/ U5 T: d3 r8 y) d//速度(1-10)
6 H: U& }6 a: p8 [: Ivar marqueespeed=3 H B$ T& G$ V# V; R6 s, d5 ~
//背景颜色
$ W$ I/ W* F( A' nvar marqueebgcolor="#FFFFFF"
. R B9 d" w- _5 \- n( y//是否能暂停 (0=no. 1=yes)?
& w% X6 |$ ]& t! Y& I1 qvar pauseit=1* I7 a6 T3 c2 ~5 W" L- L
+ y. R* f4 P$ x S
//修改显示内容
4 W7 f6 k) x1 c; t; evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! K7 A: ~" b' Y) U2 j
8 A8 ^- H% w5 _. \ c9 n% t$ }
1 n" o2 u; f7 }' G* f# J V////下面不需改变////////////1 z8 n# X! u% H5 ^& i, s
2 j& l" C" Y) `' [1 o$ `
var copyspeed=marqueespeed' o; h5 M) ?3 i. Z
var pausespeed=(pauseit==0)? copyspeed: 0, \5 Q7 z% P4 _7 D/ \" E
var iedom=document.all||document.getElementById! Z. U0 ]1 I" p$ I0 W
if (iedom)
% r- a: i9 x) ]0 {. U# ^' t' Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 H( {5 Q1 o3 @var actualwidth=''' D$ e& U4 b9 v2 B0 ?: L
var cross_marquee, ns_marquee$ Z) m9 y0 K4 z, W
) A3 K; h! D7 T8 `* R- b0 o" I5 ^& Q3 [
function populate(){9 N% B- z7 e) I( M+ j7 j8 N. M
if (iedom){. V6 S# f0 B; d% K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: Z3 y& o4 k' K. qcross_marquee.style.left=marqueewidth+8
; e: P( f1 H2 P: S& x* qcross_marquee.innerHTML=marqueecontent
& E' w2 X% |5 z. x1 d* u* Y, Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 {$ f7 H% l" g# p/ H
}8 j% i$ \, l. t) C3 n' g3 E, d0 A
else if (document.layers){ K; b5 T% P% n8 s0 C
ns_marquee=document.ns_marquee.document.ns_marquee2+ S/ w& j$ _* W8 X: K0 L% Y
ns_marquee.left=marqueewidth+8& R& R- N9 d+ E- u. I
ns_marquee.document.write(marqueecontent)
% P* [! J0 z8 T- ]1 zns_marquee.document.close()
1 \: F3 p8 ~$ ~' [8 f5 O bactualwidth=ns_marquee.document.width
& X9 X% L1 r( U1 A& e* B}
& x: L( H9 _7 \& b+ llefttime=setInterval("scrollmarquee()",20): z/ T, N" S0 y2 _& e/ N5 J
}
. V6 F* _, L0 E" }5 ewindow.onload=populate k6 e3 z5 {" r
( B0 l& J u! ~9 i t/ Ufunction scrollmarquee(){' q" G( Q# I! \' G4 @' C$ p t
if (iedom){5 z: f, y7 {6 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
d$ L2 n# E2 o* Z! m8 u; d3 Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 v7 B4 X' M! O; yelse% D5 l! v- y) S! [
cross_marquee.style.left=marqueewidth+8
5 w6 U! Z2 J2 Y1 z
% l6 F8 O9 L: }: Q. U' C( y8 H}1 } s1 T$ s" M" E: F+ n
else if (document.layers){
v& [% n$ a& e0 y- G! ?- Hif (ns_marquee.left>(actualwidth*(-1)+8))
0 h' b( E, G! X( [' }: jns_marquee.left-=copyspeed
9 w* R- h* Q6 qelse$ e; S% t' Y7 `- |1 S; e& f
ns_marquee.left=marqueewidth+8+ q# O' y5 U5 ~
}8 k, {" J/ C/ Z- R4 V+ m
}0 B3 D( Q, T A
( o9 L7 T' a, h4 s# B+ V
if (iedom||document.layers){
* R {6 B# c# Zwith (document){
0 x0 e* U, t+ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 e3 S5 |% `1 h2 H6 Z
if (iedom){
8 C [& {& ~9 s' Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
[$ M4 {7 g; | o, Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 }% z8 Q8 J- }+ mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 G, C5 E C8 h; U1 d! A. \
write('</div>')3 |5 ~! J8 E' ^. _/ a
}" Y$ e+ k4 c# F, z$ p
else if (document.layers){
6 O0 q, y- \4 s5 Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 \: w9 S6 M4 L( a' e( s4 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 I) c. a( P/ f; e5 a
write('</ilayer>')
: J! ?+ N5 b9 A1 {; R}
8 I) q6 \. @ s% f+ x7 M& d( Vdocument.write('</td></table>')/ M5 q7 T' i. f0 L
}
* L) [* o4 I4 G5 t: ~" s' G: B}
5 |" h" H7 ^. x: Z</script> |
|