返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ Y% t/ ~0 k1 s+ {& Avar marqueewidth=300
/ m8 M- Z6 ?3 s2 y% E8 X//高度' e' N( m3 Q9 c* C, e
var marqueeheight=25, ?9 l' a- G5 S9 `- y2 l9 p
//速度(1-10)
. ]+ Y; `1 N; h& s# gvar marqueespeed=3' ]* V6 C4 b, Q: \! M
//背景颜色
  ^! B) r5 r! a, A8 ~% Evar marqueebgcolor="#FFFFFF"
8 l! i% x& `4 }( }5 E3 s6 `//是否能暂停 (0=no. 1=yes)?" |0 f; W7 V& t( X' y9 b& i
var pauseit=16 i5 P% z% l5 B2 q( |) i: A5 n
$ j; D4 Q# R2 n8 S  B
//修改显示内容( u9 a5 R5 s) U$ @' n+ J9 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 W7 }- F& k: x! m- c

" M+ j9 }+ [7 n7 ^, \. x8 u# a3 \$ E/ b1 [, c, ~0 M" a: w9 p
////下面不需改变////////////: N& O7 d, R& J. `
$ j' U8 w& p4 K- u
var copyspeed=marqueespeed1 a/ p3 |% d. N* T4 C% W" n/ N& |6 M
var pausespeed=(pauseit==0)? copyspeed: 0) @* E) `2 `4 n' F1 _. w) J0 u
var iedom=document.all||document.getElementById
9 B; |* Z' |5 a" a4 iif (iedom)
; j# E: \# G+ Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ B$ R( `- N4 n- ?+ B) m4 n
var actualwidth='': C& c  [# X* E0 n
var cross_marquee, ns_marquee. r. |) r% g: |7 c- W+ p

. K1 G! z' D, n* g3 j  k: h5 ?& Gfunction populate(){
* L& i! R! M) P7 J5 vif (iedom){
3 q1 S: Q% B% qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% p1 r! P; n/ W$ |6 `
cross_marquee.style.left=marqueewidth+8
# z1 R. i3 r/ x$ Y* a' L0 ccross_marquee.innerHTML=marqueecontent+ r3 L% Q" y4 W% _3 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ D, I5 ~. n  s: T, J+ B8 L}
1 V$ N+ x5 _1 `+ c( V0 j' w1 velse if (document.layers){
; G  m0 |6 a; \, ens_marquee=document.ns_marquee.document.ns_marquee2
2 K/ ^( i) \, {; ], y+ y" ^ns_marquee.left=marqueewidth+8
) P8 h" j3 O3 ons_marquee.document.write(marqueecontent)
. n5 Y8 H8 g& ?. j7 zns_marquee.document.close()- C3 \4 V, m- e' K" C! V: y9 j
actualwidth=ns_marquee.document.width
3 \; m! H/ I8 k8 g6 {3 D}; z( |, q. t5 ?4 I' P
lefttime=setInterval("scrollmarquee()",20)& ^. ?! ?% u! Q$ |! G4 F+ L/ E
}
1 ]  N& A* U3 J) |; ~% ~$ J/ m1 Lwindow.onload=populate
1 i$ O. w& P/ F! I: P$ \$ M2 Q0 C/ }$ j
function scrollmarquee(){
7 s- e! y+ S9 A0 y6 sif (iedom){! L& J, f5 |: ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), w5 b* i/ @& ~3 m9 K- _9 ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- q' O5 z0 k& W' l8 eelse+ t7 C" ^* O- N% M7 J- z  V4 l0 |
cross_marquee.style.left=marqueewidth+8
) X$ B/ l( ?" }
# N7 c5 P% q/ h1 H$ H; ?}
* Q& R! N% k% ~/ y9 @( qelse if (document.layers){
/ t% S$ z% C, m3 d5 {if (ns_marquee.left>(actualwidth*(-1)+8))) Q( }/ @& t$ Z; l& V' X; D
ns_marquee.left-=copyspeed" i( V2 z  l3 F
else
+ _. i4 H  x- ]ns_marquee.left=marqueewidth+8
4 x8 H! H& S5 t0 y}( R7 g; R+ d* |# i9 }. g3 d1 k
}6 [4 c* t6 h5 Z" B
" P7 N: X9 {2 n1 {0 U( ^8 U
if (iedom||document.layers){. c' Q+ l# p3 @* p  A
with (document){) H+ C* O: h4 F( P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 U3 ]: D9 Y9 ?if (iedom){
) V3 F' B% o- s* |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); t, m/ e& ~  O8 H# p1 ?9 `8 S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; k; T# l, J6 Q; m2 Y$ ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& |. W2 {0 I, I7 ?write('</div>')* l) i( G1 ~) j
}
8 u  p" c. a1 p; c6 belse if (document.layers){$ n" \) a+ z  B: O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 j- ~$ x6 b# J! F0 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ N2 l2 \5 ]: n" c+ g
write('</ilayer>')
9 R$ I8 g/ j! T7 g4 ~7 [: M}$ Z. M7 s: H7 x: `( n
document.write('</td></table>')2 H% c7 w& w4 P. T" ^6 R3 b1 }
}
" P, a- |- _- b& P# f) h}% O' N( [) n2 f4 F, D8 o
</script>

返回列表
【捌玖网络】已经运行: