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

|
网页之跑马灯文字特效
//修改宽度6 c$ R2 v3 a2 V. A
var marqueewidth=3003 @6 B7 r9 l0 O! H) h! G" b# F) P, m
//高度
9 l' J. `6 E9 q1 ivar marqueeheight=25
/ l4 l) e" m& a h& M: u( h//速度(1-10)
. a Z) D; B3 n hvar marqueespeed=3+ _+ a- c. [% @6 l6 y0 x
//背景颜色
; T# A/ u- c: z' k3 |" u+ c: ~var marqueebgcolor="#FFFFFF"
& F. L5 B; f ^3 x" |//是否能暂停 (0=no. 1=yes)?
8 |! i* T( W% _7 O$ L7 evar pauseit=1, |0 D4 J% X6 u: O( ^
5 {# n& @; t% `* V6 f- e/ }& t//修改显示内容# D8 h3 e, L5 U& _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': e$ H2 _, @0 ~# A9 a. f( p
0 J* X5 T9 V" c5 ~% A
( k* D( [# O: i; @% o g////下面不需改变////////////& x. G; h, }9 t+ O
8 s; k( ?2 ~2 X6 B% N& A
var copyspeed=marqueespeed# x( _/ q% f' u4 s h8 `
var pausespeed=(pauseit==0)? copyspeed: 0, Q2 I" a! T7 C% O. e
var iedom=document.all||document.getElementById0 H& t: Q$ U2 J* {) }/ N
if (iedom): V8 T0 v, L+ u# e" P$ U5 }3 {2 k: ~" q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 u& \+ z1 A. J5 Zvar actualwidth=''4 t" y2 y$ q& U1 y" d0 F$ r
var cross_marquee, ns_marquee
; Y2 I& m# x; J7 L6 ?/ W6 d( [. x9 W) H( p6 c& T1 D
function populate(){
) x; ]7 e/ R/ ]1 H0 Jif (iedom){
6 c, K8 B3 U! V+ }8 F: bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 A$ C; n, N% J0 z0 C* gcross_marquee.style.left=marqueewidth+8! b" v _6 T! q" z/ n" {6 R
cross_marquee.innerHTML=marqueecontent
+ T/ |+ M& m/ J* o, Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- M$ c9 l% G6 _$ u
}1 J4 Q, N* Q! k, _7 z3 k2 M
else if (document.layers){9 o+ u" V2 B6 u4 \/ m
ns_marquee=document.ns_marquee.document.ns_marquee2
# _( n7 ~" i: X0 X+ tns_marquee.left=marqueewidth+8
, L J) k& Q2 ~- i: H4 Xns_marquee.document.write(marqueecontent)
' W: f @# M3 j. t- {ns_marquee.document.close()
% c, X5 r4 M8 t. i: n' {actualwidth=ns_marquee.document.width' b; L9 l: U$ Y6 Q9 l
}
2 m/ W, q/ l' }# Q9 W% Zlefttime=setInterval("scrollmarquee()",20)6 E% C' b5 w; z; N# L! P8 ^7 O! W
}
- i) j7 _5 Y3 ]1 Y$ X+ Owindow.onload=populate5 N4 R" ^& e( q6 \$ N
- [1 B. N- d4 N
function scrollmarquee(){, g" }) ], w7 M5 Y# A; j, a
if (iedom){) B# a( U# w! {+ k6 g* I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# a0 w. j* K$ `3 U0 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ {7 n, [" k: }2 x ?else! I2 {% T: ~. b( }
cross_marquee.style.left=marqueewidth+8
: g4 e- a! p/ C4 G# `+ p
8 ^3 o$ s: l8 L}
8 P4 {7 a6 ~0 v2 H! b( W+ Oelse if (document.layers){3 s/ y) e& E2 q9 |/ ~, v6 B
if (ns_marquee.left>(actualwidth*(-1)+8))+ T7 ^, _9 }2 d+ L& q9 F) M
ns_marquee.left-=copyspeed
: e- X3 V4 K. V8 ielse' o& C' ^% C9 G5 O
ns_marquee.left=marqueewidth+8. V) M: Z% K6 }6 o7 X& p
}
& n& j" Q/ F" h8 ]4 | `$ G}0 E8 h; n7 J( r6 k4 A8 J; q/ \- G
# b1 c6 G1 Q( g! A. ^+ [" u
if (iedom||document.layers){
' C) o }% k [4 Qwith (document){
, k. E: x1 a- i3 [4 n) d6 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; b* G' ?1 m: n& S4 x' [6 |if (iedom){) H# g1 v* {' x8 b5 P6 @/ m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, ?/ l8 e$ A+ r0 f8 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ k' M! v; `5 r, q2 L2 ]$ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 T& m. E: N8 s7 b4 j% i( e
write('</div>')
7 X; A" P D A, ^8 C9 Q) b}
3 T" A0 d9 A# u+ T- Nelse if (document.layers){1 [6 K+ {( y* s% I# J6 z7 ?% U4 l+ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: a* y3 C: `+ _* O0 H; i, {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 r( F# F' B! R. D7 H7 cwrite('</ilayer>')
0 }7 k3 G4 x e C; z}- ]; T% t3 R! f; V. Z
document.write('</td></table>')
5 n/ C5 s6 U# O! A, _}# N7 _0 c/ e3 W9 f$ }7 Q
}. G5 q9 q: ? u# e; C
</script> |
|