返回列表 发帖

网页之跑马灯文字特效

//修改宽度, L- U0 r) ?8 m$ ^+ K+ p
var marqueewidth=300& D3 P2 `6 D" t0 {8 h: ~* I8 r; K, ?
//高度  A# k/ z5 j8 y- o% O+ g
var marqueeheight=25, ^' k: t( s$ a6 ?: X: @, ~
//速度(1-10)
  k3 a( B' G$ @; v7 ivar marqueespeed=3
* E  c2 h0 q: j5 |, ?9 y4 d0 G//背景颜色
8 `5 h% y7 G  L5 S: ovar marqueebgcolor="#FFFFFF"
; ^, ~; O" [3 t7 w//是否能暂停 (0=no. 1=yes)?
  p( M; ?$ V: G0 I; T$ ]var pauseit=1. e* B/ O$ j$ ?4 j+ F

! O3 m1 R! [" a6 U/ \//修改显示内容
- P* ~' j2 L1 |& q. d4 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; |) U5 N' g0 ]4 ^5 |/ r5 t$ g4 p8 {( ~! E4 I3 k3 Y' u& H

, C# _9 R* W0 y4 W! p////下面不需改变////////////
. Y3 c6 P5 u' Q" v$ y! s2 J) Y; a1 m$ o
var copyspeed=marqueespeed
! O3 ~# A) a$ {) d5 V  _, ~var pausespeed=(pauseit==0)? copyspeed: 0
7 J, i# p: z( v* P* ovar iedom=document.all||document.getElementById
9 I( n* U3 o+ u: g9 Jif (iedom), k% F8 v. U- ]% w# P2 }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# J8 n# j! U1 N6 |  _8 A% o; qvar actualwidth=''
; X$ M( V- [; d* x0 p* q5 C* c; Xvar cross_marquee, ns_marquee" I4 S$ t" Z) w

4 I* H0 K% }& N% L3 L( w+ Lfunction populate(){
! s1 e/ P% R2 B. l% q  {if (iedom){
* b! I$ _4 r1 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  Y5 v7 m" n8 ^1 X2 z7 `
cross_marquee.style.left=marqueewidth+8
7 c5 t. v7 X( s& D  V3 [$ Ocross_marquee.innerHTML=marqueecontent# ^' d# K- l, S% Q$ s4 d" w6 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ k! _9 K  j0 Y5 \3 y+ k. ]& }' V" F
}* y, g( Z( g* O
else if (document.layers){" o$ U* R$ p5 y$ \! K2 \7 V
ns_marquee=document.ns_marquee.document.ns_marquee2  }7 H, A3 M9 F7 K# ]% B6 h2 Z
ns_marquee.left=marqueewidth+8/ d( K" h& ^7 }! Y6 k
ns_marquee.document.write(marqueecontent): {) ^; P7 T& q5 [) P
ns_marquee.document.close()3 {( n( l8 [/ r3 \* Y& P
actualwidth=ns_marquee.document.width. a% _$ r; D* L7 i  _
}  D* H) A4 h2 m8 W
lefttime=setInterval("scrollmarquee()",20)! R$ b3 n2 z* ^) t. i2 a% X
}/ s+ L. V$ P; B! N  ^7 O/ d
window.onload=populate6 d" f# b& t! V* b
" I* T9 W1 F. l$ `
function scrollmarquee(){
6 r; H& p. O$ @4 }if (iedom){
: O; _4 H. `; F. z& Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. l& Q& f( W' s& Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* H  x0 |# ~; ~* m0 X$ nelse
4 h: z; D7 p/ p" Q* ]9 I6 G+ X3 \7 Ncross_marquee.style.left=marqueewidth+8. D% R& K3 P/ ?  m+ j0 t* j9 C* d
2 d+ w+ l' v8 o5 |- D
}/ w2 G) f$ a- N  ]
else if (document.layers){
) P* [1 D( [' e$ |) o& }( _if (ns_marquee.left>(actualwidth*(-1)+8))/ d3 S9 H3 n0 m- R* F
ns_marquee.left-=copyspeed
6 O2 b- ^( b$ I4 W& b6 g2 Gelse2 A5 c# B8 x  q, ^8 H
ns_marquee.left=marqueewidth+8
* p6 W2 U* D5 G7 C0 X}* @; m: G; g  K. K7 O
}
+ ~1 r* V% X9 }9 \9 f
0 d  q- Z( Z+ ^9 p# v. Eif (iedom||document.layers){! A- O% y7 g' A! n
with (document){
: i8 ?" {1 r9 D7 }  j% cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ q* @( u, P" @" A; w; R$ Bif (iedom){
# ^: D$ ]1 [+ v' uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: E" c6 o2 E/ Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 E1 O. x4 q4 u, d* |- ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 y& a7 z$ G9 ]* z8 ]- ?+ W# pwrite('</div>')2 I% \( A  `  b% i' t. Q
}1 U+ M$ k7 j1 J* Y7 X9 n3 ?1 _
else if (document.layers){# g; Z6 j7 A* g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- E1 }) j4 Z2 j; ?! |$ ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 t1 m( c; `9 w
write('</ilayer>')# N9 q2 n& g0 ^; k6 ^! F7 H/ A
}% _7 f9 V) s0 K2 k7 z- @
document.write('</td></table>')0 U) k; U+ m: P5 H
}
# F. V3 t5 T% I3 x1 E}. U9 B% R2 Y5 S* X7 P
</script>

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