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

|
网页之跑马灯文字特效
//修改宽度
. L( u1 d' @6 ~/ j7 l8 mvar marqueewidth=300. W4 A1 q" B) N" w+ k; ^" X c
//高度
) P* g8 x+ p# b6 l* Y9 wvar marqueeheight=25
8 _7 I( n( r$ ^ U- V//速度(1-10)
9 h% {1 G* D1 ?9 f6 c- k2 Xvar marqueespeed=3, ^( r* ^4 J9 }, U2 N; w# r! F
//背景颜色5 w, j: e4 ]2 p% i3 K8 _3 z
var marqueebgcolor="#FFFFFF"" C# a! Z7 I3 _' z
//是否能暂停 (0=no. 1=yes)?7 j1 P# ^: Z/ u7 {* V" F' ^
var pauseit=1
8 r8 r; O3 Q$ p. _( _& c* W* ?( n3 J- m9 V. x# T8 }8 S1 k. I: Z7 w
//修改显示内容
$ u& ~% R) \; r6 J* C/ B R% ]# Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' e+ q% ]' F' x+ y2 P: R) m( K7 S* t
; }4 U$ Z5 J$ Z" t: f% }( l
////下面不需改变////////////6 r! O. C) E5 l' ~ z$ z0 d
% K- G( b4 h: ~2 k1 q# J3 i) A& K1 z
var copyspeed=marqueespeed2 L6 z, L# f9 W' r. J, M
var pausespeed=(pauseit==0)? copyspeed: 0
$ }6 a/ j3 @) vvar iedom=document.all||document.getElementById
Q9 }. k6 z) l9 b) wif (iedom)
% f! J, \2 h; T% |( |1 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! @+ N' S3 J0 y. I5 a
var actualwidth=''
0 r l0 v4 i5 }2 b0 V7 M7 u' Ivar cross_marquee, ns_marquee
% F8 l( |3 S# s% K
7 Y @1 \. v: R. W% `9 Vfunction populate(){
5 i* {; _3 j1 d7 d+ l$ Tif (iedom){
4 H. N) c2 z, J3 P1 S2 u4 H/ xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: N: A& m, Z/ i3 N: Ccross_marquee.style.left=marqueewidth+83 D6 d; l2 `" ~' v" |7 P6 u
cross_marquee.innerHTML=marqueecontent
* _5 r( Y- r7 V6 b# eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( Z' P+ ?# s: a/ { N& C
}
) v9 C1 T' f# G+ ?else if (document.layers){ U! H3 A0 ^. a7 t% I
ns_marquee=document.ns_marquee.document.ns_marquee2
5 O! X, e, o- w+ C$ ]+ C3 f3 q2 rns_marquee.left=marqueewidth+82 F* @5 q0 J* Q4 q, |4 M
ns_marquee.document.write(marqueecontent)) f0 r3 A. U4 S k( m- f
ns_marquee.document.close()1 z! L& {; k: c: b0 R- u3 z9 D _7 U
actualwidth=ns_marquee.document.width
, V* M l5 W( b9 x4 ~}
$ T7 L8 v4 ^6 f1 ]1 J2 Olefttime=setInterval("scrollmarquee()",20)
! o3 C3 E, X4 S) L# N}5 d8 @% K/ Q9 {: E: n
window.onload=populate U2 K; @9 M6 T s) ]
' D2 q9 I1 Q: k$ Xfunction scrollmarquee(){9 Q. e( _; F E5 N- s) \- I
if (iedom){
$ U% C$ W6 L8 x1 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) B% z" L4 N8 B: Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 x* Y! n% W$ U3 b! @' m
else
+ d1 s u T2 U5 m% ~cross_marquee.style.left=marqueewidth+8
0 t, w; Q3 J- k( \8 i8 _% [' e% f2 g+ H) z1 Q7 _3 q( K( D' Z( ]
}+ j0 O7 f+ b4 @3 H
else if (document.layers){
' m7 }8 m7 t1 P! u4 wif (ns_marquee.left>(actualwidth*(-1)+8))0 n' H. c+ }, `+ r& p
ns_marquee.left-=copyspeed
) |5 x. l4 H0 _2 j0 }# `else1 [* r# S( R; u4 F, F) ^
ns_marquee.left=marqueewidth+8
4 Q( A7 q+ i" E7 X" L$ ~1 m# F}
% N; T0 b5 m S; h; O: C0 C+ A& | ~}1 A! P, G: ]2 G/ {7 @! o: G6 n
9 K; |& ~9 f( y& [4 t' `if (iedom||document.layers){
$ `9 V1 @3 X1 X4 T2 `2 cwith (document){
; b# Y& {- C) y$ R9 r/ l: Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) h+ @4 ]1 S$ t9 Eif (iedom){
; K3 L, c& G: B/ bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' |) W' W- R3 v5 z2 H: T: vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- A0 t# O$ M- m) E W% ]2 W# S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- j5 C7 U$ u& l9 A0 C& w' Kwrite('</div>')
& u: D) @8 z/ ?}
0 s; N1 s! | S& J* X K, _else if (document.layers){, e1 O" Y6 K6 v* L) b( u4 t) p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 U, V. Y. t* V* o, \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 t1 O7 }3 z- ^5 `0 b$ N" G
write('</ilayer>')
; ^! i6 ~# o- J) N2 a}
7 G) f: B* d6 [8 C$ pdocument.write('</td></table>')2 I, d# \1 |. o9 X, K2 ^
}
a: ?( R# P" w3 G1 B}! p; U" Y9 O1 j- g/ p9 i$ l
</script> |
|