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

|
网页之跑马灯文字特效
//修改宽度1 c- m0 }* T" A9 m! I c
var marqueewidth=300+ V/ e: }( W9 R, W2 t3 n7 \5 k
//高度
* s! t/ K( y+ z8 @ x5 @var marqueeheight=25! T* j2 ]8 r E7 w$ n
//速度(1-10)/ w/ z O# n% a0 q4 G/ \& F6 v2 K
var marqueespeed=39 E4 S* g, B3 Y7 h
//背景颜色% v- }" o+ @/ t/ J, k9 f
var marqueebgcolor="#FFFFFF"# G. `: I K! [4 t
//是否能暂停 (0=no. 1=yes)?
, E% N0 }# I7 Cvar pauseit=18 z4 D V. V7 Y3 [. v; [: e- p7 X
3 x7 M6 M7 y& `( L
//修改显示内容
' A0 o6 o/ t% \" Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 G0 K$ N: T4 W# J7 T
0 r. o) `3 _& d8 X
. m1 Y6 s- u! B7 H( g/ `* U* p////下面不需改变////////////
6 V7 u' e1 e2 t$ p
' x, v6 f* J; f/ Hvar copyspeed=marqueespeed
0 o3 R4 [$ a$ V3 R7 b# I" ~: Hvar pausespeed=(pauseit==0)? copyspeed: 0! T' F, N- H4 ~( r* b4 [$ k
var iedom=document.all||document.getElementById
# n4 Z+ z: l% q+ Zif (iedom)! m. L6 h' y4 i: E% [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ t; \$ ^% @) z0 ?; B. Zvar actualwidth=''; B) j+ a; F) {. \( B7 t
var cross_marquee, ns_marquee
: [: \) Z$ _$ Y
. n1 D3 t4 }4 ^. k9 [4 q- nfunction populate(){
/ l8 O; A$ K) k9 @+ Mif (iedom){
& c+ d# v& s6 x) bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
e1 L& @. y( D+ N8 z9 }cross_marquee.style.left=marqueewidth+8/ ]$ t) x7 n: Y; h
cross_marquee.innerHTML=marqueecontent+ p7 _& ^/ V0 ]7 l9 x' y5 I+ R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: V- i/ l# B; `/ g) [ B( _}
* N6 V* x- x2 M- O# e1 V4 C$ x. o% ~3 oelse if (document.layers){/ m K9 W4 w9 H8 m: F$ i
ns_marquee=document.ns_marquee.document.ns_marquee2/ d z2 }" R' {+ T L
ns_marquee.left=marqueewidth+8
$ O: I5 j6 {: z N# Nns_marquee.document.write(marqueecontent)
& p) A* ^0 v. b: ?8 i7 ~/ u8 cns_marquee.document.close()8 p- M, D& B5 ^( ]
actualwidth=ns_marquee.document.width
( e t: e6 R; v}
0 |" L8 K- U) q7 T1 @" H8 }lefttime=setInterval("scrollmarquee()",20)
k W8 e, h& o6 t# }}
, f* h6 Q9 A( M5 Gwindow.onload=populate2 l. t$ ?" q; O& }0 E% O! C8 P5 G7 l
4 y" ~# j: m( d1 ~function scrollmarquee(){- ^1 Z$ a, S6 D* J, K
if (iedom){
# N# Q) B/ u9 K- ]/ B- _0 j5 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 r5 D" {1 q k: I4 [9 T1 G8 ^ V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; l. m$ l$ ]. {: a2 u9 welse2 J- t! ?' r* E$ R! c% A
cross_marquee.style.left=marqueewidth+8
: r0 y! B$ V# d. I# @8 L1 i) B" ?8 T6 s
}9 i1 m" w( ~) B7 x Y
else if (document.layers){ R& q: e: h' X' V) V0 A
if (ns_marquee.left>(actualwidth*(-1)+8))0 l! \& i0 S6 ^- y
ns_marquee.left-=copyspeed
8 ^9 Y- T4 _6 i9 y; Nelse
( E D* I9 K1 U# Z7 Lns_marquee.left=marqueewidth+8
0 G% L# K! x# a1 A}
- A1 u& v# @4 o! P}
3 M0 t9 Z5 h. p5 D* e
; F! K& l5 x% H$ dif (iedom||document.layers){
6 K, f7 `5 @- _$ E9 Swith (document){
9 _& r' Z6 q* M! S; V) hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ @9 o8 c9 u; i# l) N
if (iedom){7 n L1 n+ o1 F7 e l8 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 c8 ^1 [+ e3 fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# U/ N R! d3 C7 Z" Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ S4 k: D" e3 P. l5 n" Fwrite('</div>')
$ D( G1 P, C* ] {. @2 S}
# }& G0 `* H' G3 Y1 U5 i3 O( Aelse if (document.layers){9 V7 d. b2 l/ @4 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 M, _! p' B3 f% P3 s* W; S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( k2 f& V! t% m1 ^' ]write('</ilayer>')
) u7 b; c% W" C) C: u- Z}
* g% i; J2 v. h8 O! K; r# @) W- vdocument.write('</td></table>')
]+ }& K' {8 D& M4 d& c5 \}5 m: }9 S$ i' {' S6 p, g
}' M) F, d9 |+ x" G/ u( Z
</script> |
|