返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. l$ P5 {2 q$ u9 J6 g8 R5 n& {1 l% Mvar marqueewidth=300& w8 ~- n6 t8 n1 U7 S# `9 d
//高度
3 |2 Y1 `$ _1 o# j: svar marqueeheight=25
. n& O6 C( |9 m$ F* b7 N% m* H: t+ p: D//速度(1-10)' w, a9 |$ Q1 N( ^& [$ ^" i
var marqueespeed=3
6 N  E% g! G0 t5 m( t  x//背景颜色
- `6 |8 s8 N2 s- L! Avar marqueebgcolor="#FFFFFF"
3 n: B$ }. T6 P& F6 b3 |: N//是否能暂停 (0=no. 1=yes)?
( S, V! V' F2 @$ _4 C* t; Hvar pauseit=1
- w; y) V$ H) p: t2 c# s
; s3 k- \8 z1 N5 P+ M5 N( p) o//修改显示内容" K  O; O! c, e4 C# E8 k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 x6 l" Y) B" @- Q" _
0 a5 D; Y8 H4 T) k0 M$ z
( R0 K) V* k: Q; Q" n////下面不需改变////////////
! `/ W+ o- {0 t4 \6 q+ ~- J; s  ?- k5 b- ]. O
var copyspeed=marqueespeed
6 q# \' K# |1 Uvar pausespeed=(pauseit==0)? copyspeed: 0
: x( K  S  Q4 H2 G1 T& ]var iedom=document.all||document.getElementById: N2 M  M& i5 E' h0 q
if (iedom)
: e2 e  P9 T; ]/ z! P6 d0 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* C" W& n0 J+ F/ T  w$ rvar actualwidth=''
$ K2 E0 z5 a( ^4 W- Jvar cross_marquee, ns_marquee
2 ?9 y4 N2 A2 T3 L/ F  X' U9 @1 K' Z+ R
function populate(){
1 x5 X: Z, e' i3 Dif (iedom){5 }0 l. I# j/ {# q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- f& Z( o* I% A. Z; y, Y- j) E% g5 \cross_marquee.style.left=marqueewidth+8! Z" x, r' `$ r; d  N/ C
cross_marquee.innerHTML=marqueecontent; y) C4 q" }# M4 c( {( G* r) ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 F1 w. z+ I+ _! F. |  g
}
2 K2 l$ i/ `0 g3 A+ helse if (document.layers){
8 Y+ _* F; |9 T! S. zns_marquee=document.ns_marquee.document.ns_marquee2
% C8 k/ A. p0 Q+ j+ ?ns_marquee.left=marqueewidth+8
! S* B; J. Y& w" z4 M: T  ~ns_marquee.document.write(marqueecontent)' s5 S7 M; d+ l6 u# b4 j
ns_marquee.document.close()5 S- M/ z1 l8 u+ q, b' Z& U6 N6 m
actualwidth=ns_marquee.document.width1 T4 u6 p) ~5 r  x4 a* G9 x" H
}
: h! y  b. {; ^) S8 s7 ~lefttime=setInterval("scrollmarquee()",20)
: G- K4 J( L. t5 v* _) K; c( L}
0 R  m3 Y) `4 Z& r0 y0 _window.onload=populate- F) D! C6 U: f1 e# P' ]

8 g, q* ^! d, ]) Y) h7 T. Sfunction scrollmarquee(){
8 S9 ^* ^9 Y  e9 m# `# _if (iedom){# W7 D7 d$ ~. _2 m" i) [0 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 U4 k( P) P$ a! hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 U% U* P. b/ O4 a3 Yelse9 f5 t& N8 T& M7 ~, k
cross_marquee.style.left=marqueewidth+8
0 X( H& r: i9 g9 ~* K0 n$ `9 f: |/ j
}( h8 D. E4 w/ c) V
else if (document.layers){
6 U( g! p- _) s2 y/ M! Hif (ns_marquee.left>(actualwidth*(-1)+8))# }% Y# v+ i$ C" K
ns_marquee.left-=copyspeed
( R* |: {; i0 `# q% u& Uelse
$ h* B5 f+ p! x+ yns_marquee.left=marqueewidth+8
* y! C: _: I# o8 s  b9 U- C}
7 w) |, @0 H0 X% R+ w5 ^}
, I$ W1 [% \7 C
% d9 V- i2 \. U" v# r0 V: [if (iedom||document.layers){
& ]" \0 m1 Q% M1 M0 Jwith (document){
" i% S9 u- @' @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# ]- H$ H* I' d2 }" y/ Q
if (iedom){1 ~. `& m$ ]! q, g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; O+ N* T3 \$ G4 p3 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( r& C  G) d$ R1 [6 R0 |4 L- O- E) Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), w' u3 l) Y- `$ X" s0 U) r
write('</div>')
5 ?, h8 B2 H6 m4 S+ [+ g}1 h  S1 B0 r9 o! }2 L5 U* j0 Y
else if (document.layers){, N1 X  ?7 S* j3 m& t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' w* y# M' @. z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" P" R% x7 V& w7 F
write('</ilayer>')
( _% m' i( [- {* n1 h: U3 [5 R) u}. k. A6 B2 T% W( D, t/ ~4 G
document.write('</td></table>')
9 _8 W& K: e( i* T  X}
, ?+ l: F6 y% g* O3 f# X+ |: l+ w}3 V3 L6 y/ I; R4 k
</script>

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