返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ \! m- N2 h2 F% f& H7 _
var marqueewidth=3006 @2 g4 P5 g: c) N
//高度. t$ E; y! ^+ \+ t0 l! z4 g
var marqueeheight=25
+ T( Q$ W! v; R# E/ @; F//速度(1-10)  Z8 I- Q- V  |. t+ g3 C" E0 N, u
var marqueespeed=3
7 q2 B, y, I8 Q! \8 L//背景颜色7 F% s; S# z$ w" _/ w
var marqueebgcolor="#FFFFFF"
9 k% F6 Q+ }! m- J: d//是否能暂停 (0=no. 1=yes)?
1 y3 X& ~9 @, G7 v2 f2 Uvar pauseit=1/ \$ v* T6 }0 B) A' m# |- b, Q
- A+ i( I$ {1 y. Q  M
//修改显示内容
1 A; t7 H( s. R, xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 h+ q: ^* r/ O

, {" t2 E* K3 M& s0 q; y: g
1 L  _' p8 f% [+ G////下面不需改变////////////
) k1 n' z1 Z  ?. g
! W" p% h7 O# ?+ ]; \& mvar copyspeed=marqueespeed
8 o6 z+ k- _7 `0 `var pausespeed=(pauseit==0)? copyspeed: 0
1 F2 e+ D7 h& m+ W7 v+ i; i0 C% T' Hvar iedom=document.all||document.getElementById
1 P8 Z0 C- W8 p% b9 aif (iedom)1 t: J. B5 u8 K6 r* R" _4 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! m; n% R6 o+ N. H1 f/ O) Tvar actualwidth=''
+ q0 H7 a( L/ p# s9 {var cross_marquee, ns_marquee
: e! e$ E& b: i* l6 G! M" u" I# w9 i7 U2 z3 A+ C4 G# {5 v6 C
function populate(){+ h/ \9 H% _* I. ~4 u* Y; B. j
if (iedom){
  m% t" U, p6 R) H" W7 w& Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 f- _% @1 {2 Q' K# ]' T
cross_marquee.style.left=marqueewidth+8- l: W9 Z6 M5 m" O+ x+ |6 _
cross_marquee.innerHTML=marqueecontent  |% z3 T/ b/ Z  Z. R1 C3 H3 g# F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! l4 K# y8 L8 K  y9 i
}5 ~- |4 z" Y( Y3 [  ?/ e- {* f
else if (document.layers){% l) v0 ]1 o& P8 z: ~, c6 I/ {
ns_marquee=document.ns_marquee.document.ns_marquee2
3 |% b! J* k+ ?% ^3 ^7 @% |0 r" Vns_marquee.left=marqueewidth+8! a  q/ H2 s. ^
ns_marquee.document.write(marqueecontent)
! @6 `$ G9 f$ K4 |ns_marquee.document.close()2 l1 S& @3 p+ z1 V2 t1 E* E7 W
actualwidth=ns_marquee.document.width
" V8 E' [: O" H; Q, B0 g}+ |! k' w* c, L- }5 d* V
lefttime=setInterval("scrollmarquee()",20)
: O2 R+ B! ]) S; u}" B! z3 }+ e* Z( v* R0 a  f" v( h
window.onload=populate
! W- v/ o- A; c  P, N  b1 S6 X
* {, e2 j5 S. h7 Ofunction scrollmarquee(){6 K7 C: J7 y* v/ b( c) [0 p
if (iedom){
, l: ~& N! ~% R! V5 }9 W. V* rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ p2 S- l" W+ n6 J' d  Q) Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ I! Y0 L! @2 D& j/ j' z, J* Gelse1 v( g9 Q7 I- m" G: e0 X0 c
cross_marquee.style.left=marqueewidth+8, n; b/ o3 Q2 O' m, t0 u' [, D# ~& g
3 J5 ?0 r2 h- G9 A7 ^
}
1 ]1 Z# m; a0 m* }6 s* belse if (document.layers){
1 Q0 |, L  x9 A! r( \if (ns_marquee.left>(actualwidth*(-1)+8))6 R% K, ?) ~. Q2 [* B2 q+ }
ns_marquee.left-=copyspeed
1 }& g; `  T/ K- S6 b" S9 u' helse
5 O7 m& R( P1 V) Ins_marquee.left=marqueewidth+8* q3 O" I; ^8 p; u5 f
}8 Z( H# U: H5 [7 V8 Q
}
1 N* ~6 H$ ^3 S# v  W3 `+ \! {
, }5 K5 }7 U6 v: I8 r# oif (iedom||document.layers){
2 {8 D3 J. \- U# m9 J6 Vwith (document){
8 G6 ?, x; M7 [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- `9 }2 G# g2 K/ _7 X$ C. K
if (iedom){7 f% V0 {9 T3 g2 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. u+ \9 d: x1 F( y  {& Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ l/ i) J4 ?& F+ T( l7 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), Q4 s! V; A* |" I! }$ g- `
write('</div>')5 n) x! \) _3 n; p
}
! q9 p+ f' k9 C" \* M7 l8 velse if (document.layers){% c) G, c/ K7 z9 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) a& b; V: V- F9 F" w" B/ ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! l5 l9 I2 z; {$ D' R- M: k  a- M
write('</ilayer>'); a  r% E$ X) M% r: s
}! w, P7 W8 d. M' T
document.write('</td></table>')
6 s' F: D7 C5 R2 M2 v: g' _}
5 {; G5 l7 F$ [& {- X' @+ |1 `. t  r}7 O0 c3 v; i& g1 B
</script>

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