返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 k+ r" F; R! v: D/ x! B/ T% U( ?7 S
var marqueewidth=300& o$ K: D0 M$ j% |. q7 F+ F# v
//高度' j/ g, f3 F6 \' B1 L/ m$ B/ C8 Q5 ^
var marqueeheight=256 n' h1 p3 G7 r! k" {
//速度(1-10)
7 j$ G$ p# K3 v0 p, m- H! qvar marqueespeed=3
1 \* J& p; }- A" e& j//背景颜色
2 J* t+ A2 z; Z8 t- Ovar marqueebgcolor="#FFFFFF"
5 i$ t7 ]. h1 |  Y9 |5 K: g//是否能暂停 (0=no. 1=yes)?
+ p* l3 y" x! g& b3 T5 n3 Zvar pauseit=1
/ J6 w2 x/ S" J  A6 r; j: z6 l! s- ?1 M  V
//修改显示内容
/ j/ Y: C; N. o8 w3 z& Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( a2 k! r! m" }6 g# e4 \( n* U" I: A8 b9 Q) I: R) f
3 P6 o; K3 p4 y/ R  ?0 J% L/ ]0 x
////下面不需改变////////////
0 K3 x( b- h, L
7 \8 u' A2 i7 D* n$ P% [$ ?var copyspeed=marqueespeed
9 ~: }) Y. k' [( ]var pausespeed=(pauseit==0)? copyspeed: 0
' P7 E8 k$ E8 R- M9 w9 a: N4 ?var iedom=document.all||document.getElementById
6 B! X0 A" u5 `. L' i) n) W3 d; W0 zif (iedom)
( R8 b- }/ K6 g9 }) k6 Y; vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 c' `1 `, J% j- s2 ^0 N( g
var actualwidth=''  l* `+ z4 I: t0 b1 `
var cross_marquee, ns_marquee
& d  Y+ \7 M- [# T; Y3 a7 V) U* L& n
function populate(){
3 q2 V% m% L! V' p9 w7 ?if (iedom){( [1 Z- V( h+ w+ I- f. v/ K# \  Y8 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 J, l0 r* A+ P2 |2 {cross_marquee.style.left=marqueewidth+85 v' z3 o$ A4 w0 c- w
cross_marquee.innerHTML=marqueecontent5 k/ b8 }+ U) {* h. |1 [- [$ F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" p0 V  r' O" P2 h9 F: F
}
- H2 H/ o9 z# O0 Qelse if (document.layers){8 R9 _5 K! ]8 h+ J. l7 {  ]
ns_marquee=document.ns_marquee.document.ns_marquee2# W5 M* _6 D+ Q; `0 [& ^
ns_marquee.left=marqueewidth+88 U/ z, f3 M# `* q$ L  ~8 F% {
ns_marquee.document.write(marqueecontent)/ Y9 z' s7 }/ Z3 L) J) ?% }# X
ns_marquee.document.close()
9 e; e) K7 ]6 U1 T  B4 Xactualwidth=ns_marquee.document.width3 T! E3 R% Y4 Q3 y- x% R0 ^3 m3 d
}
" O. H/ _) [; g% u/ F  y1 nlefttime=setInterval("scrollmarquee()",20)
! G7 ~: e4 ~, p3 f2 @3 q( Q9 N}
! C  X! h7 w% Z" I% ~window.onload=populate
* ~( s5 Z- T; `. O% B2 ?/ D$ y4 B
# N2 z! B: c: a+ n5 h  J0 |1 efunction scrollmarquee(){* g; R( Q( A/ ~4 D2 D) u
if (iedom){, {5 Q0 C' t( B) B1 Z/ s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 f7 t& d$ K& e8 _1 {  n0 Q0 Y/ P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% I0 u- P, Q$ Z; {3 P9 ?& Uelse
1 e4 D( U0 D: i6 c0 t8 Hcross_marquee.style.left=marqueewidth+8
' _2 ~+ ]% W. u+ E
' \# k1 }+ I) n. y1 c0 x}
. r' \: K) o( O3 [! t) a: gelse if (document.layers){
" m" `3 w4 \( C; t1 c. xif (ns_marquee.left>(actualwidth*(-1)+8))  w6 Z9 ]: a$ Q5 ~5 [( `) j1 @
ns_marquee.left-=copyspeed
* T: I% p8 o% A2 k3 V  r2 Kelse
0 n7 i" {) _! S6 T7 T0 ~9 h- F, qns_marquee.left=marqueewidth+85 l' M9 ~/ r  I: B# M# I1 U8 |6 M6 ]
}/ i* P: z+ g- g3 `. w. q
}2 g3 c, |& W( U$ h
$ x5 b8 Y1 V# ^  |' s$ C5 D7 J
if (iedom||document.layers){
% O; b3 c/ h( `% o8 wwith (document){9 W1 }+ y0 D, A, `+ A: Q" m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 O. E; c2 b* u7 pif (iedom){
2 Y2 y2 E2 m9 W' l* [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 g# i. z. b( p& z* u& _0 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- M/ c7 p' t2 g) x) ]. |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" l' ?0 L  w2 S+ P$ N' a2 N3 f. R% Y
write('</div>'), T) x/ `, d: s0 p8 O: _' g; M' X& e: c
}/ O6 ?7 `/ E5 A; r# k- ^
else if (document.layers){
# v8 A+ y& A" `( C) `  _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 p* g& T) B# b$ ~$ A0 V6 A# a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 ^& i4 d: q. f# h. B6 j- m$ Rwrite('</ilayer>')1 o0 ?* j7 O, d; \2 X5 x
}. |, E3 L; T8 N$ z4 J& N3 m3 R
document.write('</td></table>')$ j4 a; E8 a# D. C$ t" P* O
}
% R4 l6 J2 M3 p% p5 Z  K}
4 Q0 Y2 C- Z# d! }6 @! {</script>

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