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

|
网页之跑马灯文字特效
//修改宽度: u7 w& U4 ]' H$ W- h+ y* ~6 u
var marqueewidth=300# q, g& n, a# K. z
//高度% T) l, I5 C' l) J
var marqueeheight=25) O0 s7 X: @4 x; m
//速度(1-10)6 J( R i: q0 q
var marqueespeed=3' i1 n- {1 N& P
//背景颜色
3 j h+ p ]9 L+ a. y5 bvar marqueebgcolor="#FFFFFF"
2 l- K" O1 Q, t8 o" W//是否能暂停 (0=no. 1=yes)?: r1 k& S7 _7 Q( a
var pauseit=12 }! N/ b& n" k# x6 M
6 X8 z1 `3 Q* c& g2 [5 u, Z//修改显示内容& N5 S* N' _1 I' B: N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 `) j5 A1 F) w; a! ^) M" v
5 f6 s2 Z! v; F/ b" n9 V5 [
s- ^1 E2 B) A
////下面不需改变////////////
0 d: u" f0 }1 Q8 b/ L! V+ {5 T1 I5 K! h9 D s' N5 n
var copyspeed=marqueespeed
) g0 \* a" n+ Y9 q: Q: ~var pausespeed=(pauseit==0)? copyspeed: 0
! V! t. _6 j }! Y# l7 V% v! [var iedom=document.all||document.getElementById3 I1 |& X: x+ F+ q8 I
if (iedom)7 Q3 C2 V' @( x1 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( E3 o. d+ ?) U7 D5 W+ E0 {8 Kvar actualwidth='', m- M7 J5 x7 t& {
var cross_marquee, ns_marquee
C4 i& a+ q/ t$ y5 q. u. F& Y! O1 m. L+ m, C. g) m4 W
function populate(){
: a6 ]; N# w6 V& d1 ~6 Iif (iedom){& r; h; @: s9 b8 ~% [2 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, l1 {0 F% e5 X" S4 q. m
cross_marquee.style.left=marqueewidth+8; P D0 c0 t# ]* t+ B( O
cross_marquee.innerHTML=marqueecontent/ {. h. y4 w- [7 u: |4 h" S4 k* B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 K! _3 X1 K# Z* s}
4 ]% S3 Z5 J! ^- q+ X; R9 z/ Ielse if (document.layers){: f4 k/ M# f' `! w! P. r
ns_marquee=document.ns_marquee.document.ns_marquee2
! v" s8 M! m! ^4 Q9 \ns_marquee.left=marqueewidth+8! x, T2 \) n( K2 b
ns_marquee.document.write(marqueecontent)( t7 `/ ?5 s% E" I
ns_marquee.document.close()
1 j* A( X( q' Z6 l a& yactualwidth=ns_marquee.document.width
/ [3 r- |. C9 ~ C8 [$ X8 J! n}
7 D) \! g- V5 i* W' X9 wlefttime=setInterval("scrollmarquee()",20)
f( y8 _4 Q6 _* _}
4 A3 y; N3 x7 F J+ o, Lwindow.onload=populate
; _! ]2 R. V$ A5 ?) V' |) ]; d. O% w
function scrollmarquee(){
) E# D; t( o4 tif (iedom){
3 J0 F4 D! \& @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& l3 }& A) f$ h6 y8 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ @+ _# U+ r8 z- |9 ]' \
else) H% v$ w5 \8 K: |: Z# @
cross_marquee.style.left=marqueewidth+8
3 S6 x/ W( y2 t. ]3 ^. K1 N. C: Q* S2 {% M6 E5 O0 S `: |7 M5 s% u8 `
}3 n2 M# ~* V- V; R* K7 f% C
else if (document.layers){+ y) |' N# J `+ _- X
if (ns_marquee.left>(actualwidth*(-1)+8)), l2 ?4 o$ Y4 T( N! a1 m$ |* L
ns_marquee.left-=copyspeed
! }: t$ b% O+ Y1 W) V0 Q: o/ m& \else8 l5 S* o4 U1 Q3 G. _6 G- B
ns_marquee.left=marqueewidth+85 D8 f' Y& H- R
}
% p6 v7 Y) k% K9 S/ o}
; D6 @( T& R/ h) K! J( N. ` {: l N( p- }: L3 K
if (iedom||document.layers){3 e& \6 ?' T. p1 J# H: Q$ K5 N9 z
with (document){$ o4 I3 _( [: n8 n) _8 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& a0 D# S! c* E; y/ e; E# Pif (iedom){9 P% z+ w; ?0 M/ O4 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 Z1 }6 h( S( i, N; ~2 s% o: Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! D5 r& z6 ]) b1 P/ t, Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 u r- G8 o. R$ q% |. \write('</div>')
0 S3 A$ u1 \ W& x6 X}
. e) W/ o# d, L5 O8 ^/ G* {, I0 Belse if (document.layers){0 x- J: N6 m {2 C L6 j* @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" x6 g" R+ P8 G) _1 u# z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# w/ q% E# P1 Swrite('</ilayer>')
$ m U& {- A0 h# J4 e* [1 V}0 n i' `# J" Y% M% B0 f( I# n
document.write('</td></table>')# S2 P+ u, z' j9 ^( g l8 P3 I+ t
}
3 ?' w% V( a8 \% W- @; ^- I, F2 e}
3 ~7 L! K' v3 z+ @6 a7 n</script> |
|