返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 {& O1 H0 ~, {, |+ g, P, L- E  Kvar marqueewidth=300
/ U, Z. ]# h& v1 ]& q; f* \//高度
& S, f* U, R; |( @0 dvar marqueeheight=25
- W* a) J. g$ V" e- F& V! `//速度(1-10)
9 a4 [' ~5 q% Rvar marqueespeed=3% W) ]) K- G3 r- H/ h: e
//背景颜色
8 h, f( g2 ^" E; z  N7 R+ W. z3 jvar marqueebgcolor="#FFFFFF"
7 N* h2 T5 u8 M9 |//是否能暂停 (0=no. 1=yes)?! [1 l8 o& b5 ~6 c2 O) \5 A
var pauseit=1( G9 v  z9 C. m+ y

# e' `2 q2 N1 \$ J& ]" M//修改显示内容/ l6 c: {" @7 r& P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 B+ c! `- o( L* B2 r
* Y3 ~# M9 J; h. u( P6 s9 M' z
. T3 [' i; g  \9 ^" {: [) c  n' Z( P' |
////下面不需改变////////////
1 e) ^5 k0 l$ n' q. h" z' N2 [) x* x: J/ f
var copyspeed=marqueespeed1 g1 M: ~7 b/ u$ {/ I( y' u% J& I
var pausespeed=(pauseit==0)? copyspeed: 0! I2 g1 o, w4 A
var iedom=document.all||document.getElementById
) L! n2 H4 V; I5 J/ Zif (iedom)
5 n0 d2 `" W, F$ k2 q9 v2 F8 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ~; C: F- A0 T& H) Z, V
var actualwidth=''
1 i  V& k+ o% z: `0 nvar cross_marquee, ns_marquee
9 ]$ Q8 P* T* ^1 L! h) H! R) Q$ U( ~3 A' H* F1 x) c3 j
function populate(){
/ _% M, |1 T7 V. k! mif (iedom){" f$ G7 E& D; O' J1 V  I# X: n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ }/ l  l: `7 Wcross_marquee.style.left=marqueewidth+8) R' Y+ C) P2 ]0 f# Z' M
cross_marquee.innerHTML=marqueecontent
8 R. m2 @+ ^  N: X$ C/ W& G1 Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& S* `* k2 k! `% c}
. R" }: q* Z1 x& y8 p- felse if (document.layers){
' l, h6 X8 V, C, _6 Z" cns_marquee=document.ns_marquee.document.ns_marquee2& N" B8 u6 l( A* \1 a
ns_marquee.left=marqueewidth+84 ~( N9 s3 q& _5 p5 X7 j
ns_marquee.document.write(marqueecontent)
- T* v& o( |( m4 ?, Gns_marquee.document.close()
7 T) e3 D& [8 ]. [3 Aactualwidth=ns_marquee.document.width
5 X, e1 r  l# g8 c0 @4 c& O  N( c}
+ I" t0 T/ D" Z$ }4 }# ^lefttime=setInterval("scrollmarquee()",20)+ W( m6 ^/ y5 Z3 L
}) L. ^$ v9 L2 s( {  F+ w$ X
window.onload=populate/ l. F) C# b4 A( K+ J+ D2 z6 s* }

7 w6 t& |4 m. x7 T9 b; s8 }function scrollmarquee(){
' |, C( I8 `' K* l- V9 Kif (iedom){
) I# G' h1 k5 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 b* C' J0 J3 `+ Y, Y% r  g# Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" N: p* {) [% B4 L, V3 X
else+ [4 X% U9 g( }! q# a
cross_marquee.style.left=marqueewidth+87 z# V, X  x' Z4 _0 E: H/ x
  L" v. I& u; Z2 t# \# M
}
( s. v' ?; _$ {+ Xelse if (document.layers){
& m7 ?4 S& r3 O* Pif (ns_marquee.left>(actualwidth*(-1)+8))- |" m5 u) i& z  B1 G; }7 g) B
ns_marquee.left-=copyspeed
! F# G" ]* `4 z4 H% C' h) c, Lelse
' e7 K+ f3 j6 K+ A% T7 Sns_marquee.left=marqueewidth+8
  M, ~- l3 z$ j4 m}
, C3 L# `6 D) g* H}0 k) q# v( W, ^; B) Y

- ?3 k1 i% l+ ^# {+ ^' }4 Eif (iedom||document.layers){6 e& y" N6 g: w) s& o7 `. e. i1 D* M
with (document){5 X* R, G4 Q$ r" Z/ Y) K8 T) p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); H  ?: ^+ ^/ c! u/ u# H
if (iedom){& @- L2 h3 `: H7 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 F) P7 g  K& E. n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ X5 U0 r& g* S4 Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ F+ U' p  F' @& V$ nwrite('</div>')
/ m* l4 T0 E; [6 }% s1 G! L! Q}$ K' |" k2 D' ^; Q
else if (document.layers){
$ P' n& i0 ^- O! P) n% Y6 z" r! Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ y. l' ]9 W6 U* H7 N; r' g, a2 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). i* a& x$ o9 B' H/ \- _9 s
write('</ilayer>')7 ^" w  v# ?  U$ W3 N. C; B
}- w5 O  R+ u# ~- c$ t/ f
document.write('</td></table>')# s) Z9 x% k- k5 f+ z+ W
}
/ j/ m8 I; w2 L5 {$ v" P: l2 w}
/ n( c  g3 S" \# a# M. I</script>

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