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

|
网页之跑马灯文字特效
//修改宽度" Z6 L V }8 F; \9 J$ t+ V% c# z+ S; S
var marqueewidth=300
8 _" B% h- C9 U+ n3 X//高度, M' h: t% K- ~
var marqueeheight=25
6 O: ?. ^5 r/ c* S: ~2 v//速度(1-10)) x) K, d* ]. x8 C" h
var marqueespeed=3" o# J& G- v& }$ i: q+ I0 O5 n2 W
//背景颜色7 u0 T! y& Q4 ]$ G4 u$ b+ Y4 A6 `; S
var marqueebgcolor="#FFFFFF"
( H, Z; U2 ?" a: P" }+ y" R//是否能暂停 (0=no. 1=yes)?
' {. \$ F8 I8 m5 [, P( d- V: ~; Bvar pauseit=1+ d' J1 z, c4 R/ Y/ k
8 d9 V! {$ h0 N- c
//修改显示内容
# {& v# B9 s/ s0 T& Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ d! o B/ E( J. M; J5 E5 @ d
' G3 u6 W) ^: r& i8 d9 _
9 @0 }" [( V I& x* o! {////下面不需改变////////////9 v) D' {5 ~6 A: Z! U
W8 |2 h8 L9 N# ?
var copyspeed=marqueespeed
: T+ r2 U: K5 h ^var pausespeed=(pauseit==0)? copyspeed: 0+ |9 w3 B5 e* o
var iedom=document.all||document.getElementById
/ |+ B8 k* y ?0 A/ Jif (iedom)& A2 {- B2 m, }) F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ |; j" t1 c1 i. J7 Ovar actualwidth=''. L2 p3 A6 S0 k i- [+ b5 H% l$ A$ E
var cross_marquee, ns_marquee
" O# O- ~2 N9 U6 l
; m3 N9 |6 B) X9 p+ Bfunction populate(){
' h3 Z, |! _: F! d7 hif (iedom){) L) V s8 [- I/ D& j$ ?4 R6 k; @! G* g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( z! C, @. o/ ucross_marquee.style.left=marqueewidth+8
- \3 p* Z, C b8 Ocross_marquee.innerHTML=marqueecontent" p# {6 t$ S( \; x: G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 ?+ _5 p% T( j/ ?" D, A2 W% ?}" ]% j. G; D2 U; ^' F& D9 D3 P% X
else if (document.layers){
) w8 g, h; @& F3 s: dns_marquee=document.ns_marquee.document.ns_marquee25 l A6 t% q& \0 \& J; p! Q1 e
ns_marquee.left=marqueewidth+8
/ e6 H$ }2 o9 A% ]! |7 ~ns_marquee.document.write(marqueecontent): Q4 r m$ h$ ?8 N) S D
ns_marquee.document.close()# \+ g* l. V0 X. E
actualwidth=ns_marquee.document.width
! ~ Z- k7 @. n4 Z, V( q* A6 n1 H}
- y* S, X( }0 y$ klefttime=setInterval("scrollmarquee()",20)
: F4 I1 x# h: y& l1 ~1 M' ^}+ o" ^. U, \( b' A" r2 O
window.onload=populate
4 \5 e& J" |0 P3 `! E/ X
p, g* X" {* ffunction scrollmarquee(){) k/ l. T# B* Y. j
if (iedom){
6 T! o- w5 P/ j% Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' X4 C, O6 {3 u2 H1 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 |' t/ y1 B, m X
else
& @ T$ u9 J: V# L1 Rcross_marquee.style.left=marqueewidth+8
& h6 @+ v' U# v$ d, e: D
1 o% b% }' l D$ Y}
/ u: O& [; S4 z3 F' \+ Velse if (document.layers){
: _3 S4 \0 c- q& Y5 L- Hif (ns_marquee.left>(actualwidth*(-1)+8))
% {% [4 w/ H3 d* l$ [ns_marquee.left-=copyspeed
6 @0 n! ^3 u2 R. Celse
, B6 t9 t0 g/ A0 W' P5 Pns_marquee.left=marqueewidth+8
* _5 V/ e# f( ]& T9 }+ R' X+ r}" } W$ I: R9 U4 L
}" H A! }) ^! n4 s
; z+ i& o. N! ]; d# S
if (iedom||document.layers){, r2 u) T* A3 [& h
with (document){
4 Z2 \+ }, s3 x) M2 ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" X% V& a' Z. Y, i( K: d8 Zif (iedom){3 S4 n- Y2 U4 ?' m% M; L! J1 I, B$ |' M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); D. X) p0 g/ T" j! a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, g9 |6 u! B$ m- `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( T9 \$ o; @' K b4 c2 o$ X9 rwrite('</div>')
( }* |( T$ S! J}# F( ^7 f1 C8 I: @ B% ?
else if (document.layers){) X/ M t$ F# c7 y8 [% j; m( ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 |/ H- J9 w4 }8 z+ g5 U% Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 n3 S! H, L# w; Awrite('</ilayer>')3 q. M" C- ?2 |7 _$ _# b+ m, `
}# D. x3 r+ e. f! J
document.write('</td></table>')7 J; {: y8 u& u% ]! ^) T" G
}# `, e7 b' y: o5 [9 a4 [9 E
}
6 T/ Q( {# g& w& B; t</script> |
|