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

|
网页之跑马灯文字特效
//修改宽度
+ b: v9 w: J6 M* kvar marqueewidth=300: [8 V+ a& _/ x# M! v5 T* d2 k
//高度' X' R$ R- {7 j+ f5 B* o+ L
var marqueeheight=254 [( c0 [/ t C% |5 O. Y
//速度(1-10)
: e+ V! v; w7 e' ?! W3 Xvar marqueespeed=37 K i6 L: ?* l
//背景颜色
. ]; u a% I2 j* A, uvar marqueebgcolor="#FFFFFF", w9 ~0 W8 [# k _+ Z& l
//是否能暂停 (0=no. 1=yes)?
+ {" N. S% K: O: n1 }' Cvar pauseit=1
4 T; v, i" z/ ] Y: y" y' t B& O; G }
//修改显示内容
8 Z: t0 Q8 P" H8 u% B( Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 p5 t. y. e1 `7 f6 ]$ t$ j; _$ j
3 G- | @: i t* u" T/ w
& N% i0 a' R& w4 P# b$ V1 m7 u
////下面不需改变////////////
]( ?$ y: L; {' N( I5 `8 P- J& p/ ]. L- x1 L0 T( z3 G
var copyspeed=marqueespeed
% c) C: D" A9 w7 x# Vvar pausespeed=(pauseit==0)? copyspeed: 0
9 c( K, {2 T, C: q2 z* Tvar iedom=document.all||document.getElementById' u" Z* F* u, H: e
if (iedom)
% H' Q d; ]4 M8 o! c7 @& B: Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) g9 @3 Q/ D. M% avar actualwidth=''
6 O8 l) |! ~4 U. b9 u8 Mvar cross_marquee, ns_marquee$ C6 z7 e+ H. S6 Q y- A0 D+ Z/ q7 O
' Z: q7 l5 G$ ^ Q1 u( M4 nfunction populate(){% \. C/ t2 |, t: T" f W/ K: }& Y! V
if (iedom){
4 M5 r+ A D6 r2 {/ U6 k- }, ~: ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ o: k! @9 A- {$ u
cross_marquee.style.left=marqueewidth+8
( m: o n4 P# T/ |3 lcross_marquee.innerHTML=marqueecontent. C& r! b1 k; \& x6 d2 q0 G3 P. g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth j5 t4 j) o3 u4 z9 L t4 _5 }
}8 ~2 T8 A3 k4 Z( i$ t
else if (document.layers){3 s. i }" Q: A- j, X$ Z4 J8 P
ns_marquee=document.ns_marquee.document.ns_marquee2
( P: Y5 E! l& o" Bns_marquee.left=marqueewidth+8* w/ Y. i! S& g
ns_marquee.document.write(marqueecontent)
( e9 c, {) T" Dns_marquee.document.close()
6 t; R: N( C- y% O5 w6 {actualwidth=ns_marquee.document.width* y2 g. [* Y$ {( ?& }
}
S# w( v! K' C d& l, Y/ B6 |2 Olefttime=setInterval("scrollmarquee()",20)% c6 ?2 f- i* m# G+ K
}
6 z& z H' Q P+ V ]8 D% ?7 {window.onload=populate
+ x" o; f! K8 U7 c
, g1 A/ w$ ?) }5 M7 g5 ]! efunction scrollmarquee(){
+ `# {- E. \4 ~2 ]- t) g( G! Lif (iedom){
8 Z9 t2 O4 J3 l$ D, Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 v+ Y* x* U* ~3 ?& q) |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) L3 P- i, T9 C; X4 ?" m* J2 L
else
; S6 A3 Q% d" G$ J1 |& q. a/ gcross_marquee.style.left=marqueewidth+8+ p! I& l' K# K5 X* S& J
% s9 v. P8 j8 e+ M% S}
" C$ P! ?; {9 U: Z2 s: p! i) Aelse if (document.layers){& [( g$ [8 Q4 N% K$ V J% A+ Q
if (ns_marquee.left>(actualwidth*(-1)+8))6 c+ ?4 B0 P* F8 m9 M
ns_marquee.left-=copyspeed7 D$ v6 F; \6 X. d
else
$ w4 j o. C" U' uns_marquee.left=marqueewidth+85 i8 Y7 s" c" }* m
}% [6 z4 a0 ~8 C4 t
}* m' P$ g/ |( y) P
( ~$ c3 j: {! S: U; Nif (iedom||document.layers){& Y8 m6 t1 O1 g7 G& _6 n
with (document){3 V) |6 |- Z7 o0 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 d0 p, G* S, k% e; z' ]if (iedom){) t2 x( ?% M* ~9 t( t( |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 o! F# e8 ^$ w" D+ p- w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). S: @3 i3 l9 g9 P" p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# Q# }) x% H! G
write('</div>')% b1 f7 P8 Y) S* N; \
}( M2 P: @5 @7 j) K) ~; w
else if (document.layers){' b0 j$ T* x$ E# ]7 K2 D4 y& d% X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, F4 n: \% { ?4 ]1 j+ qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' s$ x' e: [& B2 Z, l0 dwrite('</ilayer>')+ I& |) r: M$ I. T8 d, m
}
) R; _& X# w: p6 n: D/ Ddocument.write('</td></table>')
6 S# V9 m1 e( N}( f t+ D/ v7 g6 M6 A
}
1 x: O4 g% P% E h& D</script> |
|