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

|
网页之跑马灯文字特效
//修改宽度
0 W) ]8 e+ |" J Nvar marqueewidth=300
7 P7 E: _6 Y* E' Y//高度% T( `$ c& n2 l7 W$ f" U9 \7 _
var marqueeheight=25/ {5 A6 M$ S- c3 r* L3 J# W
//速度(1-10)3 A2 X3 h/ s. z9 f6 x# }' h0 x
var marqueespeed=3/ n1 L1 V' c; \0 T; D
//背景颜色
Q. ^' z7 O7 h* dvar marqueebgcolor="#FFFFFF"
B: o6 k8 [' E: e: W//是否能暂停 (0=no. 1=yes)?- d* Y {' ^. v/ M5 E2 F
var pauseit=11 X5 F# m: ?, x0 E: E6 ~ X
) N* ^% ~: m* B+ R//修改显示内容& O% S! L: g: l- t# P' [7 l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 u( D- r1 M! o5 r
/ y$ c2 A) k+ ` Q: O% _2 l
. @2 ?( C- q& \: e, d
////下面不需改变////////////
8 L- w- a- [0 v7 Q2 ]7 ~. O# D9 o( Y3 B* V$ n* o$ }/ s
var copyspeed=marqueespeed
0 Z. A N( X9 p: ~& d% M. uvar pausespeed=(pauseit==0)? copyspeed: 0. m6 s" A/ z4 R0 g8 u# s
var iedom=document.all||document.getElementById
6 ^7 M: i. ?, [3 z. z+ Uif (iedom)5 }. @5 C( T9 _: \' L5 f7 T I7 M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 t& _0 o" o7 x3 J
var actualwidth=''4 N$ M8 D. Z" y$ B8 K( J0 u! b6 w
var cross_marquee, ns_marquee! d1 p x- b7 {5 R* C$ ]; ~& ~% D
2 j+ [2 j) z8 B' I8 \ W
function populate(){
6 k$ r1 Y" P' b* h+ h7 v- \- a4 w" }if (iedom){
+ p9 g" }3 d1 M) j. ~) P7 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, o) G& ^9 u3 A9 @
cross_marquee.style.left=marqueewidth+8
3 l3 n7 Z" J5 E, Mcross_marquee.innerHTML=marqueecontent
- t: L, k$ B0 a3 ?5 E- Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' O% b1 f$ b2 K# x/ C* u+ j; A( b}$ n! C8 B9 a: x' o* W9 Y) [, A
else if (document.layers){
7 S/ m3 B# n/ k; wns_marquee=document.ns_marquee.document.ns_marquee2
, S: n3 Z) e1 R* d4 q& ins_marquee.left=marqueewidth+8
& ?3 V1 o+ l9 r2 C) F& Q8 M0 sns_marquee.document.write(marqueecontent)
% T% ~' A" y1 v2 @1 N. {ns_marquee.document.close()2 u1 C1 p" y# ^0 l1 ]) w, Z( e
actualwidth=ns_marquee.document.width# r* X% u8 W" F8 J$ O3 I( u
}+ _+ J t$ B# I: r) K
lefttime=setInterval("scrollmarquee()",20)7 A" Z2 J) D8 f
}, a5 f- c! X( C/ d4 i
window.onload=populate! P7 p+ g+ A# W9 f0 a9 t4 v
Y4 k- ^0 O6 x
function scrollmarquee(){$ I% h% A9 p6 x9 m
if (iedom){/ E A" b3 u% t; S6 o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), v- w0 F l5 g8 x5 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 m; L' o/ I# d1 g% t
else$ c5 T: X! ? e
cross_marquee.style.left=marqueewidth+8
$ m" Y5 r c; {) g, s& V; i" Q7 A: {6 ^( R/ t5 ~
}
- H% `5 r# i7 q/ \# jelse if (document.layers){7 U" B* W; u% n N! [7 S; T |
if (ns_marquee.left>(actualwidth*(-1)+8)): e' x0 w7 U* c" H4 e ?3 f2 B
ns_marquee.left-=copyspeed
( m# D- g* C7 i( I6 o' melse
2 N6 }9 x) O/ u' c1 {; `ns_marquee.left=marqueewidth+8
) N/ P9 j% s) N+ t2 U}( h& D% t+ _7 ^/ e
}
$ q4 m$ V t1 [& @1 r$ z* ^- n4 F+ b0 s* l6 O9 z
if (iedom||document.layers){
) _5 R# w) w2 z' a* }* |. xwith (document){
- D1 z# W$ T9 H, ~2 u" ^- s. hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* Q7 g# A8 G8 \- a. \if (iedom){9 |9 ^. a( G& x n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* e1 z; ?" k4 I) Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( U0 C! h5 w) T; M( `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- q! C1 c- B8 ? R8 Bwrite('</div>')9 E5 R7 Y5 y3 B
}% J6 A+ f3 K$ Q1 L
else if (document.layers){* H+ F3 z* f8 E# C" s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# H) i! ~' O, x4 s8 }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 C6 Q) F$ g; X" j# ~" d) Bwrite('</ilayer>')" T9 [2 X6 j, l, L, M' |' }
}
8 @& a8 a, @. s, o2 q( _! e, z& sdocument.write('</td></table>')
8 S6 J% a( }" p8 E2 W}
; @2 Y! j) T& D* {: E}
% ]2 y4 }2 Y0 c$ p3 f4 Z, {6 n</script> |
|