返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- u. |2 x4 O+ w1 s4 evar marqueewidth=3008 a/ L: c* ^7 c: j
//高度
) L' {8 ~' C( ^/ g; Y5 t7 nvar marqueeheight=25, v0 R& e$ ~( ^; i/ b7 S
//速度(1-10)/ R/ G3 [1 {1 U  G6 n2 x
var marqueespeed=3
7 n" o5 ^7 @: `2 }8 `//背景颜色+ |, w: i: P" ?$ ]+ i
var marqueebgcolor="#FFFFFF"6 u! e  H/ O2 \+ R
//是否能暂停 (0=no. 1=yes)?
" S/ W9 Z7 D$ K$ N+ `var pauseit=13 p" U0 c2 o. M0 N" Z. A

4 h, D" [4 u, @7 H' c% K//修改显示内容( J0 O9 \7 D# `( z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- i# m6 v) ^0 K2 G" Z

  i* [# z/ d1 A8 D3 p- v$ `
2 X5 i- f( @) B  _////下面不需改变////////////
/ F1 V% T5 X8 H& J9 {7 T# K
$ A/ G6 P4 i5 [/ @; W) _6 |var copyspeed=marqueespeed
. I' k- \& _2 l' fvar pausespeed=(pauseit==0)? copyspeed: 0* t5 `0 S+ ?! k) R5 S) n
var iedom=document.all||document.getElementById
6 W4 E- r, q6 }8 m, I" O& C$ s/ Qif (iedom)/ Z7 K0 j$ X8 c5 k( }" g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, K4 o* l8 Q4 `$ j% Z: m1 d% |var actualwidth=''
- ~% o6 l9 X! g; T! M& Z/ lvar cross_marquee, ns_marquee
4 S0 G/ B  a% U  S1 ]; J& J  S6 s' ]' H/ m! H" `9 H2 g, I+ B
function populate(){. ~7 e$ ^, Q' Y9 G/ Y; u) q
if (iedom){
# {1 X/ J' t; O+ ]- T; jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# x$ M& g) ^, S1 F5 xcross_marquee.style.left=marqueewidth+8' ~& v/ z. w6 _: R+ C
cross_marquee.innerHTML=marqueecontent
/ @5 k2 X% d% P+ Q4 }: ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( l" q1 i3 b( u
}
: l' z% U8 J: q$ ^, p/ ]- `  celse if (document.layers){5 e: A& W; X6 w# `( U; N* A
ns_marquee=document.ns_marquee.document.ns_marquee2
1 Y/ P8 o+ o5 N! Ons_marquee.left=marqueewidth+8; y& t0 X7 L5 V/ j, F3 }/ `
ns_marquee.document.write(marqueecontent)
$ {) W9 G2 f: wns_marquee.document.close()
( F* T/ w* s. q9 @$ G9 g' K/ Kactualwidth=ns_marquee.document.width% l' S" Y9 [. q0 J# |) M
}1 p7 j7 P) G# _
lefttime=setInterval("scrollmarquee()",20)
1 h& h  s9 i+ ?. D( O5 ]}- h& B+ [, @2 `: d8 h: S" ]/ [' F
window.onload=populate
) u  b1 Y' N2 o$ E. @% ]1 o- L
1 N* V' G. d4 F7 i+ i, x* rfunction scrollmarquee(){5 y4 Z% m' e7 V$ E6 p
if (iedom){
7 P5 n" Z, Z, \: n" Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; ?+ `/ _, w$ w6 [( Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 k3 `+ r( r' V3 g5 _; x
else0 s# N4 o" F0 ^' ^4 U/ z8 L/ R. z
cross_marquee.style.left=marqueewidth+8
3 v5 ]4 |3 U  B: _+ B" X7 l  w
) k! a5 u( o$ B" U8 ]}
/ V- p, Q+ b# B8 Ielse if (document.layers){/ F0 Q. u; a. }, I) a9 A: a
if (ns_marquee.left>(actualwidth*(-1)+8))1 G& l: L( p. ^
ns_marquee.left-=copyspeed
' |" {$ ~; f+ Aelse0 ?, b" g& G2 |# g% d) K
ns_marquee.left=marqueewidth+8
! k" i+ l! h7 Z- t( h7 g}
* z* K% a) s) |* u/ H}) r7 S0 t- b) q! s! K( u% R

4 ]6 r1 |4 v9 ?if (iedom||document.layers){) B  M6 A6 B' C4 `: D+ g
with (document){/ ?' n& E4 h5 }! ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 C: c4 @; p6 M* B9 A  W
if (iedom){2 q6 A/ F/ N8 u6 v* J& e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 b' x# r2 I* u8 \( n7 g4 I7 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 p3 g* o1 s9 E: zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! _' w& F- f; T. W
write('</div>')
+ }1 c) c$ U; v! C1 \}. x6 X9 g& ^9 y) N0 b
else if (document.layers){1 `* j( N/ W0 F) w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 X9 S8 U0 P/ h0 P2 r! x( K0 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& e( X  T4 N9 q# v" x
write('</ilayer>')
3 C0 w7 d0 Z9 V+ V6 j5 |. b. u}3 u( ?9 _  h. p1 k7 z2 \
document.write('</td></table>')* m1 U" e- b. c% c' j: P" [
}
/ a) r1 y) d9 ]+ x}
1 N0 Y" o) q- T0 T; P</script>

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