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

|
网页之跑马灯文字特效
//修改宽度
5 J' p7 I& `1 i' U" l" Q* Q7 nvar marqueewidth=3005 ^5 I. g5 F1 p- F
//高度6 [' n- {& T' ^- b8 v
var marqueeheight=25
8 B8 c3 u4 N2 h//速度(1-10)' ?9 \$ G! H8 U0 N
var marqueespeed=3* M% E% ^* r0 L
//背景颜色
" l6 J9 e1 ]$ n( ^var marqueebgcolor="#FFFFFF"
( |$ {4 g+ T% L6 ^: c6 C5 f* `//是否能暂停 (0=no. 1=yes)?
$ x; P |. k ?# d* [7 ^+ qvar pauseit=1
/ q% O4 [5 n, F n+ j' ~8 v" [) B7 W7 ^6 P
//修改显示内容
& i/ Q: X% G% x M3 f; k$ l, vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ o) B% O# F8 P, f7 {& {7 L* r0 N3 D* D2 d6 K k3 T
9 B7 T$ S! H2 s
////下面不需改变////////////
" C' \1 D$ I" h( @! M, L9 Z% U0 K" [! s: c9 n# B
var copyspeed=marqueespeed* j- h( A s! k# R% `
var pausespeed=(pauseit==0)? copyspeed: 0/ q' O9 N% Y3 E9 W
var iedom=document.all||document.getElementById8 t7 x( y4 X4 {5 X: K- A2 S
if (iedom)! E3 j l% r9 Y6 s5 N) O* H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% R: m7 _& v9 i! T- c+ p2 }: ]var actualwidth=''
2 H0 M1 X: ~* nvar cross_marquee, ns_marquee7 O9 W- K9 t$ a# ?
+ q ?4 E: a$ I _# w& P( C" `function populate(){
# ?5 Q6 l5 ?9 E3 H# Uif (iedom){
. r' ~+ o0 ~- R5 N6 ^5 C$ F$ G, Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! A( B0 X% C3 Pcross_marquee.style.left=marqueewidth+8$ q' Z9 {4 a3 k `: \, H
cross_marquee.innerHTML=marqueecontent
5 H( a& v; P. |4 G$ Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 d4 F' J4 p; E J7 a}
: Y! ?* F# G, ^& Gelse if (document.layers){- R& K; r4 G( b" K4 g3 V4 G
ns_marquee=document.ns_marquee.document.ns_marquee2' a# r. q" R8 s! h; j6 ]* b
ns_marquee.left=marqueewidth+8
& A- a: z% U' x; F1 m! Hns_marquee.document.write(marqueecontent)
( q9 G' V, B9 wns_marquee.document.close()
) {7 K9 m; r' ^( `. ~" Ractualwidth=ns_marquee.document.width4 v' | B( z1 K, }
}# o' ?/ D/ s5 |2 R& e+ `. ^
lefttime=setInterval("scrollmarquee()",20)! q, H4 |& a8 u- o
}
4 u1 X+ r3 { j# u! L- [window.onload=populate
+ V$ t, w0 O. p: g) }% I- h( b/ C3 x1 S( W' ?/ y! U: c( _3 q$ e
function scrollmarquee(){3 I6 T$ Z+ X. e+ |% c ]
if (iedom){& y& i' D- C8 k+ c% f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 X$ E Q$ F7 C/ R0 ]: b8 p# Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ g0 @2 o+ m* W) s& q, r- qelse" Q( {' F; T S8 j5 J- ^9 E5 p
cross_marquee.style.left=marqueewidth+8
, Q Q4 J& { ]5 v t, G& g; @, n. r0 V" {4 b- r
}; z1 x3 L f# H
else if (document.layers){
, P3 I& ~6 ?* R7 p( D7 sif (ns_marquee.left>(actualwidth*(-1)+8))
- l) L# F' [$ B& A' n. H {) p1 xns_marquee.left-=copyspeed% [* n( K C L, N9 Z0 N# z
else
4 I$ |- k5 P' J4 s& G. ^8 g( fns_marquee.left=marqueewidth+8
# [9 Q A g& |& v2 r: a}# Y* ]. @ S) j O5 D/ Y2 }4 m
}
0 ~4 c' B0 t) }% o# \& ~; y8 Q% T+ b H5 \. L
if (iedom||document.layers){
) f6 B. Z( b6 {% {with (document){
! E; K5 H: r6 _+ L9 q9 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% A- q$ h4 F/ I8 q& O
if (iedom){" @2 h% e1 Y/ z$ R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), x/ X5 p( o- s9 l+ V# E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ z. j' Q( ^* ^* G3 P. o Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! Q: I" @0 V7 G* O3 ~6 d9 dwrite('</div>')" m8 W/ w. s% Q3 D2 K& ~
}
2 }. } N( f' U, B8 ^# s# melse if (document.layers){
" W( r/ E7 o4 t, o) k, i4 j4 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# C" L/ K+ u. `$ D G2 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ q* N( W- ?' U E, q0 h; N% Vwrite('</ilayer>')# \& p+ w, @7 v, |! b5 x
}
) S8 R( x( N6 T8 b5 Q0 wdocument.write('</td></table>')
7 j+ G: P7 S8 r. q} M( V& Z3 ]- t R+ I
}0 E: T0 |2 q8 h4 J; [
</script> |
|