返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ Z* X' ]: x5 F- F9 |) I5 n8 Bvar marqueewidth=300
5 s; F' R( }' `% O/ P0 M* M# z//高度" a7 Z" f# C9 `
var marqueeheight=259 T' ^7 e- v$ i" m% z
//速度(1-10)
' J5 g) x1 }3 c1 L9 Gvar marqueespeed=3' x7 r0 P2 U4 i- h  V/ q: S. Q8 _6 z3 I
//背景颜色" E9 n  v* j6 Y0 [# u
var marqueebgcolor="#FFFFFF"' S+ a3 E% l3 d) F6 v4 O2 M6 o
//是否能暂停 (0=no. 1=yes)?/ f8 i; B& H) }) c) i
var pauseit=1  f( N5 P! S, t% u

1 ?" U# T( C% ~2 H2 a//修改显示内容( w) p. f/ M+ ]4 |7 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') ]9 ?9 w2 R) W/ u0 s
( l% U" h8 ?6 g/ L
7 \( h  s3 ]% i' j. \
////下面不需改变////////////
" S( {9 q- O7 o9 E. c2 ~- C
+ Z, U9 n$ ]. d: u+ yvar copyspeed=marqueespeed: L2 J; I) I2 m/ a' u5 O
var pausespeed=(pauseit==0)? copyspeed: 0
3 t0 Y, [+ H" C, \2 W/ Hvar iedom=document.all||document.getElementById  ]& c# X* i9 f3 n  l
if (iedom)  K3 w4 _# B- N3 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ?8 z, I  V( @% o
var actualwidth=''# b* J% X+ n- S. M) o8 P! N
var cross_marquee, ns_marquee
, @  K1 Q9 T7 t) U4 E( m
# k5 G% l& G$ O  I8 vfunction populate(){/ m# W5 n6 q8 D
if (iedom){
0 c1 ]( c) _% t3 F5 O+ Y2 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- u) R( h  j, P. N/ ]cross_marquee.style.left=marqueewidth+8! i2 m# S  a" n* ?5 Q  k7 O, z; v
cross_marquee.innerHTML=marqueecontent
; t7 o, X) S3 x0 G6 [& Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 E5 ^: l: S9 W7 B: I2 m5 z}: x9 ~6 |7 d. R) W: c/ M
else if (document.layers){
" }: R8 \" l& cns_marquee=document.ns_marquee.document.ns_marquee2
* j) @0 a/ p# V8 }# Pns_marquee.left=marqueewidth+8
% G3 q4 w: Q: `ns_marquee.document.write(marqueecontent)
+ v. w% D& w  X2 h2 `3 d, Nns_marquee.document.close()) g: L0 z6 h* H4 `: r
actualwidth=ns_marquee.document.width
' L" t7 e% D) N4 k1 Q8 `. b, D; r}% X& x/ S; M3 t. H8 s
lefttime=setInterval("scrollmarquee()",20)
: T" s4 q% Y9 ?( s* b}
3 L# a% Z- k1 u- |0 |' awindow.onload=populate
  V& ]# c# V3 h6 \4 e
  r1 d# E# [7 X% [function scrollmarquee(){+ C% m# H" a$ V3 f
if (iedom){
6 y. ?8 Q+ [9 U6 T$ L9 iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ @# |1 L8 d/ p$ across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 }8 A$ G4 T9 n: h: I* Y$ c
else
4 \7 X; X! j3 N' b8 ecross_marquee.style.left=marqueewidth+87 R6 U6 z, F" h7 i9 ?( w2 n# M

& k9 H* w- y# E- S: m! w}& M9 ?* y6 `- Z- h! [$ J( V
else if (document.layers){7 x  |4 t" c$ Z
if (ns_marquee.left>(actualwidth*(-1)+8))0 [* W6 K; H, S6 V9 p' M. o# I
ns_marquee.left-=copyspeed) b, c5 a$ b9 z! P
else
8 M, X+ ]9 h- v% r) U  ~ns_marquee.left=marqueewidth+8
" h- P. _9 \2 s9 [}7 C* @7 p0 V. p  Z: A7 g
}
  I1 o$ e5 U8 v2 ^2 S0 I: _. _% J$ x, O  L/ }2 L
if (iedom||document.layers){+ b( }3 l3 h) f5 M. z
with (document){
8 B" z; G2 `! j6 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# g; L" B$ |' h- g3 Z* Q( ^/ `
if (iedom){
  [7 u7 \; a, K' u4 Y" u  S- }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) r  `- M% z$ z1 D0 s, Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ r% A1 b2 R5 T9 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) S# V& a/ Y, `1 n$ ?- O& P/ j- H4 Owrite('</div>')
. @' F1 j4 _( @, m& I% `4 J2 t}. E: C& ~. Q1 _8 M5 D
else if (document.layers){# k$ }- y# B# U4 n6 Y: i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 w# g  v* Q+ ]6 f  ?6 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; v% W- b3 \1 {4 j: a, Swrite('</ilayer>')
0 W+ y! E. ]2 m1 x# H( f, X}
& z$ P' n9 U& jdocument.write('</td></table>')
# t+ D; m+ a$ e+ \$ z. M}9 ?- v4 A3 p- ^" ?
}" v- E  w3 p+ ^# X; U8 L
</script>

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