Board logo

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

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

//修改宽度  @; x, Q( g6 B& v& c, e$ x) W4 f
var marqueewidth=300. m# P1 X6 {) l' O# N# Y8 G- V
//高度, ~( V: N. H6 P8 g! i  Q) q- f
var marqueeheight=25% X1 _% S7 H) C. b4 l* s
//速度(1-10): u( R( D$ N1 M4 T3 J
var marqueespeed=3
& N+ f6 D0 E: P//背景颜色
! A& d( Y3 A$ mvar marqueebgcolor="#FFFFFF"; i: G- {- |. e; b1 K
//是否能暂停 (0=no. 1=yes)?
. S  a/ {- a2 U3 g1 f. l- y+ |var pauseit=1
$ k0 }  P& M0 @5 m1 C0 }
) I! c, Q5 f% B7 [( ^( P//修改显示内容
4 k% }; L- h- L1 Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. |- H0 \9 N0 L# x  M9 T3 M- m
$ j9 J* H0 Z. u, R4 u, j7 ~/ O. E; |7 Q, k
////下面不需改变////////////
# ^' N, q: F6 H# X7 |  ~- B9 D5 [5 Z* \
var copyspeed=marqueespeed
* i! U' ?+ F, V* C5 I9 N5 Gvar pausespeed=(pauseit==0)? copyspeed: 0
/ [# r% ]+ v; ~4 d: F& p2 X/ a, Tvar iedom=document.all||document.getElementById- B9 s) x  m* G  i! O7 D
if (iedom)( e& ?: }, r5 y/ ~4 ]4 L* |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 W: m1 V+ R+ W' `7 D4 K1 Kvar actualwidth=''2 A7 h' I1 I$ s! }8 u7 X
var cross_marquee, ns_marquee/ [8 _+ M: p  l' G3 ]. W6 q

4 R" n& e0 Q1 _+ A; N1 pfunction populate(){
& ?  ~( U$ z7 n3 C2 a% uif (iedom){
; C: I4 d: T' H8 w5 V. I% Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 B. c; g3 [, F
cross_marquee.style.left=marqueewidth+8# B. Q2 i2 Q. z9 f3 R
cross_marquee.innerHTML=marqueecontent0 D/ k* ^% j: W8 r- |( e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 C6 e2 c5 h; I6 ?; p& I3 {! J9 y( |}
/ k$ \: f& V2 f# O: ~7 delse if (document.layers){$ g& N$ J7 d/ E; |$ S
ns_marquee=document.ns_marquee.document.ns_marquee2. J0 w+ u$ g4 ]) [, ~4 V
ns_marquee.left=marqueewidth+8; C0 @0 Z+ A( x; W. I
ns_marquee.document.write(marqueecontent)6 n) k, i+ ?7 G5 V+ a
ns_marquee.document.close()
; J: @: X( @: j' bactualwidth=ns_marquee.document.width
% [5 s" }  v- D; g0 |}: T) Y$ q8 X. i0 W9 @8 G! a; L
lefttime=setInterval("scrollmarquee()",20); Y( s9 h( ]+ o' Q& G
}1 f6 [7 ?! J0 V8 s% C1 w9 S; F
window.onload=populate4 A$ M  O7 q# ]: V0 Z0 R
, p+ V* U" ~3 t, H
function scrollmarquee(){
4 m0 @6 P- e" }, Y: c; E8 p% S/ pif (iedom){& p/ f* I$ h0 `% }2 @1 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, I" i: T9 m3 D, b7 @4 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 _, X& r) G! L7 Jelse
& a6 ]6 j# Q) ]: ]  c% |cross_marquee.style.left=marqueewidth+8
! V7 M6 C. U& c! c1 _( W  U5 c; o: t+ \& L
}( `6 C- A0 e1 H2 T
else if (document.layers){) m$ J2 L- M3 b- V
if (ns_marquee.left>(actualwidth*(-1)+8))
" m6 ^# m, w+ e' n' Pns_marquee.left-=copyspeed
, }. X* Q7 t. jelse, x0 ?, W7 n' N: u$ X+ Z9 Y! S
ns_marquee.left=marqueewidth+85 [; h5 Z" v/ {8 @# I
}
" C" E% d" i6 V+ D7 s}
) f; `5 h3 y0 U) x$ Q, e  x
0 [" Y' Y: r! ?+ k, A( n; Z/ Sif (iedom||document.layers){" e2 m/ K- C4 l3 E+ q
with (document){
4 n8 P9 [7 O: K3 R4 o* zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 [4 y0 k) b9 l6 I
if (iedom){
! l: j9 n1 h7 q5 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& L  `7 T2 ^4 r1 {* Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 E6 z* t3 t( _6 Q$ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" P( |6 N* I3 I. S
write('</div>')
2 F9 `3 L% q3 ?8 k$ D5 _}; d0 A, ^, L0 n) n; j+ v
else if (document.layers){3 w: G- \" d# G+ ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. z: A3 w* _0 q4 o7 X, l  L9 U" Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, ?) |/ i4 L0 U' }write('</ilayer>')1 V( |. C  Z* R% S: N6 r
}
! v- Q. m$ X5 a, P! @' Ydocument.write('</td></table>')$ ?/ q9 w( C7 }
}5 ~5 I9 ]! o$ H% z/ R# f) I" S
}( M* p7 v! b  n+ q1 K
</script>




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