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

|
网页之跑马灯文字特效
//修改宽度
| e6 X* g( N' S E( kvar marqueewidth=300) p5 U, D w$ k0 J
//高度
1 w. p/ a" }" w7 ~* Fvar marqueeheight=25+ M& B# ^; ^: [7 O& |0 j
//速度(1-10)
- F" @7 N \# f6 A% u, Rvar marqueespeed=3
( O" J! M* Z5 l- O//背景颜色
. @4 w7 [9 ~8 w; L$ [; ], f2 Nvar marqueebgcolor="#FFFFFF": V& s* g+ M$ B; G; @) I4 b7 q
//是否能暂停 (0=no. 1=yes)?
, ?( [, _2 P0 S2 P9 t+ d% {: ~var pauseit=1% }9 Z# w" q, m; w
. ~1 x: i" m* F0 p ?//修改显示内容
1 S1 t% x+ R ~0 ~3 ^; gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: D( n Q. |0 E+ m" s0 I" U3 }$ G
: g8 M7 S7 U' j. e \
& Y; l8 f' J n6 v. k" F8 E////下面不需改变////////////
8 H9 o3 n2 U d+ P+ P4 r- q: h+ U8 V+ d* y
var copyspeed=marqueespeed
7 f4 {" c/ E4 l" J; [( Dvar pausespeed=(pauseit==0)? copyspeed: 0
: R( d; O9 |6 |; nvar iedom=document.all||document.getElementById
4 {, y6 H: P# kif (iedom)
8 I- `1 J/ P( e0 S% O/ S; Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 E* {" n- n9 d' V- kvar actualwidth=''
* V5 V4 g8 {1 S; |( P8 Jvar cross_marquee, ns_marquee
K& U1 u1 H" ?0 K- N! W' y8 _* [3 O. X. u, @ f. A
function populate(){
6 I( n( A, y" `. j) H6 nif (iedom){
! P1 N! l% w4 X' @4 Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' i6 `, M d" h+ M1 S2 C
cross_marquee.style.left=marqueewidth+8' J1 H) p3 f% Q! r. y& v
cross_marquee.innerHTML=marqueecontent
1 v5 |+ K, X% T2 {" N: Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ }, f/ x& I7 [1 u6 K3 t. ` q; I}' ~% E& ~: E7 I9 }) |5 I
else if (document.layers){2 Q) Q+ i! _+ a7 D# D) G. G( a
ns_marquee=document.ns_marquee.document.ns_marquee2' @$ s* ^0 `! e
ns_marquee.left=marqueewidth+8+ k7 {& k) a) W, \5 F6 y6 k
ns_marquee.document.write(marqueecontent)
1 |/ p- K# V' m7 }1 I. O$ Sns_marquee.document.close()8 O. O1 Z0 B& }( C' ]2 }
actualwidth=ns_marquee.document.width/ X+ d4 z2 d" J/ x/ [) x
}
- U- o2 l* O, [5 |" o& \lefttime=setInterval("scrollmarquee()",20)- u* X" Z1 A7 x( J" ~8 x" s. r
}
' p* P! R% }# s& o1 l) o( O% Hwindow.onload=populate
; R3 E# Y _/ H6 m+ h. I4 n7 w0 t( m1 K$ J: [- A) L
function scrollmarquee(){
9 b8 c1 F; ?! _" nif (iedom){: ?. t8 m# G3 J, J- H, k8 s% o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
~# X; x% R N9 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( |; o7 Z& w7 Z" |( t H, W( v
else3 i* A/ `: T( W
cross_marquee.style.left=marqueewidth+8! @; q9 ]; s$ M6 R$ h" O) k1 O3 o
9 { z, ^# ^5 [. C0 z}
1 e2 j: H3 I& ~else if (document.layers){" l! L; c" m6 O( r( P5 a) o3 P
if (ns_marquee.left>(actualwidth*(-1)+8))* l* P* v, m/ {+ w
ns_marquee.left-=copyspeed
5 x0 e v' H% u! `, M2 d" E% Z ]# pelse
: t1 I3 I+ }3 |$ q/ l! V4 u8 T; | Zns_marquee.left=marqueewidth+8
- T" k$ W0 r( C. ^}
8 A6 G" r3 o) l% V}
0 D! U& P) B' Y, s8 _: u" e6 }# i! L5 q0 P6 H( {. f
if (iedom||document.layers){' w8 m& E1 {6 Z) K
with (document){
& ^: w/ W( B- |/ h$ Z( adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' S: T1 S$ K; C: c. Z- x7 J$ mif (iedom){. Y7 ~4 l% g' ~2 R! e* O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 t$ w, i2 Z: G0 a6 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 E8 J3 H# F6 U3 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# M3 _$ a+ v' A7 i bwrite('</div>')6 _4 p4 \' b9 X- y
}
- V( W# V5 w6 Y# i: B" Aelse if (document.layers){
) B6 r) w4 H$ h$ {% p1 J+ r0 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 T2 A9 O9 q1 X( b: Z y! Q8 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% c; y4 G ?0 O0 K6 _# Rwrite('</ilayer>'), s. ~/ ?! T. K8 l7 L
}& @5 n$ w: d8 A) e2 Z+ I
document.write('</td></table>')
: i" r: t) o. |4 [; j4 |}% z* R/ b5 h1 x+ Z" S$ q# q- T8 G
}
4 f/ G, [+ [1 l8 x</script> |
|