返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# E- x  R0 O# U: \var marqueewidth=300* E9 |- Y- o% ^8 i1 G8 x
//高度+ P7 h8 L, \, l8 w" ?
var marqueeheight=25
# E9 |2 |' s, ~; o. Z//速度(1-10)
% C, V+ y6 _) N" U8 c' h: L  z4 E7 X4 v6 Uvar marqueespeed=3
: w( I4 \! y% C1 y# p//背景颜色- |0 x8 \- \; o
var marqueebgcolor="#FFFFFF"
9 {' \- X1 E$ x7 s9 P7 T6 j, L//是否能暂停 (0=no. 1=yes)?
$ ~" y8 ?; U7 Yvar pauseit=1% l# c# y; }6 d; \( ]$ w

$ |4 N+ ~7 c. |! E! I//修改显示内容
2 H: V3 l/ D9 I' c7 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" Q/ v' ~0 C# _6 H- H$ i. a3 A' E) J% M, ?1 j* `+ w8 V

" e; N- i8 F: s: f////下面不需改变////////////. N! N+ i* _5 g8 t6 u2 z2 j

) x7 O, R7 E' x( Y3 n9 H1 Avar copyspeed=marqueespeed2 o$ v) U' ~* [( h9 b
var pausespeed=(pauseit==0)? copyspeed: 0# b! V/ H$ X1 K$ V6 D; r
var iedom=document.all||document.getElementById
& @% u2 M! p0 j6 L; x4 \  r2 Jif (iedom)
8 e1 L2 ^- n) z1 Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  J% [& l9 A# U: @) x' L
var actualwidth=''0 ]" a' t# v& p/ \. H
var cross_marquee, ns_marquee
5 N/ _# y( [2 O7 N2 q: }1 V/ B+ L) @# |( j+ b( w
function populate(){3 O, J  J$ {% X+ x2 a* p
if (iedom){
+ H) V0 F1 c5 G; Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 }1 h0 @5 i+ \( X( d, H# g! G# \
cross_marquee.style.left=marqueewidth+8
" r, i& Z5 h- R& O" ocross_marquee.innerHTML=marqueecontent
& y- u) K7 [. a' Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 I0 T* k9 q$ T6 \* R. q) {
}. Z  H, K* ~3 x( V$ q
else if (document.layers){, M+ j; Y: R4 D5 f/ h) H4 {
ns_marquee=document.ns_marquee.document.ns_marquee2$ c- }& O2 C6 c/ y  s
ns_marquee.left=marqueewidth+83 v6 a* G$ D2 W/ ?3 b1 S" ]$ v& C
ns_marquee.document.write(marqueecontent), K- n- n+ }' S' W* l8 _# i
ns_marquee.document.close()/ [! E5 H1 w9 Q1 Z
actualwidth=ns_marquee.document.width5 D' [& Y* ~+ F# b
}
; ~% }7 b+ x$ \7 ^( clefttime=setInterval("scrollmarquee()",20)/ [9 t) @+ }7 h9 L
}
2 K% e5 b' C4 u% |4 T  c- m. c9 Qwindow.onload=populate
9 o& b! r4 @- R% S  `# _+ l, |0 I& E$ ^# g0 [7 r" s
function scrollmarquee(){) m! t& W+ @. E' r1 S+ A# X7 w5 N
if (iedom){
# M5 @# v% z( X# Z  _; Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 E5 c; Z" R0 d0 j) q/ h: d) L+ qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% X# d  O6 I, U: u6 V8 d, e, E( xelse
) x# W  V" Y; r0 v- ]" Ccross_marquee.style.left=marqueewidth+8
6 N9 h+ h; ^( |' N) L+ o
( D/ O) E/ |+ U9 }- m}, G- t9 ~( B" `6 X3 i9 `
else if (document.layers){0 U9 Y# `5 J& `- G' Z. l. ?
if (ns_marquee.left>(actualwidth*(-1)+8))
, R# z; }" @5 F$ E1 X; t2 U  V/ |ns_marquee.left-=copyspeed- u1 |  G4 a% v" t
else" D8 \) }. M9 t6 D5 |" n4 F; i$ z- n8 f
ns_marquee.left=marqueewidth+8% B; k/ Z% ]* B
}+ k* V  ^% z5 `  s
}1 I5 J) n) `: @6 A1 I$ I0 d, H
$ c4 |9 b0 j2 n+ I: W
if (iedom||document.layers){
6 R- a) W! ]1 ~" c; x: G& M+ Ywith (document){: `7 X# s1 w- c5 F+ g4 x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): X3 Q0 m2 v7 @- h1 o0 |* P& R
if (iedom){$ ~+ j$ L1 ^% i! c- P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, Z* j) l/ p0 ^9 N9 B' {& Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- F6 i- y- a: P2 [: U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, o! Q6 a/ ]1 j; s. P+ Z7 ~( Fwrite('</div>')' A: e5 d7 D& V4 A2 K" m
}
! |8 o! [8 o0 _; `' v9 h; U1 J1 O$ L0 delse if (document.layers){# `* c# v8 Q8 `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& q- \1 M5 H$ x0 Y. Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 N( b$ C) E4 J5 ~/ n
write('</ilayer>')
) V. u; S- I/ H9 k# x}
( b% w$ w7 ^1 Ydocument.write('</td></table>')
. i- A9 B6 R4 V6 |. C/ H}
* `5 J" {9 p! h, `7 f3 l% H) e}; x$ o5 r+ X  h# _* G) n
</script>

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