返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 d) F& d7 N! [$ b1 Qvar marqueewidth=300. K' g' n& v' ]" v
//高度2 U3 m1 A1 j) v. s# X7 K
var marqueeheight=259 F5 Q5 J) X9 z. K  V. x& L. ^
//速度(1-10), c; K2 G: t7 `0 C  m+ B
var marqueespeed=3( I3 r# c- n, W- o6 {
//背景颜色! k% I' T# b% w3 \  ~
var marqueebgcolor="#FFFFFF"8 u) V! ^* W& Z8 j& n0 }
//是否能暂停 (0=no. 1=yes)?
+ e0 O/ r- J; f9 z# \) M- uvar pauseit=1
% ?2 q: m3 @, k+ I# v
  Y- }( o/ x6 D4 j3 X//修改显示内容
' v- h" K  l8 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 s4 M9 o9 G+ C3 u! Z- Y; `: _; C! S: Y, `0 F, j- R/ `- p" |

! g$ E) Q2 Q0 R+ }  w1 j1 T7 X5 P////下面不需改变////////////. s: }  i7 B) B3 y

9 o, L) l% \2 X2 @8 ]0 qvar copyspeed=marqueespeed
( w6 q( A5 w! j2 bvar pausespeed=(pauseit==0)? copyspeed: 0
3 `. y! B" C# u$ A: @var iedom=document.all||document.getElementById
) t; M2 X! |6 d) bif (iedom)/ e5 ^- E7 Z/ J* R- p( w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 l9 |$ t8 E' d2 g
var actualwidth=''
4 p0 i9 _6 v4 {# `6 yvar cross_marquee, ns_marquee
# @" }$ g# C* K8 {% R7 f! r# G
8 I$ D5 ?+ ~# b, \/ h/ dfunction populate(){
, N1 w4 e! Z/ Z( H& p* T" Eif (iedom){
2 y# ]( I& q3 B; G: |. h, N, J& {  |, ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) E1 }1 M9 F' J9 across_marquee.style.left=marqueewidth+8/ f! N% v9 T9 P
cross_marquee.innerHTML=marqueecontent. W/ U, v  D6 Z; l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: {  ?; M. l9 N2 p/ I+ v. _5 g}/ F5 |# v( U  q" \' v( q* ]6 P0 D8 a
else if (document.layers){  V) E' |2 q# i, M/ w9 X: M$ `
ns_marquee=document.ns_marquee.document.ns_marquee27 P& Q& `' q1 @/ l
ns_marquee.left=marqueewidth+80 g5 s* H5 ]! g* P' e7 w
ns_marquee.document.write(marqueecontent)
# ~, ]: j) |- {# _6 [" n9 Fns_marquee.document.close()
& F" f3 h8 Z& B: \actualwidth=ns_marquee.document.width
: D- w0 _) o( o, W5 q% A}
: n" P1 X' C# m+ n, Vlefttime=setInterval("scrollmarquee()",20)
' r/ f9 W4 s) h7 i}1 {& E- U' e" [* c/ E! W# m& M
window.onload=populate4 I) M3 v1 D# P4 Q

5 i' d- ~, h/ B; D3 Q5 S' u  Qfunction scrollmarquee(){5 V+ B& d4 ~" J2 D7 o! f& B1 F( I
if (iedom){8 s) `8 F7 g8 v: i/ U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), d/ ^- f# l! p; b& q4 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" k& @( _. N& Q  C+ Selse
' m2 t8 e3 f7 ycross_marquee.style.left=marqueewidth+8
0 n: R1 }5 ^/ w9 s" Z+ _# n3 t) Q& R% H, H* ^7 R4 I/ \  @! l
}
! ^; C8 J1 t& X/ Eelse if (document.layers){* \8 M! S3 i7 R* H8 ^' F9 x5 I! J
if (ns_marquee.left>(actualwidth*(-1)+8)). E$ P. p( j# p3 L  \
ns_marquee.left-=copyspeed
' T8 Y" `7 Q, `) Qelse
1 h- B0 e( w7 H# Ans_marquee.left=marqueewidth+8; u" b; F* g) ]' g' L
}
6 g( |7 [& n, N" n2 V}; p$ {6 W" o' y" x* _# r9 X
# z/ t' _; _: b' Z& M
if (iedom||document.layers){9 i- y( P$ M2 J. \" I0 ~
with (document){
2 h5 w6 w4 n" q% k& a5 n  @) w3 W1 {. Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- z/ {2 r, [" y# v( D9 U
if (iedom){
& j9 b! c9 |' d# S' o- }% ]9 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 r" p8 o( b! g) J+ j1 Y7 D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* i; G" x7 Q/ j6 z; y6 `+ K+ {- Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' {& F8 g( J+ r6 e/ c6 Z
write('</div>')
. K2 V; X$ M2 E* ?; X. V9 o}
& [& j, T. h6 {/ D. e, k1 Telse if (document.layers){8 P& D1 V" @7 v/ @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: J, h0 K" h. q) H5 f" a' r* u  Z+ Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 r. R) ?/ ]) V. w6 Pwrite('</ilayer>')
% m- j7 e5 H% S0 o1 j}
8 w! V7 s+ W6 k, R( }. bdocument.write('</td></table>')6 i' i7 @) h, C8 L9 W
}: V% Y, G  c: y( E$ |6 i& L
}8 B+ Z, w: @6 C! V6 N6 B
</script>

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