返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: `5 f5 F& [8 r" q+ d- ~var marqueewidth=3006 v% m" S! ?+ X4 o8 A
//高度5 }% C6 v* w3 }" i4 A7 N' d) v
var marqueeheight=25
% R- u7 C% ?) C& ~) ^! A3 }6 }6 g//速度(1-10)3 `$ a" V. q3 d0 }' O/ ]
var marqueespeed=3; `; T) r' G* N; {- I
//背景颜色
& H# l- P, E) y) ?  Zvar marqueebgcolor="#FFFFFF"9 s0 N& X. n/ C3 V; `
//是否能暂停 (0=no. 1=yes)?
+ X* m# \/ g& x! e) Fvar pauseit=1
5 ?& [" e  E5 a/ G) B: r5 n
# w( {) G% z. U3 }//修改显示内容4 d; J  f: V6 z# }2 Z1 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" w, c; l: t& Z# o- ?7 l

! F1 v1 Z( z# i2 L% [' n+ F
, J# L0 k! C  P- C% ?$ ]////下面不需改变////////////
9 P3 W- S8 k) H/ }+ @/ V
, U' r7 {/ c! }' _& H& K; |0 q$ Rvar copyspeed=marqueespeed
/ A8 R& s) {% d* D: Q3 dvar pausespeed=(pauseit==0)? copyspeed: 0) [3 D2 C7 Q9 y2 L
var iedom=document.all||document.getElementById7 A& f$ e" p' {2 D
if (iedom)  `8 `8 L  x7 ?' n$ U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 i7 A% z3 L% H2 {, w/ O5 ]
var actualwidth=''4 O9 ~  I0 V3 G1 l) s
var cross_marquee, ns_marquee  l' B' R# T/ S/ Y8 N1 d

/ X0 D& z" `- q5 kfunction populate(){# S1 M0 Q; W0 x+ b- `$ m  X" E7 M% L
if (iedom){
8 D) K- R9 \' }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 I! n7 i; g% G- zcross_marquee.style.left=marqueewidth+8
8 T2 j" ]) {, t3 D  h2 Bcross_marquee.innerHTML=marqueecontent
, E5 k, k' m5 J. B1 `. W! Z+ pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: @) u" n7 B: M# N$ e! b}7 N% b' t5 G! P  B, P
else if (document.layers){, l8 e" E- Q. R  r, x6 n* ]
ns_marquee=document.ns_marquee.document.ns_marquee27 r7 ]2 D+ l" u( W. |' |
ns_marquee.left=marqueewidth+8
# s% W, N/ t+ v0 Q* @; n1 @ns_marquee.document.write(marqueecontent)
" |# z, H" q* w' ~# Pns_marquee.document.close(). E+ x0 ]; L' w7 `8 _& f
actualwidth=ns_marquee.document.width( y9 l" j+ v  j+ P  E5 k% V" o
}
8 V% [# b7 l6 v! y, u: Nlefttime=setInterval("scrollmarquee()",20)/ ?$ D, B$ t" c- t' X0 [8 }
}
/ O" y" d% r* Z; M( O+ {# Lwindow.onload=populate
, p2 c5 K  ?5 X7 T2 q
7 z2 V5 w* W: s  Q5 H% Nfunction scrollmarquee(){# c; _' b0 C* b! u6 P
if (iedom){
! S1 n2 K0 W( R4 I( iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' V- O4 J; @2 P/ \7 g: O$ D2 M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 s4 a+ u% A' a/ W- S( }# Yelse
4 {$ [  w" {$ i! s2 S: h" Ecross_marquee.style.left=marqueewidth+8
8 M, j' B6 p$ M2 g8 [/ d
( x  L" @. h4 E: F! ?- K}
. S6 B% _' {+ w! s6 uelse if (document.layers){- ?4 C. Q! R3 c& [
if (ns_marquee.left>(actualwidth*(-1)+8))
3 [; {1 I* I1 S7 E8 S; |ns_marquee.left-=copyspeed
) |" _5 z% W$ M" b" ]else( g6 N6 Y* {- j9 |6 u: U
ns_marquee.left=marqueewidth+8: d, B) e/ O" @: z2 R
}
$ |- Y6 ^6 |) ^! n$ q7 v5 Z}
3 y9 s: \! a. J' j8 q: R7 Q% `8 L% h
if (iedom||document.layers){& G8 Y4 J/ O" P' f* g- R: B
with (document){
' U+ d1 J4 I, A  |! w& ]; x4 M# Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( y, T( b7 D6 ~. ?: g, A
if (iedom){
- U) {; D0 A. P) Z2 X* t- `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; `; d3 j) ^6 k2 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 {/ T: m; O/ w2 l  ]- B. T. Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# {* U9 T! u# [write('</div>')
5 s) X1 Y4 Z6 B9 S* w  W% f}6 b; p: l- m1 W4 K' T' n$ A# r) L8 P% k
else if (document.layers){9 O- }* ~6 i, ]) a" o! e/ e0 }9 U0 `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. j( E4 p$ r# w  }2 B, W, Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 ]2 R0 ], a% @- ]  j% U; C% k
write('</ilayer>')' ]% _5 u8 s9 _& @4 Q& K" ]! c
}! g( _, s8 o* t9 i( M, Y' ~5 p  W
document.write('</td></table>')2 L+ x, m7 ?4 \+ B) k1 G) Y
}
$ `, K1 ^+ ?1 f6 C7 {}* _" ?. j8 [0 B/ q, \0 S
</script>

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