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

|
网页之跑马灯文字特效
//修改宽度
& [- A" K* r: L+ b$ o* g) }var marqueewidth=300
( c/ E2 T& k2 t//高度" m y0 i6 E, U0 c
var marqueeheight=25: J% s H' z/ g; F0 e. A- \
//速度(1-10)
/ l. y8 j1 C4 e0 m& Ovar marqueespeed=32 J7 b @ J6 e" V/ i' n
//背景颜色6 F& P( G8 n% Q0 r Q, @
var marqueebgcolor="#FFFFFF") V7 A3 w- Y5 m$ m* s/ @1 c
//是否能暂停 (0=no. 1=yes)?
. q$ ?( I- j" Svar pauseit=1
- T) \% p2 g: l3 `) `/ { ~3 b; _& O# X& {8 q
//修改显示内容
. z# [+ L1 \4 {9 F9 F5 P6 u! [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% O: Z( Y" N% g- k$ v0 L8 e2 I" {
; `7 h5 {7 z( @2 V- f# U0 o
; |% V) c' L3 s2 U: T) s) G////下面不需改变////////////: q2 i6 H- n5 K! e
, ]5 [& ]7 |/ C! ~
var copyspeed=marqueespeed
2 R4 z. G) e+ Ivar pausespeed=(pauseit==0)? copyspeed: 0
( B' d9 D! e* Ovar iedom=document.all||document.getElementById( E/ z9 ^1 s1 y! Q5 K& v0 e. m/ m5 k
if (iedom)
; K1 _) q/ ?' u* E# ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 j0 ~& O, ?' Z( [var actualwidth=''3 [' v. f8 H: b. t5 W' h% r
var cross_marquee, ns_marquee; m P- ?$ Y( s8 Y" g% I& p1 P8 {2 {. ^
" `% O: Z( i' W' n
function populate(){6 w! P. e; D, }. K; E
if (iedom){% H" z; T4 P% I: v0 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! _; {: i: n. c# p- b
cross_marquee.style.left=marqueewidth+8
( \$ M" i& `! P0 J# Xcross_marquee.innerHTML=marqueecontent5 R& q( V8 l0 K( t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* u, M+ u4 e9 u: h p/ Y* V
}8 W+ Y* i4 o! c, E$ z
else if (document.layers){* E' K A8 D- W6 }! h% ?. v
ns_marquee=document.ns_marquee.document.ns_marquee2
_" [6 [% c/ E; I9 rns_marquee.left=marqueewidth+8
& H/ p) I7 d( gns_marquee.document.write(marqueecontent)
2 F3 p5 z+ W" {* ]- yns_marquee.document.close()
# [0 q. G- Y1 x1 I( T5 eactualwidth=ns_marquee.document.width' \5 p7 b- B7 H
}
% Z) r9 n l, @lefttime=setInterval("scrollmarquee()",20)7 @( C, |0 T. ]
}
2 j E4 x" e" {7 b Pwindow.onload=populate3 `: n( t( p* m) S
2 `; d) q3 z1 ~+ y$ j
function scrollmarquee(){" f4 E4 z! F- ^4 w: q) W
if (iedom){7 T2 m7 D0 U: B1 B; W7 z" q1 H- A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* F# b/ `. D9 d# K6 E7 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ P2 C, S* y* H& {
else
& Q, p$ q" M7 n7 Qcross_marquee.style.left=marqueewidth+8
7 o7 q. \9 c1 b5 \# b' c% V' |6 X8 p) p$ f \8 V9 M
}
$ e, y7 t- O4 D( D6 eelse if (document.layers){
- H; W2 s/ F7 h8 Fif (ns_marquee.left>(actualwidth*(-1)+8))
( o; g1 e1 a$ K8 i$ @* e" ?ns_marquee.left-=copyspeed
, `& S% L- n1 y* M3 ]7 C3 `7 _else
4 n$ C, w7 Z4 m. m- Ans_marquee.left=marqueewidth+80 d& Z# z9 M( P3 e$ S2 P9 m8 j. R
}
) @+ D* ?* U. w0 {}
0 K/ g" {( \2 G- H L: W( J5 e2 O% `
if (iedom||document.layers){- L+ @+ r2 f7 t6 f8 N" `
with (document){
5 Z+ s9 o1 z3 N- G( P( Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), b4 n9 x% n9 t- c( q& F1 s
if (iedom){ q3 S, `+ q8 E; P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 l" Q" S2 y, _1 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 T. ]. ]! @! o8 B) q- g D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 O' G. a: y5 a5 k$ J; U
write('</div>')
+ R V) z/ h* g1 D7 q2 x}! X3 l8 n6 g w9 h" i
else if (document.layers){: r9 r& S4 H6 t+ h- t- s$ D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') e; A8 q. }" K+ [6 q3 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 q M1 J" }+ L. _' D! N+ Gwrite('</ilayer>')
3 K% D3 \2 \9 u( { l0 q$ x3 M}3 z' `$ g$ e. g3 i- {9 }
document.write('</td></table>'), @, p/ H/ L. H i$ J' ~2 w |0 M
}& z8 V7 `1 B$ U& n! |, L. W
}
$ [! }7 _" N; o' {</script> |
|