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

|
网页之跑马灯文字特效
//修改宽度
$ p; Y$ I, e" K Y$ ~# R) kvar marqueewidth=300
0 J w& t, _4 }' n+ |$ w. ]' J) _//高度- T: b3 U! ?# A7 D9 I
var marqueeheight=255 Z6 M" ]$ c: Q$ R
//速度(1-10), w- t) r; K2 Y" n% V0 C
var marqueespeed=3
! x* p1 z& ?* n! @" \/ A: V" |//背景颜色
* t& C" s+ x1 Z+ D. Gvar marqueebgcolor="#FFFFFF"
7 D0 }# V+ B2 t* G2 D//是否能暂停 (0=no. 1=yes)?
! u0 @8 Y- Z! Y2 O1 i5 j# Wvar pauseit=1, G- @6 ^! Z& B/ C
/ ^$ B( q: {7 \+ a9 u7 D" {//修改显示内容% j6 J+ m3 |/ w: f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 w$ K8 [& h' k% u' d
/ c, M. S; `) _+ b% F/ E
# y$ W% X+ ]8 x. P" z, k9 M
////下面不需改变////////////! [% x1 y6 y! k% B1 y: ]+ ?; P9 Z
7 k/ q1 k) x5 qvar copyspeed=marqueespeed; q+ ]# p) F, M8 i. c5 F! E' Q
var pausespeed=(pauseit==0)? copyspeed: 0
! K. z% b' e: d1 F L( s8 j# \var iedom=document.all||document.getElementById
5 l3 g& z+ D* y7 [1 Fif (iedom)
+ G+ `! k. a* ^( S' c# Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 G" r$ b5 Y# f/ V- Y" Svar actualwidth=''0 O' q$ O" l) m0 ?
var cross_marquee, ns_marquee
$ ]) V9 b3 K; _) D8 ]. K$ I0 N- y; k/ U* n" u! T, k
function populate(){* e9 R, S- p% h, H
if (iedom){
. h! {$ @' T! b5 ^7 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% C( `# P0 v3 |) v0 D
cross_marquee.style.left=marqueewidth+8) G. s1 g7 T' g3 L* E0 F0 N
cross_marquee.innerHTML=marqueecontent+ P- E2 q8 _4 Z# ~0 e* {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# A1 N( Y9 X/ |3 k+ j# _5 B& y1 o
}! y+ R9 Y9 S& ?! g% n5 M
else if (document.layers){6 ?* B6 U' I. ^7 g1 V2 ~' ~
ns_marquee=document.ns_marquee.document.ns_marquee2
1 n4 h2 w2 Y3 [ns_marquee.left=marqueewidth+8
9 N; a F! \% p% c* N& @ns_marquee.document.write(marqueecontent)2 S! w/ {. A$ d% j8 E
ns_marquee.document.close()
/ l3 }2 m L0 {+ `actualwidth=ns_marquee.document.width8 B. J. [, z3 l7 c7 u
}' P v; K" K$ V: X3 R* Y
lefttime=setInterval("scrollmarquee()",20)# @3 ] @6 g2 _$ z
}
# a# q. ~% b) U! K. k( p$ P4 w; }window.onload=populate
) y+ r9 [# q) s/ [/ d; T
" e& h1 N2 X) u1 A6 K- sfunction scrollmarquee(){
6 z8 ?. J# f6 tif (iedom){
2 M4 ^# l F4 u! k9 g* Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" ^( U$ d& z" {- U: f$ Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ t& Z- _7 k+ ^7 B" n2 telse
- {! n# x$ o; P2 U7 w% C$ ?cross_marquee.style.left=marqueewidth+8
! m5 ~# F/ B" \, j. L0 J: S u1 \1 J: }$ _( V
}+ m4 k$ R" Y& I
else if (document.layers){' ~, j3 }7 H# h( J& D, t% z
if (ns_marquee.left>(actualwidth*(-1)+8))$ j7 _. \: f5 s* Q
ns_marquee.left-=copyspeed
8 Q2 ] F* O8 x; o9 Velse# v% G/ c0 a6 ~4 ~2 R; c
ns_marquee.left=marqueewidth+8' {8 C$ v8 y! K6 b; R, f
}" _5 l0 v7 K/ f3 f( i
}
+ U: r2 D# w1 f. A: Z t$ R
. z% z* F9 K ?4 E3 W0 A s5 Yif (iedom||document.layers){
. z3 w2 E3 R* o( S% \6 }with (document){
4 v3 g' v! E! {! \8 t9 W" Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% g2 i: ?" o" }% h1 E Cif (iedom){2 ^4 K' i& b; i' u" c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 l* b' t- z) S# swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') Y$ g+ o3 E3 f# w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 O+ y" n7 }, w iwrite('</div>')
+ x6 m* x6 C. E& w% g}
$ A; v2 X3 s3 u1 t: @else if (document.layers){( j% y9 x7 F G3 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 G5 P6 }4 [2 W% swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- g1 [. r$ `0 V5 a6 w+ _/ X
write('</ilayer>')9 P/ H# q% v4 n# Z
}
5 A R1 h" Y. |, k: Q5 u* h+ A& T" tdocument.write('</td></table>')9 x1 ~( o" U6 r# ^
}1 ?8 w; p: N2 c3 x/ c( j2 b
}
- `7 U% E6 `0 |7 ]) Z</script> |
|