返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" F, B! z8 G& zvar marqueewidth=300
! I3 [) h/ c' y6 J# H% O! J//高度6 H8 F4 I$ q+ Q; S. E: a+ }. Q: h5 F1 d
var marqueeheight=25
9 D# p4 G% z  ?4 [* ?//速度(1-10)1 ]/ w2 S' i. J6 w7 q
var marqueespeed=3
; v. B. u& G% B2 y//背景颜色) T  ~8 x8 D% K7 E0 ~7 k" }& d
var marqueebgcolor="#FFFFFF": [) E7 H! {1 ], A" P6 U1 |
//是否能暂停 (0=no. 1=yes)?' t+ F- R$ X' r. z
var pauseit=17 ~& g3 R0 X5 g
9 P6 |. w' a- x2 X/ C+ ?4 {" d
//修改显示内容
& w1 G* a, _0 [. P/ T& _5 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 Y4 D3 u" D. d. j- f7 \( W; |; s# ^+ m" T
$ @" \+ J: ~' ~* G; o
////下面不需改变////////////: ~- S) E8 I- C  N! J/ [4 d. E, B
0 D2 u. J$ n" }
var copyspeed=marqueespeed4 p5 `. q" b' a7 J: r9 G, [# H
var pausespeed=(pauseit==0)? copyspeed: 0% Q( J2 P+ Q$ J
var iedom=document.all||document.getElementById
% y# p3 s% t# `8 b6 Q5 ^+ _7 \if (iedom)
% t! |& \7 s0 d2 U' [: Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# @! [/ b. z7 G6 J" d* Xvar actualwidth=''4 W4 E) e0 q% ]8 }! W
var cross_marquee, ns_marquee# p4 H  ]6 q2 S% @8 Z6 j: u( Y% v
, A7 @* I( R) L% b: Y% ^
function populate(){# X& T) r/ {6 U* i; Q
if (iedom){
  O6 Z( V  b. h/ bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# w2 N! p( G, ~' X& y: b& C
cross_marquee.style.left=marqueewidth+8
5 j  j7 F; N0 Z9 m) K8 v$ Pcross_marquee.innerHTML=marqueecontent/ B8 Z/ p3 F0 O- K# _7 n4 f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 W2 _0 I4 ~! W5 h  K4 d4 k' k
}
: \9 r, d) S, K7 Jelse if (document.layers){
3 u- T1 b9 q5 J, J' Jns_marquee=document.ns_marquee.document.ns_marquee2
2 g9 K4 ?9 G) \+ }' N" ]ns_marquee.left=marqueewidth+8
( R8 o' z- ~3 a- Rns_marquee.document.write(marqueecontent)
; S& s$ x0 }$ T$ y6 t* n2 e' Vns_marquee.document.close()
* Z) h3 U- L( J# L( hactualwidth=ns_marquee.document.width& g' d% m, G4 D+ }7 f' c3 p
}
, M7 Z1 H& Y7 X' c% k4 I3 wlefttime=setInterval("scrollmarquee()",20)
) ~; \* C2 J; w% v% n5 O}# I* d7 P- O8 v8 Q. Q& n5 H1 B
window.onload=populate
* W0 h) W% y7 S& T
6 A9 T! r% T% l% cfunction scrollmarquee(){4 o; M, G) M: m( W$ w
if (iedom){
9 d+ F; k) w6 `5 M: K9 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* w1 k% S7 h  j5 u( ^, ~8 q8 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 G, Q0 P5 ?* s% d5 v  A6 Selse
3 a% I0 q" c! `3 ^cross_marquee.style.left=marqueewidth+8! W. @6 C9 ~$ j9 y% D+ t

4 r: D% N+ t1 j  \2 d. z}2 U1 o2 b! A7 L1 x- _! S
else if (document.layers){3 i$ u) s$ C' P0 ]% E. Q
if (ns_marquee.left>(actualwidth*(-1)+8))$ L$ E7 F& j* {! d, q
ns_marquee.left-=copyspeed
- {0 F* [5 y) Pelse- z5 h+ ]4 \  D1 [/ Y% g
ns_marquee.left=marqueewidth+8
; J! R& k) d- D5 V* v1 n* d8 ~9 V}
1 p/ M9 m8 B5 H1 w# W}# u8 {' t  i+ U) Y0 u  ^2 [

- l+ q5 s4 x( V/ r* j% pif (iedom||document.layers){$ K/ @. g9 t2 H( D- t9 c( y$ r4 R
with (document){
. r% f* ]- N6 u; edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 j: k. E5 Y! `; I; I9 _
if (iedom){* O. t' a' N/ J: j, G7 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): V( f5 @* s% x# K9 m& q: U: Q! S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ }! H+ T, i- Z+ b2 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 W5 z4 m' R+ d9 Q
write('</div>')6 _0 o/ J  O1 W, P5 {$ a6 B& h
}  p+ N9 o+ [  q* h% m
else if (document.layers){
9 U# n" w5 v. ?" W' t+ n; |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% W8 }8 J3 B/ X. K, W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! A; [) m0 ~, F, I5 Awrite('</ilayer>')+ c' x5 K4 m4 R& p3 Z. b
}
$ y( I: w3 q& m7 f" m, Udocument.write('</td></table>')
( F: {* Q) b1 [% i2 L: V}, @" r  t0 P0 h3 R4 r3 v3 w( B) D
}; C8 h0 r" W# ~
</script>

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