返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 ~- j, f5 g4 d. M$ m, |! c! q
var marqueewidth=300
; I( \2 }* u, W4 B//高度
' W( s( W3 q; }; p6 S7 A) Tvar marqueeheight=25" g) P- F2 i$ A1 C
//速度(1-10)
! _7 E8 h1 R* _8 V' E* }var marqueespeed=3
% T$ S9 J: R0 g3 b! ~6 E6 R2 q//背景颜色
, n' O: e* ^/ |- w! `var marqueebgcolor="#FFFFFF"
5 Q( e0 L' n7 S4 \$ O3 h2 o% C//是否能暂停 (0=no. 1=yes)?0 E8 b  {# Y! ]# ?- c4 d
var pauseit=1
/ y, u$ g% Y8 W5 o: ^. K
& k! c, K7 s% y0 y& K//修改显示内容% E  C; V  o/ M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 @# E+ V6 [" Q) r$ c8 d9 B6 |
, S) `& s( x2 Z3 r% o& {% J7 h& u0 c+ T0 {# ]) X( n
////下面不需改变////////////! y1 z5 q) k! N3 i1 x

' P( [" K( _" J* ^7 ^7 |# |var copyspeed=marqueespeed
2 K. y! ]' u; I* q( Uvar pausespeed=(pauseit==0)? copyspeed: 0
. @8 h+ w2 x/ A. ~) C8 Bvar iedom=document.all||document.getElementById
! A) O- @8 Z& s* d% Q! qif (iedom)
1 k0 ]+ \& e, h1 B" e; ?- @2 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! [, Z0 i/ l$ M: `
var actualwidth=''% f4 h* \  M; g3 L" j
var cross_marquee, ns_marquee
( O9 ~2 g: _  U" r) o4 J3 n# e7 @5 J" ^
function populate(){
' K. D2 y* x6 x$ k+ B8 Q% @( \if (iedom){
. x4 {4 E/ g5 s% c! O( Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. N: K3 q) W9 Z1 l
cross_marquee.style.left=marqueewidth+8! b' g' Z5 k7 c9 n& m
cross_marquee.innerHTML=marqueecontent
. ^8 J5 C8 G- x  Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 r8 v3 |" z: |7 n8 r8 |5 i: g/ _
}
1 X% w8 c) i4 M( k( X. j! _else if (document.layers){' Q1 b9 H# b, E
ns_marquee=document.ns_marquee.document.ns_marquee29 H- R2 `# l& M, u# c
ns_marquee.left=marqueewidth+8
. z  P7 d: O- I. i% @' @7 ]ns_marquee.document.write(marqueecontent)
7 ?, l: \2 W4 ]! k6 m5 U" t4 Mns_marquee.document.close()2 @* ]+ k5 h: g* t
actualwidth=ns_marquee.document.width
7 a% k+ `$ T' J3 X}3 x/ h3 Q( @5 ]. t( h
lefttime=setInterval("scrollmarquee()",20)! U+ _8 R0 N& r
}6 R1 e" B3 p! w
window.onload=populate
6 d5 b$ c( N, P  Y1 O" |; W6 z. y# U: W3 u8 x6 Q- W# G4 c
function scrollmarquee(){& o1 }  K3 `% x1 y
if (iedom){
( i% o2 t, h3 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' F4 L; Y& V1 B3 }7 e# F/ N% Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 L& }5 ^9 O" O" {/ z! ?9 K
else$ q& X$ d! }8 Y: x2 x
cross_marquee.style.left=marqueewidth+8$ }; V0 }( T3 I  a$ h: N, p
7 P9 R1 @9 y) \2 U3 [
}
3 G4 Y- o* l8 Z0 `1 p# Y2 pelse if (document.layers){6 M* K- ~$ q. u$ z: l
if (ns_marquee.left>(actualwidth*(-1)+8))
% |0 h3 B! W8 S2 g4 U# x- Gns_marquee.left-=copyspeed/ w4 M) N3 W  d* o+ Z: W
else
) s" O; E1 v+ j% x5 a1 P% O6 \& Rns_marquee.left=marqueewidth+8+ j- g( ]) L9 ^. _1 ?) l. _  g& t
}
! @) N5 d8 O% F$ ~. Q9 G0 j- s}5 M, j1 Y  O2 G5 r7 b

, b# R) _1 u. h: }8 T5 mif (iedom||document.layers){
/ v) h; w; V: S; a3 L! Hwith (document){
" K. C# ]! b( g. d' Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 x" V6 S  {3 {1 T+ U+ {if (iedom){
0 {! K( }. b: w0 Q1 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ R* [3 V2 f4 y" J9 [( i( |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. Y$ I) o4 O1 w  t' t4 |; I. nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 g& ^& c: Q; Ewrite('</div>')! ]8 z+ T4 H  V2 ?1 d' E/ V( Y  z
}
3 d  [3 k( t1 A* Y. z7 G! ~else if (document.layers){
/ o+ _+ v0 W% C- i% K7 M- m0 W8 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 }- k1 k% D* H9 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 J- T% Y. v& r$ z/ Z$ S- W) Zwrite('</ilayer>')" i5 M5 \8 A; E. y' o$ ]
}5 d, _/ Z' Y% Y/ ]; M6 L  {: r
document.write('</td></table>'); g7 d, S8 ~3 m# ?/ P! R9 i
}
% L$ T3 W4 u7 X) b; w}
# y. O0 r: u: g* ]</script>

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