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

|
网页之跑马灯文字特效
//修改宽度
9 T) D# p e) Z9 Ovar marqueewidth=3003 K7 u$ n; D+ l2 `9 T! Q4 \
//高度4 D5 k! W7 f9 Y8 @, n! r/ Q
var marqueeheight=25+ s" ^& ]; ~% l5 Y# W% P1 Z5 z
//速度(1-10)) `; O% j( K5 T
var marqueespeed=3
; u }# }% q3 n; h* W3 K, I//背景颜色
4 E! D# ]# I' l- F; x2 ovar marqueebgcolor="#FFFFFF"7 Q- ^. P- p$ ~+ }' @) q
//是否能暂停 (0=no. 1=yes)?
4 m: ?4 k; d: K& }var pauseit=1
9 E8 _( V( f* e Z; K
) V8 y; x- }+ w' n1 H//修改显示内容, V) e, E" c, L6 b- k% G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. K+ B3 J @- f. N+ z4 A
8 a( \- q4 M0 }& t
! T4 f$ o7 }6 I) ?' Q! u& e////下面不需改变////////////
4 r' B/ }- U8 t* R4 s/ ?% a: c4 y+ O, t. v$ _
var copyspeed=marqueespeed
0 |, C7 \5 E' A+ `. Vvar pausespeed=(pauseit==0)? copyspeed: 0. H7 ]% U; ~! R9 [+ r
var iedom=document.all||document.getElementById
% P9 L4 W7 v9 i. c- Y# N, Rif (iedom)# Y: Z8 V% f a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& d: A' Z9 S) V, d- E
var actualwidth=''
& K/ X) |3 M" s& U8 H( f3 P: O6 t% K' ?var cross_marquee, ns_marquee
6 ~6 f0 m5 Z! m8 [) ]- d6 B8 D* z( M! q. S
function populate(){! l# _7 z1 G: T4 P
if (iedom){- X5 S2 G( x0 M8 M* [, ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* E7 k' C, v3 Y5 S8 @1 x0 z
cross_marquee.style.left=marqueewidth+8
' h" v: N! O/ @cross_marquee.innerHTML=marqueecontent! ~) m D7 l3 ~/ L$ h8 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" \, S( D$ P5 ]& s3 t: J& X( f}
+ O" N2 N: ?% l- V' aelse if (document.layers){9 @5 r# f" d6 T5 t# e
ns_marquee=document.ns_marquee.document.ns_marquee2
; d8 \* [2 T( _( _7 Wns_marquee.left=marqueewidth+8* q" {9 D2 j4 a- i' A4 b" Y$ ~
ns_marquee.document.write(marqueecontent)
" H4 z+ E0 ~' vns_marquee.document.close()
5 V1 k& A# m* L9 Wactualwidth=ns_marquee.document.width
. }' F7 N8 f' s X9 l, m+ F}
! q1 l, a0 [6 a; M! S! {- Llefttime=setInterval("scrollmarquee()",20)
$ G' ^* f5 Y+ E2 K) s( }1 [% c7 U0 Z}
: ]) k3 S; Y) T% f r, B ]( fwindow.onload=populate; G% B- l4 r7 _! |. a$ l; S
9 H1 z' i4 _/ q" H
function scrollmarquee(){$ |% r8 z: r8 b- z# @' |
if (iedom){
$ A9 l$ R( m2 I8 y' W7 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% f, p* j. c- b% ~, O0 \8 I/ ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 u) }4 r1 R& _; h* s& \
else2 G- T& r1 e3 }
cross_marquee.style.left=marqueewidth+8
2 o" u) O# b$ V) H6 }2 I3 \- v9 l/ }
}
, E' y ~/ n$ Helse if (document.layers){) _ X) \2 X3 d& L
if (ns_marquee.left>(actualwidth*(-1)+8))2 a" S: M: g7 h( x) w; ^
ns_marquee.left-=copyspeed$ T- i2 y. |) e/ i+ r, w: K
else
+ ?2 z! }2 ^" U6 v9 Ons_marquee.left=marqueewidth+8
* K4 \% w( f% \6 R- e. ~+ N}' R& ]; ~; s# y) a0 M. u
}; G4 u: ^# L0 u, S* X& h8 G* s. `- u
7 z2 y! e+ a. l5 \
if (iedom||document.layers){
; x) o! }% A- H/ dwith (document){& [# B, y7 p0 y- s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 U# L1 U/ _, _' B7 b
if (iedom){
5 l' K' r+ i) _* R5 L- Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* z- \" t W( y, b8 f' t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! k# `$ ~! v/ F4 |* l; p" uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# M0 n) ~5 |/ c; q5 W( e7 E8 }write('</div>')
1 G+ p; r5 s3 M' d% Q! {- j' R}
6 e4 [6 [2 |4 W j! H9 melse if (document.layers){2 ?% ^- {% Q" }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" S3 l$ l4 H3 Y5 o, @. u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 `2 t; H1 C1 Y4 g! b' I; swrite('</ilayer>')
* i* T: u( U+ \8 o# f4 v}1 O5 N( j$ K5 u: [! x- t& m4 b, e7 G
document.write('</td></table>')
2 w7 C1 ?/ `8 {0 z}1 k( h, \! |3 n9 Q# ~
}
3 v8 ^& W$ n1 {1 m4 A" H1 p1 q; [) l</script> |
|