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

|
网页之跑马灯文字特效
//修改宽度7 J X2 k( ^/ A& m# Q i( k
var marqueewidth=300$ }0 }' P$ y/ a7 s W0 _
//高度
! Z$ ^5 }4 Q+ u; V1 n% yvar marqueeheight=25# E- t4 v5 _* n' h: g
//速度(1-10): H! Z* s/ `/ C* K
var marqueespeed=3
- S: K/ r6 y$ `6 z' K//背景颜色
# H/ ~, Z1 U! Zvar marqueebgcolor="#FFFFFF"
; f6 G' K! o3 B+ R" E4 X//是否能暂停 (0=no. 1=yes)?
0 [7 U3 B+ ~8 a4 wvar pauseit=1
' A G3 x# G' ~# \$ v
7 X8 ]3 }$ S' w8 [8 `//修改显示内容2 W: Z5 q0 a- b: ~3 _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# V0 p' ^& J9 D! |8 I6 E8 u
) y8 ], a! p2 f# C: u Z
) k0 `& P( [" R* q' T# H: s////下面不需改变////////////& n) ?) t5 }1 f \
7 T! ?0 i; D3 Q/ Rvar copyspeed=marqueespeed
, G2 [ m( V$ Uvar pausespeed=(pauseit==0)? copyspeed: 01 u8 K% q! W H2 R2 ]6 r$ _1 K: t
var iedom=document.all||document.getElementById: X4 {3 g: E9 v& E4 ~7 M- I( W/ D
if (iedom)
' D- c; L/ L! v$ }) cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ M5 _* } g" B5 h/ J5 w. ?
var actualwidth='' M& C5 g5 R% s, j9 ^, F5 U. U
var cross_marquee, ns_marquee
. B# q; ~+ h: k% R# O& Y; t, _) K* B
function populate(){3 p, c" x$ U( [9 }. N! c: ]. _0 |
if (iedom){; a. ~+ b8 _; {, [" a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 y4 N; n7 Y3 I) p; W# e8 f5 ]cross_marquee.style.left=marqueewidth+89 w. I8 [$ n' x& q- j
cross_marquee.innerHTML=marqueecontent
; d5 S) a8 F/ oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' ]1 p) u. k% h# h
}
! w1 G, M% D5 c5 H# k3 V/ o8 Telse if (document.layers){) W8 ^" C8 o! z8 S
ns_marquee=document.ns_marquee.document.ns_marquee2& r f8 t8 V# ^. F1 Y# O
ns_marquee.left=marqueewidth+8
2 E ]& E3 i& b9 |9 {0 r0 r jns_marquee.document.write(marqueecontent)
+ W" [8 |3 @" \) n5 \3 q+ {# m* ens_marquee.document.close()
, O+ F" ]0 @$ s, n# L5 M' @actualwidth=ns_marquee.document.width
5 T6 ]5 i1 A. _& ]& d}
$ u- q# N# S& T/ ~. y6 {6 S( }+ Zlefttime=setInterval("scrollmarquee()",20)
3 I) M- O5 ~$ v7 h, ?' P3 l}
2 _% h4 u0 N1 z/ B& F% pwindow.onload=populate C! G3 D2 C8 m6 L% Z; |( {1 _
9 j" b& W2 ]# K# x' H/ tfunction scrollmarquee(){
( Q" ~! j" P! k" d3 uif (iedom){. J0 F0 n! r5 e; j% u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 Z* _% I) i4 c2 Y+ X# T, }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* _7 k+ Y' N. E4 a8 ^7 l
else
9 {$ ]# |* W* T6 w8 t2 ocross_marquee.style.left=marqueewidth+8
0 H4 Q& A& b, e! P2 L4 |1 h7 k+ j3 {. H/ P: ^* c0 g1 E: f, O
}
3 }" X4 i2 a" ]: b0 l1 jelse if (document.layers){3 D4 t2 G: d! N" \/ T
if (ns_marquee.left>(actualwidth*(-1)+8))
4 r4 `" @9 X: ans_marquee.left-=copyspeed' [+ y/ B M; F/ x4 U9 m( K Q9 \
else
{1 b& S P( i" M3 |' Z" N- dns_marquee.left=marqueewidth+8) M4 w6 Z' g( z/ K5 |
}
4 s9 `4 }* v* p! K8 F}
' y. e* Q5 h' q) T' O9 N9 f* M; p9 ^) b) C( _
if (iedom||document.layers){
( M! Y7 @" s U5 r6 i; Mwith (document){
. y" c4 y; _. M, ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 u4 D$ K- b- d) k) C/ x' E; X
if (iedom){1 F& c) n5 N, j" a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 R* J9 |5 F) [0 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% t2 ]. `3 t$ d- r! d& owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ u9 ~# s4 ^. ^% A6 u0 G- Y9 l7 P
write('</div>')- T' f" \( r! A- m8 {0 ?. D
}
3 O: R* D# e1 C1 N. D' Y Y- Nelse if (document.layers){* E: ~7 k! b9 A- T: _& J. `$ ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# s0 Q( P% @- V0 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), c9 T% T' N0 z6 B" `' M
write('</ilayer>')
# i- n0 [- n& |- J7 j! z$ y}0 y+ u( r" k9 Z8 I, @( p
document.write('</td></table>')2 B& k: |% B1 ?9 n; D3 m
}9 l+ D: c5 E( Q. v0 G2 C0 P3 S
}
2 b7 u! d' t8 g$ Z</script> |
|