|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度5 }( w# J) i) h1 q" |& d0 X
var marqueewidth=3008 h) l0 \! [! l" q
//高度) H0 e: q. m9 c5 E
var marqueeheight=25
- T3 W8 j" x9 C8 F6 @6 Y: R$ z//速度(1-10). k5 I( [) h8 r- o% q7 U; q
var marqueespeed=3
# R; O9 O) @- Z& p//背景颜色
; F" q8 K5 u+ F3 d/ e) mvar marqueebgcolor="#FFFFFF"
1 B! J6 @3 @, E0 U- O! L+ Z//是否能暂停 (0=no. 1=yes)?( x: u0 o& p9 ?' {
var pauseit=13 W# V2 \+ r5 s. I
' Y& {9 Y U0 r0 R% Y3 I# F( i//修改显示内容5 h' a, _" c. s: a+ D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; t( P0 }& M7 i/ ^; J2 `$ o" R) n
# E& A9 O2 r2 _8 }6 t) v0 g
////下面不需改变////////////
6 M& f( E; a4 J/ B, V7 D1 a9 U$ |8 \
" j- ~/ E$ [' f/ Y) Avar copyspeed=marqueespeed/ z' p* W# C4 e+ [ a% l
var pausespeed=(pauseit==0)? copyspeed: 0
) ^9 R0 w& ?) q8 @% H! ?var iedom=document.all||document.getElementById
! y) o( y( f8 L, g( N( a8 zif (iedom)
2 |/ `- _, g/ edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 C) |$ g, _! q/ G3 wvar actualwidth=''
+ o5 ~6 c3 n. Y$ D# o$ ]var cross_marquee, ns_marquee
9 R+ y3 J& ~8 t2 Z+ t9 M+ `! N! S1 Z4 E6 H
function populate(){0 |; ~5 K% e7 M3 ^$ Y$ N" z
if (iedom){3 ^4 x+ @% g* c( ?. l! e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# s; G$ p$ q( e/ Ccross_marquee.style.left=marqueewidth+8
8 g% Q" Q4 y) _+ H' Qcross_marquee.innerHTML=marqueecontent+ _7 X9 M2 `8 A% i* I; F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* }$ s6 t& q& a( a) ^}
& @# P! `* @4 e' @else if (document.layers){# U- E7 j1 C" R& D1 Q6 E z" i9 x
ns_marquee=document.ns_marquee.document.ns_marquee2; ~) ~5 v6 w& P+ k
ns_marquee.left=marqueewidth+8: D8 M! w- v8 E" e
ns_marquee.document.write(marqueecontent)0 M3 O( M: [: X$ |4 \
ns_marquee.document.close()( t7 [5 O/ O" Y8 B- _( P
actualwidth=ns_marquee.document.width
3 G2 K) @# u, b' [}1 V- w: Q' G# d; i
lefttime=setInterval("scrollmarquee()",20)" g9 Z: s# y' Q4 L- s* E
}
* F8 k# G, f( C$ v. Owindow.onload=populate
* _2 |4 P3 F" y, E4 \2 y9 i k, b. C) n0 e: r( A2 m
function scrollmarquee(){1 C- w9 S8 a! c+ }
if (iedom){; o$ c. Y* o/ m3 q2 F0 a5 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: y; J' P K [/ s6 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- `# X) S. O# t+ E
else
% G( V$ g% H! Zcross_marquee.style.left=marqueewidth+84 D' r0 Y' P" i2 ^+ y. U
* l e) l9 D! D0 n" e3 T
}
* J5 V( A$ D$ ^; Celse if (document.layers){& y; o. w1 ~. d3 x1 c& u
if (ns_marquee.left>(actualwidth*(-1)+8)); k3 F2 E: R8 b+ N' B6 @9 W
ns_marquee.left-=copyspeed
" e8 @( s p. Selse
" l, D9 o8 J% o9 K+ g& gns_marquee.left=marqueewidth+8' r* J k2 R$ N, z! W
}5 A' m; z! Y% ?: {7 u
}' ]4 {5 b f5 O
! E% r+ {' T7 K) B: B5 P* [
if (iedom||document.layers){
9 `' M. k8 }5 t: G; p2 o3 awith (document){/ ?; Y/ Z( w! m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 ~2 ], b. E9 p# @) \8 n! h3 Nif (iedom){
, G' y* s- B- c: ~( R/ I+ Q; Y* |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) j C F* r* h( B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): X( ~; U" I8 K3 V! X9 Q" N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' Q$ x/ p5 U/ e7 b1 j0 Z7 [/ i( e
write('</div>'), ~ E& D) G2 U6 h
}' G: R, j6 y6 ]; ^3 [0 d
else if (document.layers){6 b) y1 y& o; _0 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 C0 L( }7 z( O7 E- U) l9 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 ?' U% r* \6 G5 B: ^
write('</ilayer>')
E" G9 W4 a( k! J! s0 d}) g2 f1 Y/ ]! R4 d& l0 T
document.write('</td></table>'): c& m9 u6 h* M% K4 V% e, m
}7 L3 c1 i: |& P, [2 C& v: C T( p
}4 i9 X/ V7 E( o$ _) m6 g
</script> |
|