返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 T, _! Z: K- J( x) {/ \1 W, W+ l
var marqueewidth=300
0 d% j  |0 j  f: }//高度
$ c) r3 P7 J5 avar marqueeheight=254 ]# v+ e" M+ W' V- b9 O
//速度(1-10)
# Q' F! Y) V; U& qvar marqueespeed=3
/ J" @8 x5 D3 W, b! c( S//背景颜色
7 T) h. E3 a# z# G4 \var marqueebgcolor="#FFFFFF"2 [. x/ X2 b; g: A' X" Z; n
//是否能暂停 (0=no. 1=yes)?
$ J4 n9 x* M1 P1 Ovar pauseit=1
9 f' |- t; U4 H0 F$ l2 p8 i, L9 I, ~
//修改显示内容
3 a# K+ m( s4 |% Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) V5 ]- G) h) }& X4 w, V7 Y5 y! f$ l4 o" w: U6 Z& A) }2 D
' z8 B! E; q' c8 {5 S
////下面不需改变////////////8 g0 J% ~' z; ~, t( V  p
, F- }$ _* O* J
var copyspeed=marqueespeed
& D( y+ H$ ^; ?- \var pausespeed=(pauseit==0)? copyspeed: 0
2 b0 A4 w, s' K& o( Svar iedom=document.all||document.getElementById7 G5 k$ r2 w: \9 D) L
if (iedom)' C, v$ u& \& {2 M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). v& ^; v  M9 R! Y/ W- ^" G' c
var actualwidth=''
6 H8 w6 K+ p' n- Q$ Ivar cross_marquee, ns_marquee3 E9 H9 d* X1 R5 \
5 m1 M- I$ I+ J# W
function populate(){# q# S7 i8 i- m+ V4 r5 Q
if (iedom){. a! |; y- G" Y8 a! n. B* j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; e; j! P& |7 U' x* ~cross_marquee.style.left=marqueewidth+8
6 V( y. @- x" m" x3 y! `( Ccross_marquee.innerHTML=marqueecontent6 N7 f+ [" _! \: ?, H; u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 r$ }8 I6 `2 B( k& T% l/ E" Z
}
* o4 `# b' \/ z0 X5 _; W8 velse if (document.layers){
8 X) Y; b% d8 i: o* Fns_marquee=document.ns_marquee.document.ns_marquee24 w/ _& g' D% E: _' }$ F
ns_marquee.left=marqueewidth+8+ O% c% a+ L9 W& M5 ^( ^+ K
ns_marquee.document.write(marqueecontent)
+ _8 v8 I6 g/ \. |- I, E5 yns_marquee.document.close()
% c* G) M" t3 b1 Q5 |1 [, lactualwidth=ns_marquee.document.width
/ G8 [. |8 Y4 c* m/ t}! {# o% E- P# T6 ]$ K' Q0 E9 Z3 N! {: a
lefttime=setInterval("scrollmarquee()",20)# E, {; c% g; f& n
}
5 y! M1 d! I$ O4 G, }& q5 i5 [window.onload=populate
/ `- a4 N( D' L/ N+ A
4 X2 L1 j( f4 {  x/ _) S# }$ I7 nfunction scrollmarquee(){4 E6 H9 n! d' s+ P
if (iedom){
  w/ a1 d3 b( y  `7 }' y! ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! R1 T8 p* U& H% Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# V( i2 P) e* @8 W! j% yelse5 N8 s) a1 q! g; J" `
cross_marquee.style.left=marqueewidth+89 `7 ?( U6 v4 F- @/ J
0 Z1 p& b' l6 I) H0 r5 q/ z$ W+ n
}( \/ z4 |8 I- R* g: o
else if (document.layers){
6 I. _) D' H) q# Gif (ns_marquee.left>(actualwidth*(-1)+8))
  Z6 K" Z8 R- E7 J6 yns_marquee.left-=copyspeed
; @* h* {4 O. P% @# r# q2 T# k5 Welse/ G. T* T7 ?( G8 c( y
ns_marquee.left=marqueewidth+87 E8 p. ?1 p7 K9 [1 ]
}
  ~2 d; {% K# w- Q! ^" C}4 ?7 H4 x6 e3 |7 |) m( m- ]

) u& u6 C1 T) z: }if (iedom||document.layers){! u: N* k( s' j! f
with (document){
+ W% d1 c! z  edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); w' B8 c+ m" O& H8 x) U- M( K) f
if (iedom){/ `& o( L( O; O9 ]0 a; |: _  O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; }, Z" m2 v! _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 x3 w, j- u9 A  ^& e8 [! iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, s3 [  x: \9 @% l8 ewrite('</div>')- p. G& Y" u* d/ \! Z# a
}: D! l& s* W& L+ y, e8 r1 K$ b
else if (document.layers){
& C! o" c( I! @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 d, W  g3 H. _7 |8 U* J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' S1 m- f6 ~/ w1 p8 F. F3 qwrite('</ilayer>')
% c3 x* G. G, g5 l; z}
( o- @8 d. P  i, a: }4 hdocument.write('</td></table>')
6 d3 S2 n& X: J3 p; M}
+ B" M3 S% \* b0 G0 Z; Z- D1 ^, D}
% t7 p1 w) W1 [; j' h</script>

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