返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 l* w5 a% \: s1 w& L
var marqueewidth=300
: V- h2 x, R; ~//高度3 E; T6 L9 b6 L" l1 s& h+ M# n
var marqueeheight=25
6 k1 B2 j( Z+ w2 y6 e//速度(1-10)
$ `/ t9 G5 w/ m# _, g% _) z; Ivar marqueespeed=3
1 A* [# Y# k( F: S2 K//背景颜色  e& B, u( u8 k" T* A
var marqueebgcolor="#FFFFFF"9 ^% x' g" Z# u1 l
//是否能暂停 (0=no. 1=yes)?
# [! P/ t4 r% W, Kvar pauseit=1' d* J# Q6 `. [) I; X( h0 K' T
3 i5 v( m1 _3 ~7 g' ~- V- i- _
//修改显示内容, b' |* _+ Q" _$ x( G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. \# a, z$ t$ r  @9 Z

2 O& ~$ M9 k3 d: P& w2 A
: Y! Y; W7 Y5 z6 u- o6 w////下面不需改变////////////- ?9 _' G: r: [+ ?
4 h, k: ^4 Z3 v' ~+ L/ |
var copyspeed=marqueespeed* H. ]: X. Z& X6 c/ G( d( G: _# y
var pausespeed=(pauseit==0)? copyspeed: 0
) o3 H, z2 g- _7 R/ w. evar iedom=document.all||document.getElementById
& p7 ?: e8 }- \. `if (iedom)
: J1 k  y' {: ?7 z) y' l, {, @# ]0 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- v) P6 K; ?) e% e8 ~var actualwidth=''. {& V3 J1 }% @% X- ?5 H
var cross_marquee, ns_marquee; U& k: n: n& H" @- [) b

' e2 t( M) i6 _0 ]* o- Nfunction populate(){' i0 _3 ^3 i6 z
if (iedom){: n. u9 e( S9 T* v5 M- W- S/ k) Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 b: n5 }6 {/ l" Z4 a! C' T6 g9 Z0 Rcross_marquee.style.left=marqueewidth+8$ ]( {! F/ d, l3 G& h% }7 f
cross_marquee.innerHTML=marqueecontent
3 \. p6 c% K4 L9 mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# ~2 m1 S$ g7 l- O9 _' A! D
}; t  X  ~' N" e, l) t7 t
else if (document.layers){
4 u6 C# J. C1 q! V7 I! wns_marquee=document.ns_marquee.document.ns_marquee2$ q0 O; ~9 S7 Z% `
ns_marquee.left=marqueewidth+80 B' P, L& U- E
ns_marquee.document.write(marqueecontent)
. R! U' \3 x$ ~9 z! \ns_marquee.document.close()  k2 G/ h  k8 d5 s# _
actualwidth=ns_marquee.document.width
  B7 `+ v9 I. Z$ i! i}
- M! a# h0 v( Jlefttime=setInterval("scrollmarquee()",20)
- K0 a3 l8 A* I) A" m* M0 p}
( V- P4 L" m$ a2 H; Ewindow.onload=populate
. b; T; E7 S) [- L  e3 [- Y
  m3 K2 }6 K4 p$ V5 S% u2 H9 z" pfunction scrollmarquee(){
% ]  b+ m8 I) Q, Rif (iedom){
* x: b, q' r5 p6 F/ k! ^+ K5 ^* ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( {$ x- {6 U" e4 C9 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* u% f1 Q; o9 Welse- p# A8 U% W1 O7 i4 d
cross_marquee.style.left=marqueewidth+8
; s/ @. _2 p$ Z/ @6 G1 _  f
* G* B+ G! _) X" V' U% F0 {, E}
$ B) j5 d; i7 g; R2 Zelse if (document.layers){+ T& l( e" U1 ^' \3 i9 s
if (ns_marquee.left>(actualwidth*(-1)+8))+ v' l0 y9 O8 Y6 x8 ?
ns_marquee.left-=copyspeed( o% M9 `+ _; a% O, G
else
3 |5 t' c4 d  ~& S. ?ns_marquee.left=marqueewidth+8
$ ]) r- W+ R6 G}9 P. S( H$ a4 @4 L/ \
}* t" ]+ f- B5 U3 |5 j5 o% c& j% p, t. C
/ r; N& I7 X# l& W9 o4 G+ s5 P
if (iedom||document.layers){; O$ I# o9 S( z8 h5 b1 q
with (document){
0 L( {3 K! @) v! _0 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 H. C' p4 ]+ v; T# r! Fif (iedom){& S6 D+ P2 x, n- \5 n- F. w) g& l* x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 a$ M% m1 P3 D/ r. `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: S7 d& N1 J* ~4 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 m3 `# n+ B3 x. W: twrite('</div>')
/ g) e5 ^/ K1 f4 P6 q7 {  Y}
7 A0 l- V$ m+ s1 q8 `9 u/ y! A1 welse if (document.layers){
0 ]6 u7 Y( W) @+ J" nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 V( P: u5 K/ Y+ A* K) ^5 }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 H9 L- m8 S, s8 y8 i' d2 H. {write('</ilayer>')
# v  `7 {- J# i' i7 T% P2 Q- n, e}, x1 A9 ~( C, ^& G% ]
document.write('</td></table>')+ v! [- Q2 y  Q6 E* Z! H
}
% m8 }7 b+ t& X$ h" N}
% O" q( A' p' P</script>

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