返回列表 发帖

网页之跑马灯文字特效

//修改宽度" |3 c* p  |. e
var marqueewidth=300
3 `) o9 w: ]& W% g. k; ?//高度  B" D6 B  O' u6 O" F0 d! \) s2 J
var marqueeheight=25
. C1 F) k- `) e' |. ^//速度(1-10)4 ]+ I1 o7 U8 R& i
var marqueespeed=3
# }; B, \6 E: X( `7 B! K4 M' E//背景颜色
+ q% i0 t1 q4 D5 T$ r; e  kvar marqueebgcolor="#FFFFFF"
% o4 Y9 ~, G* Y//是否能暂停 (0=no. 1=yes)?
# z7 O0 U; E- c+ U# [. Ovar pauseit=1
$ V  X$ D0 \" h. \& n
( H. C5 v& f% t4 m% ?! A  L//修改显示内容2 D- F: w: F9 Y1 ~$ }0 r* _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; O/ q9 _2 K. |. S9 }2 [) A( s) Q: R9 {" w. c+ C& t. \
5 S% g0 p; P/ K( D
////下面不需改变////////////, |1 _1 B+ C8 J, T6 }  r8 }' x
4 k) Y) z6 ?6 k) R3 `( ]3 h
var copyspeed=marqueespeed
2 Z; p$ J% e' avar pausespeed=(pauseit==0)? copyspeed: 0; ?9 C" S. i0 f; Z1 T4 R8 \* B8 X$ k
var iedom=document.all||document.getElementById5 s. A) ^6 }' \
if (iedom)0 }& x% f: F, A8 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) i* l8 w, m- f8 U
var actualwidth=''
# F# k. c" b! `7 p: Yvar cross_marquee, ns_marquee
' I4 s" p6 p- p( L+ K( k" p8 f; r% x& ~" X$ u: w# y: \$ j6 x0 `
function populate(){+ d! ^* F, i) S5 }5 J* P! ?. W% A3 N8 @
if (iedom){
3 j! k* T5 I% |- n) P3 s, D& Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# G; A6 n( P8 @* i& a' F* f3 a5 x) F
cross_marquee.style.left=marqueewidth+8* E: m8 j1 ~* f& }
cross_marquee.innerHTML=marqueecontent( D, u# k! L# ~4 D# A- t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& S- l! K& l+ A. h0 l8 X- a}9 D0 N. Q* ~  C6 [9 J3 M
else if (document.layers){
, ^* `, U$ `- i! M# Z& [ns_marquee=document.ns_marquee.document.ns_marquee2
& H! q0 E! a' n8 n  L6 Ens_marquee.left=marqueewidth+8. C+ h9 h6 x2 e
ns_marquee.document.write(marqueecontent)
' j& n; s+ V* [: N% I8 h$ r: ans_marquee.document.close()
" M4 e0 k; p6 \( N4 V- z* d& vactualwidth=ns_marquee.document.width2 N: |5 w2 r0 l0 L) k3 `1 O
}
( @  F! s" N7 T9 D2 l+ `lefttime=setInterval("scrollmarquee()",20)
$ Q. v4 d/ F1 t! Z( I  G}+ C' L& H* L; e  B$ x# Z9 s: J6 W/ x
window.onload=populate2 C) E, x$ p) W" e

$ C" {8 \& b  [9 sfunction scrollmarquee(){- q+ f% V# G( l+ J/ E
if (iedom){
* r2 V- @6 E% r+ x% Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# p9 B" L% F/ J2 w; t/ J5 C& Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# t! f+ t; h9 i2 K4 r3 e4 eelse* g/ h7 Z0 [; }  p+ d7 ]" B
cross_marquee.style.left=marqueewidth+8
! c4 p8 y, Z  z2 P# }1 f3 F# b0 H7 q5 z0 ^0 a" F1 ~
}
) M9 |9 k% c* @% ?: X) Felse if (document.layers){6 [8 E/ n# }2 q& ?
if (ns_marquee.left>(actualwidth*(-1)+8))
! v) U! S# l, n3 ^9 D5 Fns_marquee.left-=copyspeed  f" h6 B$ O8 Y  L# `( ]& e
else
% F5 ~5 T" d/ P- U) Hns_marquee.left=marqueewidth+8: E3 P9 z3 f0 S; D9 J
}' _9 Z/ k& E* r* S& T8 r; l
}
) \; w8 w- d! R1 s- f1 W0 F6 n" P6 b
if (iedom||document.layers){5 x; l7 [& F6 x# ^- o
with (document){
- T$ m0 y  @% O& S$ X0 J+ _1 A  I3 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 b7 C4 I" Q& q# v  q( W: Bif (iedom){
3 E& @% C. H- Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! G7 h0 S5 |& ]; ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 V2 i7 n2 f/ s8 _1 X, w* P3 l9 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% n- q6 t7 R1 {6 C4 V1 D
write('</div>')1 ~! O( }5 u+ K5 }) \" C
}
# u! @3 m$ ]' V8 n% Felse if (document.layers){  f1 T2 d( U/ m0 M& V& S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% ^# q0 F0 \, w: i, W; z; [  b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ f3 u$ N3 S) e- \4 [write('</ilayer>')& L2 n! u, w0 b* E* i3 c
}
' k0 f( q3 \9 x2 o* `document.write('</td></table>')  G4 `' a8 P* Q! H3 h5 t# ?
}
5 h  Z" u0 S, s: {) j}2 p  k  L" a1 F3 |3 ]2 V; w
</script>

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