返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 `+ P# n1 d# h; \% N* J
var marqueewidth=300
. i$ F% C3 s3 o2 _1 i//高度
2 t6 M$ ?- f: c+ |2 K+ ovar marqueeheight=252 q+ P* w2 Q& x
//速度(1-10)5 E1 z; U( X; M# n* Y
var marqueespeed=37 n( W' q/ C/ D) H7 S
//背景颜色' n+ `9 T- Y; R6 i
var marqueebgcolor="#FFFFFF"* {5 [! _  ?; Z0 r! `
//是否能暂停 (0=no. 1=yes)?
  ^! M- P& C" w7 A. {var pauseit=1
( n# C  a/ D, Q
# A$ Z1 ?! P% J4 c, T- G//修改显示内容
% C6 d- S) |" Z$ e: ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" Y* B% ?3 s; S1 d# L0 u

. [5 d. f0 `/ w5 c
, Q' J- N$ K( v) E" z( m////下面不需改变////////////
% g8 O' ]/ ^: }! }2 b' ]$ `) U0 {3 Y( m5 x" C* U+ P
var copyspeed=marqueespeed
) E# K" u% G) ~var pausespeed=(pauseit==0)? copyspeed: 0
+ S" I: U4 C; j+ T) Xvar iedom=document.all||document.getElementById1 s) g6 E+ u, X& L' y- W
if (iedom)
& G% Q. T8 c# Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! L( L0 K" P, v% L$ T# S4 d: c6 M
var actualwidth=''
( ]- {' B" N0 [# kvar cross_marquee, ns_marquee4 q- h# W  d" G2 z

" j5 P3 P( f8 N5 s: ?+ G" ^function populate(){
5 z6 q" O0 _3 R5 r' eif (iedom){* v6 w2 ~  Y2 K( E# y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ |+ I# @. r) v! ecross_marquee.style.left=marqueewidth+8
/ U2 w8 B) [* u' [3 k) y# b' L2 d9 J  dcross_marquee.innerHTML=marqueecontent1 J$ l8 ]1 `+ _" o; R. K' ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% m7 e; [& ?! g) j
}
* ?) c6 n+ `" \" b2 D- F# }else if (document.layers){2 _  B# W' q( \) s2 z1 C
ns_marquee=document.ns_marquee.document.ns_marquee29 H. E  |8 W0 w  Q2 p+ e- z
ns_marquee.left=marqueewidth+8
/ G% |# N2 y. a" F& Hns_marquee.document.write(marqueecontent)
& k4 z6 o' c9 t: X: x# |8 Lns_marquee.document.close()" N$ I1 S  S  F0 h4 r
actualwidth=ns_marquee.document.width
  Q7 _& `" r4 C. ?. g  X/ ?1 K% z: v}) ^% G! \* w7 }
lefttime=setInterval("scrollmarquee()",20)
: J% o1 c/ P. @! }0 @, k; O}
! V/ u7 z5 s- t6 dwindow.onload=populate
* ?) S4 P/ W4 l: B8 Y9 x! C# ^6 k) H1 _3 I0 ~# A9 m( Y
function scrollmarquee(){
1 X# H7 o4 v- r, ^if (iedom){# ?. A' o! m' m8 P, X0 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Q. ~/ ]& r2 u' m1 b& [8 u0 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 g1 m/ P1 U8 P9 r, B3 q8 C7 W2 celse
9 C0 c8 L7 u) W# J  e) }cross_marquee.style.left=marqueewidth+8! ]: \0 t6 `/ i( b& T
9 i/ g4 ?3 d3 o/ W
}5 C) t" U2 {- R% C5 j
else if (document.layers){) [) t, c# R; M5 m
if (ns_marquee.left>(actualwidth*(-1)+8))6 l* ]- m/ P) j* O9 C& K; [, {
ns_marquee.left-=copyspeed: F) c0 u* V: c) \4 k$ ~0 o6 w- |
else
! c6 U0 z( u1 A+ [/ lns_marquee.left=marqueewidth+8
3 E9 i1 u- U- H}
4 o+ O8 f& m$ a& \7 u}
4 W8 G: v' L- ~5 |8 F
6 n; G) q* a6 F( hif (iedom||document.layers){' L9 e/ Q/ f7 t
with (document){8 u; d' D# S! F& H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ n3 Q5 Y3 @. ~* H6 @/ Iif (iedom){
: w( C8 l! W: f. t( }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 p( s2 ]! ~3 v+ M4 K, @$ S$ j/ Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 T7 ^: R; q- n5 x, B5 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" w! U' K" r& F# i* F1 I  nwrite('</div>')" T) t0 [% [) b; J2 g; r2 M" O
}
% k& i9 `2 H* j8 W3 I: r; Kelse if (document.layers){
9 |1 `( G; F) I8 e/ bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 X4 a; c" V/ L* i& W2 q0 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). k8 c# f7 E, w9 e# ?; U! x) f
write('</ilayer>')2 m8 `7 K; I" R! y  F: L; @
}# z; y4 e# M& _+ o4 l
document.write('</td></table>')5 `! \5 v" Y  a0 E
}
6 \: H# S& _% K6 J, f5 X, v}' f: O( a) F: }9 A. Q* {
</script>

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