返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) E. X; H, o9 D1 Svar marqueewidth=300
: \) `0 d% k* l0 R; E- R, s) H9 O; L//高度
! m) C7 N7 h& }* T9 Q0 _2 C3 nvar marqueeheight=25/ e6 W: _& b, G# X' |3 R0 b7 D4 S
//速度(1-10)9 h1 \8 c8 F& Y! G1 T3 m+ i- r
var marqueespeed=3
4 Y% ]) y  w6 Z  y( {//背景颜色+ ~6 i. I7 |$ b/ C
var marqueebgcolor="#FFFFFF"& c( c4 V1 p1 p+ w5 {  J' v2 m
//是否能暂停 (0=no. 1=yes)?
& a( B: z! ~3 T, _8 A, P, dvar pauseit=1
9 m" _) J' x1 u' {
/ d; c# _5 C$ M+ M0 D+ `+ V//修改显示内容
* E6 R/ ]: {6 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 p% U) H% \: C, W: o; h' c

8 _+ I$ c: `' K  x" s  `/ J/ n" t- S( R
////下面不需改变////////////
( s& ^$ P/ Z( l" S7 e3 t4 x; E7 \9 j+ X' q- V, ]3 {1 ^
var copyspeed=marqueespeed
# L+ l- C6 n- {/ V: `* D7 E; {var pausespeed=(pauseit==0)? copyspeed: 00 \  [- u: k6 F( R% {5 M; s; {
var iedom=document.all||document.getElementById5 Y8 ^! a9 M( H- u
if (iedom)( u" J6 ^3 H9 K4 b' h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# L0 H5 _; a( f$ A; F
var actualwidth=''
4 W, ?- t& d+ F% a6 W: Avar cross_marquee, ns_marquee
: ^" }2 ]* z, W: X0 @3 f
' [1 a) O! a! n8 J& jfunction populate(){
) i, n8 Z+ q7 cif (iedom){  ^/ g* B$ X  P: g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 S$ |3 V# W# L; m, ?
cross_marquee.style.left=marqueewidth+8
" c. I0 ~5 u( C, Ccross_marquee.innerHTML=marqueecontent
; L" k7 D/ {2 E; kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 T' i: Y7 C4 U6 ^5 r}
2 D2 j- k* z4 l7 l3 E- ?else if (document.layers){# U( b  J1 U2 d8 z9 F* w
ns_marquee=document.ns_marquee.document.ns_marquee28 `1 x* l8 j& z1 W: Q& |
ns_marquee.left=marqueewidth+8
( t+ Q& U, ^+ @9 vns_marquee.document.write(marqueecontent)
) k$ O) d+ j+ |ns_marquee.document.close(). Y# A. _8 @( J/ R+ a5 V% w
actualwidth=ns_marquee.document.width. d; ]/ M; K1 e% d7 B: C
}
: R% F3 b% M: R6 J: M4 k2 Xlefttime=setInterval("scrollmarquee()",20)
* i7 R; X8 h( f' D+ p, q, q}5 ]5 q2 T) q5 y
window.onload=populate
& \5 g1 q( s2 L9 V/ p! q- E: l% C) `7 t  j6 |0 D  [& N* U
function scrollmarquee(){5 k4 d0 U' B& U1 S: ?* P
if (iedom){. l  u" h: D' c1 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& Z: R  ?0 U" `9 q2 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 M* q# `5 x6 R: x% }else2 h, _4 X8 \9 m, I* s4 W
cross_marquee.style.left=marqueewidth+8& o8 L( |0 F# b5 f2 [/ t6 z  x

/ e" N1 Q; i4 k2 V, v1 h}+ L9 W& V8 u& s# D3 T
else if (document.layers){
. e% r! x7 d- o, Q+ T$ Z- g# ~2 p, Wif (ns_marquee.left>(actualwidth*(-1)+8))
# J+ p1 `7 Q" o0 f1 _4 zns_marquee.left-=copyspeed
) ^% D7 N+ z4 U& C' L6 ~* i/ Felse5 e. _% O: n9 a
ns_marquee.left=marqueewidth+8
3 `, _% o( A- S) z, B}
& s0 s% Z( \. w9 ~0 V: d* @}- F  c$ r) H$ i- @+ T

; P* s8 z( B- k4 Oif (iedom||document.layers){
# \8 o& {& [* d0 ?1 w% H. ]with (document){' q. @, e' F( f' c6 J2 x1 N. ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 r% y" y. f! R# R% ~; {. E$ c
if (iedom){2 }( m2 A$ r, f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- t" A$ [( n6 M3 u& N  Z, Y! l" mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- u5 B( J( [5 |  e. d: {& w, w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& c5 D3 p% ~) j1 zwrite('</div>')
0 Z7 ?% }9 F; k) \}
6 K2 {2 A8 U0 Belse if (document.layers){
  Y  o% E  [6 a9 a4 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" Y* t6 {3 J% [3 J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 c2 X" C' ~! y; Dwrite('</ilayer>')
1 e" i% d% I9 w9 U  G/ Y6 |9 _}8 b6 z; {' I; k" H& A3 G
document.write('</td></table>')' t! F, j3 o3 d& m3 o! a
}  L* p6 M+ h7 r  ^6 P4 b
}  }2 C" k; z1 J2 Y( ?* y% h1 n4 N. {
</script>

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