返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 [( o' P6 k3 ^$ E3 n
var marqueewidth=300
, A6 K) j( b1 t5 b//高度- \. _/ r! _& Y7 r; n
var marqueeheight=25
8 ?4 a) \  k1 {$ H+ Q, S( ?//速度(1-10)
& \8 y8 ]0 W: c9 cvar marqueespeed=3/ c5 m2 m% Z7 N
//背景颜色7 {: s" V3 O5 U! o% v
var marqueebgcolor="#FFFFFF". o6 M) ^8 Z! c* j3 Z) x4 |
//是否能暂停 (0=no. 1=yes)?
0 l1 P2 g! x: V+ E$ ?8 i  Yvar pauseit=19 v: T3 P0 G3 T: J

% U6 O+ [4 |# w0 d) M% b1 h; h( b//修改显示内容
( t( U, R  W4 a+ }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- X7 S6 R5 Y- I
+ n8 y& x3 r. F& `

+ k1 p! ~) v; I' i7 I+ k* u8 G- l////下面不需改变////////////
5 A: p; e& W" i3 }7 i) R# S* ?! U+ C0 C9 i
var copyspeed=marqueespeed7 ~$ `4 W+ h# R
var pausespeed=(pauseit==0)? copyspeed: 0% T; h# l4 A# K6 ^
var iedom=document.all||document.getElementById
; Z, Y4 J; m/ t5 ^4 Eif (iedom)
7 r4 `8 A! x! z; g  Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 T; H1 W+ C. F9 Z6 Y$ q
var actualwidth='') a4 R9 a8 W% ]8 ~" Y
var cross_marquee, ns_marquee
: n+ s( d. d" A2 c; M" v
" @" s1 I, @. Z4 @9 U: H* kfunction populate(){1 O) E$ h) |5 x/ N" w+ b
if (iedom){
6 Z7 H2 o  J4 `" e2 x* e- rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% _4 {/ l7 b4 r/ o$ M; ]
cross_marquee.style.left=marqueewidth+8
; L3 k: T4 N- ^* S6 c" Ocross_marquee.innerHTML=marqueecontent1 N3 X& ~- @. ?8 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 [" |) @; R  N% {6 j
}
* U. ^  n* S' D! ?4 G. qelse if (document.layers){
, M( W0 K+ o; b; d# Gns_marquee=document.ns_marquee.document.ns_marquee2) N1 }+ ]. }9 B7 q
ns_marquee.left=marqueewidth+80 y  y; ^6 G+ g
ns_marquee.document.write(marqueecontent)
$ H; L3 V' `' k& F* W4 E4 Vns_marquee.document.close()
; ?% A! v: m/ d% kactualwidth=ns_marquee.document.width! u# N: |0 y3 |. y0 r4 y! a- ]
}; [* @' x- G1 ^) A3 o0 V* j
lefttime=setInterval("scrollmarquee()",20)
$ ^7 b2 ^! `% p}/ a* t6 |# w! O  a8 l5 g
window.onload=populate! }7 o* m2 s2 i% e

$ u; }* `+ T; B' R5 efunction scrollmarquee(){% p6 ~  {6 G& P
if (iedom){# c; P1 k7 x+ ]+ f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Y2 m, j7 a9 V1 o- p5 w6 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- u1 X7 p- F9 P8 c2 A# P3 Y" i
else
) `. `2 N9 k, _cross_marquee.style.left=marqueewidth+8
: b% ?2 a) [  ^0 T& s0 `5 k& s$ a/ w; i
}3 ~, O. H! `4 l9 R! \7 ^+ T! U
else if (document.layers){
- F: N+ X$ o5 t" lif (ns_marquee.left>(actualwidth*(-1)+8))
+ `5 i3 ^, O: H; M1 ^7 h# Ons_marquee.left-=copyspeed  {) u9 o. ~/ d
else
7 d8 {4 v7 ~1 c5 w7 n3 q/ I: hns_marquee.left=marqueewidth+8
8 W7 l& C0 \* E& K& p. ^}
' S( E- R1 t; I) i% I; ?}
% Q7 u; @: H4 L% b: J! g. {" U0 E( f  p
if (iedom||document.layers){) ^6 c! m2 M8 P
with (document){. [3 R* n. V' y! A2 R: X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" \, ?6 y' g' N
if (iedom){
, k4 c/ p0 }& p: bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 i4 S4 m0 R9 }- D: _6 K3 ^, b  Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 z) E" S" b) g/ M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( _% _- N% F9 ?5 B3 `write('</div>')6 T  P+ U- `4 Q( W7 T: M+ _
}
3 \+ N( A! Y; nelse if (document.layers){$ ~$ Q6 V9 y/ g3 E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# O9 W. i* @7 p8 v2 {/ p  S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), E7 a& n1 A' U8 O& ]4 @/ M
write('</ilayer>')
- a8 S( i1 C7 U  W}" h* ^$ }0 o1 K; T0 |
document.write('</td></table>')( b! N  r4 S) U  D  ~6 k
}
+ r. u! V1 A" @+ x8 D5 w+ {/ ]4 K) v}
& A! q0 s8 c3 {. p" G$ ^/ R</script>

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