返回列表 发帖

网页之跑马灯文字特效

//修改宽度( j* ]0 r+ a2 l
var marqueewidth=300, P0 p" |; q8 K6 \/ H+ d
//高度; C& D9 w" }* `" R, z- R  |
var marqueeheight=25
  }& P( N# S; S2 c2 c7 d//速度(1-10)5 Y% u8 R  ?5 U$ t
var marqueespeed=3
" L8 |2 Z; ^$ W8 w/ q//背景颜色
  V. H8 Q' H6 @- q( j7 `7 t$ wvar marqueebgcolor="#FFFFFF". o+ \% ^6 y& O' m$ `  W
//是否能暂停 (0=no. 1=yes)?9 Z- C% ?) L& j& Y/ {, I
var pauseit=1* O* I% v9 z6 [8 Z0 H8 ?

8 L! h3 h8 P7 U3 Q* g//修改显示内容
, Q5 C- R& ]! C* Y5 W* R; `" v7 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! ]+ u" D* o. k; E3 M& {: D: a9 A/ E
( i; ], N% H- f! \
) S( X, n5 [8 U3 m////下面不需改变////////////7 D+ m& P/ `+ ?' q, p( \! l  x) @

: C! L: f0 m9 fvar copyspeed=marqueespeed! ^# }1 A; ~; Y
var pausespeed=(pauseit==0)? copyspeed: 0- @4 Z$ M9 N9 w. h9 H3 n: u- W  {
var iedom=document.all||document.getElementById, j) j1 U1 H0 Y; e
if (iedom)* X; `# e7 L6 a8 Z/ L1 i+ x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& M) J/ Z  q) l$ L! T" e
var actualwidth=''
- a6 R' y# ~( ^3 Q' Qvar cross_marquee, ns_marquee
5 k' f9 [% F, ~: P2 V& I) d. X
( ~5 w5 C& q- e2 u  Cfunction populate(){
& L; ]" z5 R2 A( s+ p; aif (iedom){
' @9 u7 X) v4 ]% d0 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, D  Z, c- X8 J0 ^cross_marquee.style.left=marqueewidth+80 W5 j9 |- ]) L( U+ I- {
cross_marquee.innerHTML=marqueecontent
" l7 v# H* i8 S5 o, l# ]4 Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. ]1 K/ }! d1 b3 z# X}! a3 R/ e- r1 Y% I$ G# X9 X! p/ `
else if (document.layers){" r/ J# |: J% \( e
ns_marquee=document.ns_marquee.document.ns_marquee2) N/ D/ l$ y' Y& H9 h! x( {. G  s
ns_marquee.left=marqueewidth+8
7 [# s- L) n/ c" m, }  }ns_marquee.document.write(marqueecontent)
# ~& g( p5 j  e# lns_marquee.document.close()
9 U+ n& `1 a! U5 g( i2 U2 q" J+ lactualwidth=ns_marquee.document.width- v. I* L  R( |6 i7 v4 Y( \
}. ^3 _) T8 w1 z
lefttime=setInterval("scrollmarquee()",20)' |* B4 X5 n" f2 b( L, ?
}
( ]5 m& J, U- d& c$ X: owindow.onload=populate# B3 o" ]: E3 i  Y; X3 R' H7 l) L
) X& w' d& D( _' }% G6 M2 Q
function scrollmarquee(){
3 g* h" P2 w% R) I5 F8 Zif (iedom){
# L8 T/ ?  v' q+ g9 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ ^" S1 A# `7 v: E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' S; b9 H) X' l0 ]
else
- B2 t: u$ H0 L5 X) U8 y4 f& ~) \cross_marquee.style.left=marqueewidth+8
% Q5 V( n+ H- p: e6 m
9 S5 I" _3 J8 G8 G5 r! W}" F" L2 J7 P! K
else if (document.layers){
  ~7 S( X- A  v, D1 V! |' jif (ns_marquee.left>(actualwidth*(-1)+8))5 V- a3 V8 }0 o
ns_marquee.left-=copyspeed
% X2 O- D% X1 z3 ]+ B& |else
) b& |- d: k1 h* Vns_marquee.left=marqueewidth+8
! @( W9 w$ ~6 W$ H) G, R: V}
0 L8 g0 a: q" _$ b}% Y, @% Q* \2 ~8 X. ]

' G7 ]2 `- c4 kif (iedom||document.layers){
9 q5 [5 P( {& D. y# Y7 Y( ^with (document){
7 y* J! F2 P" |. M- ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* \4 Q& }0 O% q1 r% gif (iedom){% t" }8 w0 ^8 G2 c1 d- x6 b. Q% h8 s# k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% m8 W, G: i7 Z- v0 }+ wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. l$ Z! B! z& w/ B) ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# n3 G* {. |, ]  ^- ]
write('</div>')
9 i2 q6 M% q9 O0 w}6 |( E" e4 z* f% B: s  B) E
else if (document.layers){
8 ^+ w9 s- T. A4 J0 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 V" f4 x) l7 ]' twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 `' V7 z% v+ S* Bwrite('</ilayer>')2 c% u5 y! k7 _1 I2 ]- [; }
}
8 _, G' U: Q, @5 g% n' P) J, @! t4 e( ydocument.write('</td></table>')* u1 Z* k4 b' e0 t& l
}- t9 h4 f5 @  c/ \/ l/ z
}7 s! N. }3 b5 t" j5 {
</script>

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