返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: A% Z. s" U1 s& G6 M# I& qvar marqueewidth=300- ]0 Y* p" w" s+ P5 S1 x! \
//高度
* Y' c- l% m, a7 d4 Jvar marqueeheight=25
, N% [0 h' T' k( ]" c& `//速度(1-10)
9 o2 v5 U+ J* Hvar marqueespeed=3
: s7 m- k  u# {, z1 a& o" \//背景颜色
) Y1 R/ m/ b" x" M8 t1 Bvar marqueebgcolor="#FFFFFF"
$ Q4 S6 T# N6 K//是否能暂停 (0=no. 1=yes)?
3 C; O" W1 Q/ B5 o' u2 Xvar pauseit=1# E5 Q; \; K. T- n& F
# a/ s$ [- h# s8 X* \" t# ]
//修改显示内容
( Q$ f, ~1 x! k9 Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; P3 w8 `, l# |
; Y+ k' o% Z0 V3 k& ^' X: x: B/ ^

/ \. n5 `' s2 m/ F3 W) Y9 B////下面不需改变////////////5 E4 d) h: s8 v( |7 u

) H) L( t' x1 z. T+ v0 lvar copyspeed=marqueespeed9 v4 o* y6 d3 J3 V6 z! I3 [; y
var pausespeed=(pauseit==0)? copyspeed: 0, W. R  ~/ n: h! L7 P+ }9 e
var iedom=document.all||document.getElementById
; j- M: i$ P3 v( jif (iedom)
* ?# U" T. G: k) u% xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" e. \0 V' |3 Y/ Zvar actualwidth=''
) i3 q3 y% l5 |  U; r6 Mvar cross_marquee, ns_marquee
4 o- f8 e9 M1 f; N" v: b( y
4 O  M# b4 M! mfunction populate(){
6 t6 \1 k% Q, V6 ~if (iedom){3 i' ?% h3 S- c& x! B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* F4 ]% X) L8 x/ Z" Wcross_marquee.style.left=marqueewidth+8
* B# V! O/ G. J; _cross_marquee.innerHTML=marqueecontent
( _7 D: L; g# U3 k" G* factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 t  m/ f. Y- w! s
}
8 @$ b, M1 c8 r# _- ]else if (document.layers){4 t! i9 p( \9 Z2 d
ns_marquee=document.ns_marquee.document.ns_marquee2
5 o+ z+ d0 ]0 Y# R" r6 Q9 Rns_marquee.left=marqueewidth+87 p' l5 r+ {/ s- J' V+ A2 V. u" v
ns_marquee.document.write(marqueecontent)& G# S" h6 \. ^8 c
ns_marquee.document.close()* e  _' [. G- c
actualwidth=ns_marquee.document.width; A% t* K, L5 n* U' h
}
0 j$ m% [4 Y/ B; M! z' k; h" nlefttime=setInterval("scrollmarquee()",20)- S2 R8 W# s, [- p& @
}8 d1 K% V" m- ?5 i
window.onload=populate1 a$ ~5 ?- A$ s7 [  `8 S1 O( L

1 E/ W( I% K, c3 Ufunction scrollmarquee(){7 F6 j& o6 }0 L' ^8 ]4 \# W
if (iedom){
5 Z9 o' G1 w0 d  i6 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# {% c5 I) L; c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 E9 E5 V: W4 m' Velse1 k4 E& a" {. P  C
cross_marquee.style.left=marqueewidth+81 q0 M9 r6 B) ~9 C" J& j

: B" `% `3 z" t: |}
, J$ w* p1 p( \# ~6 Melse if (document.layers){- U' [8 i8 y& S+ s6 g  I
if (ns_marquee.left>(actualwidth*(-1)+8))
$ B8 E! N, Y( w9 f9 A2 g& e4 S, P; }ns_marquee.left-=copyspeed
7 O2 D% L& t% v7 N8 \/ E% G: ]" belse
8 A/ X( q' e8 {4 X, ^( Gns_marquee.left=marqueewidth+8! u' `: s8 U5 o4 \
}
8 T& i" @* ?: l8 J! ]4 }) D, _}% n* U# a  [( K

% _2 f" l( m1 L$ e) @; `' [) U1 Xif (iedom||document.layers){( u/ ?; c+ I: X# U- \
with (document){; @/ u- D# k' [; u" V: w* [  l. Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. M4 k. \0 t& `- C# Eif (iedom){
$ d+ W( ]% u* u0 R* s# e6 p; Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! t8 \! N5 q) U6 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 b5 V! {0 P' o' d7 O% o$ D! Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 a! ]0 F0 R1 Y! S, vwrite('</div>')& L1 `+ T, X3 I* y' z: O
}
. l- Y2 b/ L* d$ w0 G, i: Belse if (document.layers){- g$ }  x: n  O0 j7 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" n3 u1 q4 d2 Q. z8 c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- s5 q2 p4 n+ u2 awrite('</ilayer>')
: Q; N' i0 G( |" H1 ?0 V) v}) y; u& E1 H' r* }
document.write('</td></table>')
$ c# i, C* F7 z) o}. s4 n% v( p/ d. B7 H1 @
}- k$ e* f2 g/ V! B5 @
</script>

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