Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度# n( @% h8 B$ N. ~
var marqueewidth=300
4 b2 b; x$ a) r/ j9 ]( l9 j# O1 O% G//高度
$ X: q) J' n: b7 L  R0 Ivar marqueeheight=25
) d* Z" u1 J; S3 ~//速度(1-10)
) `. u6 x( ^+ H/ jvar marqueespeed=3
  Q+ y- O$ E/ l//背景颜色( k1 z) t2 |+ J$ G6 x1 M
var marqueebgcolor="#FFFFFF": j0 f/ q8 `! b. y. f3 K2 i& D' V
//是否能暂停 (0=no. 1=yes)?
/ `. H; f+ \- M8 J5 P1 i, k5 cvar pauseit=1
4 Y0 }- b( d/ L, X3 v8 k6 X1 m# X$ a' g
//修改显示内容4 W' U4 e. S! o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, l: Z, ~  B" v2 B+ L- h7 O& ?( I9 F# e( s5 x; @- r6 @% M

1 g" X+ }2 T  L6 m' y; W% \4 s////下面不需改变////////////6 @5 g* y- v# {1 {* p$ I

0 Q  S+ v8 _% J) R: _var copyspeed=marqueespeed
# C' K3 `( }9 {8 A# ]) m# _var pausespeed=(pauseit==0)? copyspeed: 0! `, X( E' A8 v) a* N+ j
var iedom=document.all||document.getElementById% j$ I# T0 `/ e/ z8 P8 z0 K% `
if (iedom)
$ k5 M& L8 m4 S* @/ p" H1 r! K! i& bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( W1 J7 m5 u; j+ t2 o
var actualwidth=''
: X: G4 n) ?. ^! lvar cross_marquee, ns_marquee
1 q2 D+ _$ x, g+ c$ c. X* R0 J, Q; H1 \' ]3 A1 q) x7 a# g7 X
function populate(){% E! Y& t1 h6 e7 t: |
if (iedom){
- p( ]* C, Y. Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" t0 q& ?! n) O) @+ V2 i* vcross_marquee.style.left=marqueewidth+8
( d+ P- V$ J( J6 c+ s) t; Icross_marquee.innerHTML=marqueecontent5 ~6 s" m) ^& P5 ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 _; r  l& V- e; t# p# t5 J8 Z
}& b( |, U/ N- A
else if (document.layers){2 J* ]- i1 e% a, c1 `
ns_marquee=document.ns_marquee.document.ns_marquee2! M6 q4 ]7 e2 p9 f1 k* V; g
ns_marquee.left=marqueewidth+8
4 V( m: R% F8 p2 `# F  hns_marquee.document.write(marqueecontent)
( E: g3 G0 }' Z( G6 c  O; @ns_marquee.document.close()
* d9 h4 U) x) T5 E( C9 E7 gactualwidth=ns_marquee.document.width
' ?: Z1 X3 t2 r# K}/ |8 p4 Q6 o, Y) R3 h& K0 b  O
lefttime=setInterval("scrollmarquee()",20)
* f& R7 B* I- W& J+ H  v; L}
  {: S# Y% O, O& lwindow.onload=populate" Z  `. P$ |4 R1 V3 P( D: D

9 |  b7 ]- F+ t3 w/ kfunction scrollmarquee(){
+ n8 d- \! R( k1 R. h# g$ x6 y' p* l3 Iif (iedom){
& e3 a1 u4 \' ?# S2 D: Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" a# @( D+ M& s. [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: `1 ]! \: n$ l& q2 K  w6 Q: \' I
else5 Q0 {3 L5 [/ e/ M2 Z2 P, L" `: n! W
cross_marquee.style.left=marqueewidth+8
5 q0 h5 r# a, r& o1 Q7 G. U7 f
2 k% f6 N4 H4 Q) b}
. O; |4 [: g& B9 ?else if (document.layers){
2 D5 S, L) |8 A$ ~if (ns_marquee.left>(actualwidth*(-1)+8))) X, M) U. c$ C, ^4 }
ns_marquee.left-=copyspeed
8 R- R0 l$ p% F0 e9 Eelse+ W4 b' g( M4 p5 M
ns_marquee.left=marqueewidth+8
1 p0 q9 X+ P! F, G}- E7 g. \7 N: p% W; U! }
}
" O- B% U/ D6 i" q" J9 d! c% V4 f, x  L* C+ v3 D/ p: y+ c
if (iedom||document.layers){
5 s* w2 }- V0 O& c1 Zwith (document){) {0 S1 T# u# i3 z+ e5 L$ f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ w7 `0 K# a& s( ^7 f0 }
if (iedom){
! n  _" s7 F& V0 Q0 N+ a9 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 j# {$ R/ x2 _# Y1 d$ `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* i6 y' V6 }4 }& ?% S' Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 G! j- ]) j2 j/ k3 U+ ~6 w7 Kwrite('</div>')+ [( Q* P1 R! A, m# i+ t) t
}
: L7 M  I6 ?$ x9 B# v+ melse if (document.layers){
/ h. m# \  F9 w; @" r4 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 l. ^8 \. j& z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# c- i- B  K7 z3 b; _' N! r
write('</ilayer>')
, g/ k6 j. x; y3 Z' R, [$ k' j}0 L: l: i  _8 B+ {
document.write('</td></table>')+ s: `; U! V. T. f/ u
}0 P6 |3 J( @! y' s  Z: R( g  d
}: R' X* g' K; n( j0 P) Y6 y7 i
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2