返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 {; B( D+ Z2 H/ }  ^7 ]; l4 U
var marqueewidth=300! a! d/ c7 `) a9 s& p% t0 a6 u/ X- ?; t
//高度+ v% X  d, i; r* J, {; ?! M
var marqueeheight=25
" x3 s2 P( W3 _# ^//速度(1-10)
2 W, E) j6 W3 k9 ~& U: Hvar marqueespeed=3
' Z( ~  ^( X$ g6 o3 {% A( |//背景颜色6 F# T2 C9 R$ V
var marqueebgcolor="#FFFFFF"
- ^( ^! Z, D+ R//是否能暂停 (0=no. 1=yes)?
6 ]. A7 e, H- b) E+ Jvar pauseit=1
. W* E7 r5 N4 B- P4 W) \8 @  W3 u; n
//修改显示内容1 [% O6 W& W9 b  n- D( Z3 V+ P+ S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) E, j8 A8 `' N1 \& T
# }' s9 z$ N+ n, Z
1 |8 a3 j2 P7 |4 ~) E6 t2 \////下面不需改变////////////
, E4 c8 _# R6 @1 p# y
, P3 O1 b" E/ y3 K" ?' G$ avar copyspeed=marqueespeed. a) S: r$ y' U9 ^! `7 x" ]
var pausespeed=(pauseit==0)? copyspeed: 0
' L- y& k7 f$ R0 @( Y. ]) ^/ s! Ovar iedom=document.all||document.getElementById- p* v9 o3 o+ f( u1 X
if (iedom)
6 b, M( V. B2 V+ n2 d* Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 @/ y- o( N( q) X
var actualwidth=''  E5 ], v( M. @3 S$ I( O" C
var cross_marquee, ns_marquee  `( {, @# F6 i& x- j% _3 W% ^
% L; @) U! L* S# V9 q5 A# t6 v
function populate(){
& `9 \* {: J# `' Z' qif (iedom){
7 `0 R2 w; f2 B2 z) v7 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( B6 P- Y* J# w! K5 S0 }( s  J
cross_marquee.style.left=marqueewidth+8
/ x" ?( C  `8 f- I. ~: Icross_marquee.innerHTML=marqueecontent6 i2 s/ g! Y, e# B2 n) a/ h# M& B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& _! Z. e) D0 w2 A( \9 k
}
7 w5 K6 |5 V3 Z6 w# \$ X9 ^else if (document.layers){* K4 u5 }  h* k9 M" N
ns_marquee=document.ns_marquee.document.ns_marquee2
1 J+ f* h" n. J' Wns_marquee.left=marqueewidth+8
3 j9 w+ D( {4 P3 Fns_marquee.document.write(marqueecontent): n) `5 i4 W9 N% z3 U# [# E
ns_marquee.document.close()( x& m: k' p! W5 p5 U- t+ U2 q
actualwidth=ns_marquee.document.width( x9 P! v* n- t# N0 j; h) i/ N: r
}$ O5 t( \5 Y* G2 X: `% G$ n
lefttime=setInterval("scrollmarquee()",20): g( H" n: _( b! `& h" \
}9 x# W' ^* x  P" y# K0 V; |
window.onload=populate! Q! n0 L7 q: ?2 n# s7 H/ D3 y8 @
6 G5 Q5 X  u$ ]/ B4 w
function scrollmarquee(){8 I9 x. `9 o2 U
if (iedom){( a% e: ^! i- `" W! T0 b" L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ w2 k0 D- v$ _' [2 R  D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& F3 U: k0 F- A0 V' Lelse% z0 Q1 y2 _2 q$ u' d4 v. b" J. {+ B9 Z
cross_marquee.style.left=marqueewidth+8! @* n4 f8 o' t2 C* `
% P8 v4 N2 j0 p0 g' T8 W
}
( P& M7 k( A; ?' T) Selse if (document.layers){- G* t  L, e  c+ W# _4 K1 W
if (ns_marquee.left>(actualwidth*(-1)+8))
4 d4 }' P7 U, B5 {- n' R5 uns_marquee.left-=copyspeed0 }( O7 R8 e# Q( G' N
else
  x$ }7 h+ l" a4 l% g( T- kns_marquee.left=marqueewidth+82 X" o3 l# Q, o
}
) G4 B; W* y) j1 T" C- o}/ F  x8 v% j5 g/ C; C
0 r- n/ {1 i3 y) t: z2 C
if (iedom||document.layers){0 Z8 q# d4 j7 b- q1 J4 G, B" |
with (document){
* A4 u1 I0 @0 A) F9 y- D0 f5 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" a) c1 H' z: p7 L' B6 w0 h% Sif (iedom){
. X" K5 l2 p! t5 h% wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! N! g5 W# l: Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 }2 B! c0 P/ G3 a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& I) |- \) _/ J4 D: ywrite('</div>')3 ]- g9 E- v1 E/ W1 K8 [
}4 Q/ M: B' _( e
else if (document.layers){
/ f' l8 R2 z& i0 X* H# u& Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% r% [- @: `; F% M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  a1 y0 J0 P" O/ b* a- C8 e2 n
write('</ilayer>')$ O+ C; J$ O; G6 |7 Q! }* l
}
7 v4 G+ |; A/ h8 Z9 qdocument.write('</td></table>')  Q# I/ f9 {7 h5 O  G/ R
}
5 T2 O9 X7 j+ z}2 T: l2 u  X6 R- \! j* Q1 `" j
</script>

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