返回列表 发帖

网页之跑马灯文字特效

//修改宽度( {: N2 B& a* ^* D  O2 t! q0 p
var marqueewidth=300  M5 \  s8 o) l
//高度0 U$ j2 Q: V9 Z9 U# j7 {
var marqueeheight=25
+ ]; b, G, ~& y' {1 c//速度(1-10)
6 D; d6 U- H8 Bvar marqueespeed=3
2 V/ J9 C7 E, {, O+ ]//背景颜色
) S9 C, @0 o' ]* kvar marqueebgcolor="#FFFFFF"+ H6 m9 x( M# l+ Q7 L2 `
//是否能暂停 (0=no. 1=yes)?
) x2 n$ E+ z0 K1 W: G4 L& y& avar pauseit=1
4 G& s( l# ?2 d3 Z1 S/ e( u% b; [4 O! `% S; G# V/ {- X' X( C
//修改显示内容
2 `. H" ]# E: G& ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! r+ v7 r" F) U$ F, ]

9 k) ]! b4 T( d! S9 ^$ C7 b
! |" s' H; w5 i" D+ h1 L& g////下面不需改变////////////1 A( c2 {5 `7 R0 C9 `
3 j  A; p. w7 ~1 }6 f
var copyspeed=marqueespeed
# G" E! F( J+ c& D( nvar pausespeed=(pauseit==0)? copyspeed: 02 z8 }2 Z" g! y8 C3 Q' _" O
var iedom=document.all||document.getElementById% ]! [! N/ T" G5 H- {
if (iedom)
& n6 e7 ?$ i/ Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 W( k9 O& ?1 w; p' @
var actualwidth=''7 W1 F: A* N6 X3 B6 \2 v& ]
var cross_marquee, ns_marquee
/ q# j" I; b* \) r0 G8 N
6 C* L$ H4 g+ o. Yfunction populate(){
, T1 u+ U& {1 M# ?1 ]5 o$ S6 Y! u* kif (iedom){' d* e* P1 Z+ P: }8 U; W( G" f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  I: w+ o* K) S/ F% I- P- t% bcross_marquee.style.left=marqueewidth+8
8 O# b: Y! R# w* A7 ^, c8 B' u. lcross_marquee.innerHTML=marqueecontent7 M/ g1 x0 D: C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 d# }+ F3 D9 R5 G
}3 o# g! m# F% A6 |" u9 n. e# [# K
else if (document.layers){4 O$ e1 P( I% o7 r# z  G( u3 k
ns_marquee=document.ns_marquee.document.ns_marquee2; p3 q6 r) [6 e
ns_marquee.left=marqueewidth+8
5 \( {# M- l7 wns_marquee.document.write(marqueecontent)+ G! w% ^/ @& W5 ~( }* a; }7 J) t
ns_marquee.document.close()2 O% d% a! M  e
actualwidth=ns_marquee.document.width2 f% J5 R& ?: k
}
& X4 ]7 M# S2 _0 P4 w# P6 O9 y3 Ilefttime=setInterval("scrollmarquee()",20)! V0 `% I) L5 w, J; U  R8 G5 N6 J
}
- v/ u! g" ~/ ^3 |8 r$ }" Swindow.onload=populate. h. Z- X. F2 g3 G: R* b* G! u

: i, Q; V0 Y& O& Ufunction scrollmarquee(){
: T2 `  p5 Y9 j1 i9 P$ O  iif (iedom){5 C. _8 s. Q* Z& C5 O7 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ @; Z. @# Z* I8 D* E$ Z8 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 w  t5 s' J* j  Welse
3 l& I- O( p; Q1 C! A+ |2 B! Tcross_marquee.style.left=marqueewidth+8
4 L# t+ `& G/ D: v1 J; H7 M
9 C* c7 Y# X. K" x& G2 ^0 q4 `}# T5 f4 H% j* F/ c: T( c3 [, ~3 d
else if (document.layers){: L+ w+ k2 q6 T( ?5 ?
if (ns_marquee.left>(actualwidth*(-1)+8))
, ~( I) [$ P+ z3 \. ins_marquee.left-=copyspeed
, k& p3 h& U3 Q% W; @0 _; oelse3 N: j7 D) g2 \- c7 I
ns_marquee.left=marqueewidth+80 j- W9 q- \" z& k, Z0 _9 a) u# ]
}
% s, b& |/ h6 H3 m9 Q* d4 p}/ m% T1 [9 n0 J  R' ?$ q

# I; w, H) \* z# D" vif (iedom||document.layers){+ E$ g; H  f7 K, J3 Q1 L) r
with (document){
6 u: B+ _: O  e) H1 X0 S! o+ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) d- u* o8 P& f, S. E' r
if (iedom){/ |3 n: W+ _3 }/ |& W' k7 K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) C, Z$ f$ E& t* Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 M- n. t  M' ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; L- K5 h$ }2 `: t# L- Xwrite('</div>')
" `& n* [: h+ e% p$ l}) Q& l4 V. F2 a
else if (document.layers){5 h( _4 A% _9 M6 w1 k' Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' D7 z  q) }- ^, Z6 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: q2 U* b! ^8 nwrite('</ilayer>')
, f( M7 {( x( K4 N0 L' U}
% f3 s2 n$ T, d& m2 Adocument.write('</td></table>')8 g# z7 `# S2 @+ L/ c' t
}
# n/ B1 R  x. c" v0 {. {9 t}
3 k' c+ @) l9 L</script>

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