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

|
网页之跑马灯文字特效
//修改宽度
! ?3 j- t5 n! P5 }2 Y+ O5 ]var marqueewidth=300
5 E& b3 g. Z5 z) E//高度
[# T5 {0 h6 p- p3 nvar marqueeheight=250 R& J8 E+ x' [+ n, Q
//速度(1-10)
3 {: K7 z4 Z. o5 c4 `var marqueespeed=3
; x$ E3 S. N. ]; z% W/ P0 V//背景颜色/ }5 e+ c6 v T7 `7 F* k2 v
var marqueebgcolor="#FFFFFF"2 N8 i; r4 l" E5 M; T; i1 z
//是否能暂停 (0=no. 1=yes)?
2 ^) X4 H3 ?$ mvar pauseit=1. {: {# y" d1 j3 F9 }6 b
+ P N5 f. z7 A" S* ~
//修改显示内容
4 g6 g( F/ y. u6 ]& kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ?% b& |& c7 T( N
; y5 E; s8 |2 U% z/ I. n* i+ d u
////下面不需改变////////////$ a$ H r& i r9 L0 U, A0 D1 d
, h; j2 M6 y) s1 `, M& m6 R$ Kvar copyspeed=marqueespeed
$ \' y) W4 L; b; R: n% v' w# y c/ uvar pausespeed=(pauseit==0)? copyspeed: 0
9 f: ] c# m3 n9 A4 dvar iedom=document.all||document.getElementById
( H! Q! E/ u T1 x' Sif (iedom)
; N2 N7 E5 i5 J0 n) u4 o( {/ b4 B1 t) sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" z2 F& ?" k; Ivar actualwidth=''8 z! \. ^0 q. y+ m3 b
var cross_marquee, ns_marquee9 ~& w8 E( k- \7 E1 e
9 h0 z& y4 S+ j3 j- O. e. Ofunction populate(){. _. {' x8 ^% h# d
if (iedom){% A$ B& v( l' P3 D6 }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& G0 I) u+ c+ O" i7 _
cross_marquee.style.left=marqueewidth+8 t$ J; D+ O3 i( k9 Y
cross_marquee.innerHTML=marqueecontent
' b& s/ K1 }6 x3 O& V1 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 N2 A7 {$ n' F; a9 | Y! ^
}
: X2 @# u$ I) q1 L qelse if (document.layers){
! J' r3 e8 s/ k% J) cns_marquee=document.ns_marquee.document.ns_marquee2# R8 Y5 B5 X# y. }. |
ns_marquee.left=marqueewidth+8
( _7 t) Q+ ^: _1 I% Jns_marquee.document.write(marqueecontent)
$ E& F8 j% T7 Y+ ans_marquee.document.close()8 w) S; D# p r4 i
actualwidth=ns_marquee.document.width
! I- F1 m8 @2 a- H& V1 S, k}7 G! @4 |" i/ G6 g3 x; E. j
lefttime=setInterval("scrollmarquee()",20): H, p6 w N5 |
}
+ U i% v1 ?3 H1 d. Bwindow.onload=populate
( D2 o6 T4 f3 A% h2 j9 Q0 s' C# F) A9 W
function scrollmarquee(){, E9 @3 o( C! ?' {
if (iedom){
6 i( D0 g6 s7 C' I# V6 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): _, j' u6 q# [0 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% k0 r) R E- F0 Melse
/ s8 L2 A4 X6 ]) c2 p! \. |. gcross_marquee.style.left=marqueewidth+8
" v6 v( \& h% \; V+ G- a b$ b8 r% e, L, y& q
}
2 L1 E* Z! q. |! t) I" Helse if (document.layers){: T4 D' |; w1 b: D
if (ns_marquee.left>(actualwidth*(-1)+8))
: R+ q6 U2 Z. G; C+ Q8 y1 F$ }ns_marquee.left-=copyspeed
v" }7 A, {3 K* L3 velse) _# R0 W5 {" W; k2 r
ns_marquee.left=marqueewidth+8
V) z2 S) H _6 k, I, t1 q) ^}
" @5 z; K v, s6 s7 M/ r}
]! Z5 |! Q, B1 A0 Q
. X! ]! z* X. K: L' L# a0 p" Xif (iedom||document.layers){+ d' g) t4 A' {
with (document){
' Y8 [# e# ?. A' l3 w% z/ ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( s' E2 M$ h, I$ ]' @
if (iedom){* {& e% P: Y( `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& o5 W* C+ S: y% D# g' w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 q0 g0 v5 `& H* Q% [% w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# u+ e1 g7 r' ?# ]: n) owrite('</div>')7 g, { U! X2 v" t
}- A6 _2 K0 m: C# ?
else if (document.layers){/ Q; {# w& Z% g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% H/ F7 E# h( B W! `8 l o& xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: Q+ @# E' x+ [# L- s5 V. @' Cwrite('</ilayer>')
! K/ Y( M {3 l. A}% X4 D" r5 a$ d( I' q' @/ v( U
document.write('</td></table>')3 |- e/ r- e0 U: D
}5 `3 ?. f# h3 a( b7 N
}
# R0 g1 B4 b3 a& E; Y& f: m</script> |
|