返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 [, m, F3 n: @) k
var marqueewidth=300
! X4 U+ [( F0 p+ p//高度" w  z! b$ X% z1 Q
var marqueeheight=258 y2 w  q& c* Z9 d0 T7 W0 ?4 w( \
//速度(1-10)
) M3 q; K& f+ `  I' T$ i: [var marqueespeed=30 K8 j. p6 e5 _4 v) W- J& j% _
//背景颜色* [2 |; x6 W$ J  H, W3 p
var marqueebgcolor="#FFFFFF"
: J% O% i" N- h. F6 A//是否能暂停 (0=no. 1=yes)?- V( S1 F: \. ~
var pauseit=1
( p# U0 x2 J0 O9 k: m  x% }3 P& W) |8 I& O, e
//修改显示内容
# U' u: h# c; W0 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ o0 S' U+ U; @( X2 `4 n; s, b% b% R9 n* I( \
. F# }! N7 E5 G
////下面不需改变////////////& ?2 H( W" {( }& l0 ~- P

# _8 T% T3 s1 g7 Ivar copyspeed=marqueespeed) z( W/ Y2 F& j8 }. C0 L
var pausespeed=(pauseit==0)? copyspeed: 0
1 p1 S" }$ [0 W" ~var iedom=document.all||document.getElementById2 L& c8 l7 s6 e9 Y5 f' q
if (iedom)  ~+ D2 }; x9 ?+ l$ u% `/ J4 p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  k$ M( ]) p: P- A, D. ?var actualwidth=''5 c- U7 f% j* `+ g+ d; ^; ^0 b
var cross_marquee, ns_marquee
( _& U$ [9 _; p" n0 q: G! Y& N7 i7 B" @6 D& D
function populate(){
0 K5 k) ^/ a2 ^1 x* |. s) G; bif (iedom){7 b4 z- ~3 g) A2 a  c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 i& ]3 i! \4 j9 dcross_marquee.style.left=marqueewidth+8( [& Q* g' b. w
cross_marquee.innerHTML=marqueecontent3 K" S% k9 O5 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, s- \! d3 t# r9 x
}
- j3 y2 J/ x& k5 O+ Pelse if (document.layers){9 T. y1 s+ a+ {4 E8 b
ns_marquee=document.ns_marquee.document.ns_marquee2
% {* w9 f4 f: h5 Q8 \: ]% {+ [( lns_marquee.left=marqueewidth+83 ]6 o/ x) B. e3 o& N/ w, J$ ^
ns_marquee.document.write(marqueecontent)
% w8 D/ E2 U+ Z* {. P; M6 z5 Ins_marquee.document.close()/ j' ?' q2 [  ]. ], v
actualwidth=ns_marquee.document.width
& N1 u8 A# s1 @: @1 K- [0 R}+ S( i+ m5 o( ^- {& {0 _5 w
lefttime=setInterval("scrollmarquee()",20)
: l0 _. L' H* h" I}/ N# B4 u- d8 I- H2 O& D0 [
window.onload=populate9 w* e1 ~' A& d  T3 N; n6 m* e3 N. L

( s- E/ @$ ~. g1 `: ufunction scrollmarquee(){
/ y, {) p* n" ^# _, l1 W8 {if (iedom){8 O3 S: g5 u' X5 [( `2 g7 O* T1 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( q) S( @, `8 j2 j0 B% c3 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; `  S: \" k; C* q. c6 B6 kelse4 n+ R3 ~  W+ n% ^& _+ v. C
cross_marquee.style.left=marqueewidth+8
: m3 ]1 n3 u* A& q) u
; Z, V& D" Q( l9 ?}' ]7 d) c1 Z  |: c3 F& c4 c* A
else if (document.layers){* B& B. y. O) ^/ @8 K2 X
if (ns_marquee.left>(actualwidth*(-1)+8))
+ w2 b2 C$ E+ h5 ]: D. Wns_marquee.left-=copyspeed
: {/ ]6 i2 t; L% `else
5 K' V' _4 `" Ons_marquee.left=marqueewidth+8
7 @5 w7 X- H# r6 [. P}
! o4 B. o* \! x% S  K' B}
1 m) P8 E2 g0 r6 a( ]% C- w7 K
if (iedom||document.layers){
! M* Y  W7 Q4 i1 |9 rwith (document){0 O: M" ^# l4 I* D. R7 R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* I- u) l. k# Q# Tif (iedom){' `4 M* \3 R  Y8 K1 \0 u  a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) ~$ i% J( K' c5 d& B: M  ]0 nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ t0 L+ P# {+ B* X4 t6 _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, i/ q0 {- S- k  u6 r7 R4 T' kwrite('</div>')
7 \6 Z' y+ v; j0 C% r: i* A4 g}
* c/ Z/ s4 {! v' Q) n/ {; I$ M. Gelse if (document.layers){8 V5 Y% G. ^# k) s) \: c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 v0 N( T6 M( Z6 I# [5 y) ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 |( T) Q( ~. i2 b, j5 n) b* w) p
write('</ilayer>')
% `& `( q: p' M- g8 f% |" T, c}1 ]" D' G, _; ~/ K4 {- S& v
document.write('</td></table>')" N1 }7 h; \+ q( f$ @
}
3 b- A; w9 u! m+ J' A% p( @}
& L9 i6 e2 s3 B( |7 u</script>

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