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

|
网页之跑马灯文字特效
//修改宽度
& a+ X, T* W' w7 y( e, Lvar marqueewidth=300# {# }5 N5 T, N
//高度; _6 r9 z) D/ _
var marqueeheight=25
0 K2 s3 R/ _( A//速度(1-10)$ F, U7 @2 ]. V' c3 M# c( G, H
var marqueespeed=3
. Q5 W" A' D5 E1 I2 W& {+ p7 G//背景颜色1 N; L* E: |6 G, Z( \, |
var marqueebgcolor="#FFFFFF"- [, L* Q# p) }& p! @
//是否能暂停 (0=no. 1=yes)?, i( c( f& B: ?/ t9 v/ Y. p* ?
var pauseit=17 T9 D7 f) j5 X
. g; |8 w4 E1 C. ~! s0 v. J% t//修改显示内容9 @0 }# _ J& M+ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') P, |1 I" [1 M+ v' W
: \1 }! O% N) p- W0 x' c E; ?2 j, Q2 H" b
////下面不需改变////////////0 Q) i# q+ v. I( w. {) Z
/ k I- n" u- j6 O
var copyspeed=marqueespeed9 L4 h4 G- V6 ^% S! Y3 q
var pausespeed=(pauseit==0)? copyspeed: 0
6 l n% e( u0 `% R: l& b1 bvar iedom=document.all||document.getElementById6 Y6 w5 @. Z6 m- e
if (iedom)1 V9 K% \9 l" ]1 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: l& ?" \5 O' Q. W& G; i# F: Uvar actualwidth=''
) J/ S. ^5 r6 H4 e. T* @6 d' J+ Zvar cross_marquee, ns_marquee+ O- X/ t( x# @1 o1 K x
3 f, Y. |/ E" ]4 i H
function populate(){
0 ]$ ? |8 D! B# y4 Iif (iedom){
) Y+ w6 U. A9 c% S8 K+ Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. \! ?4 P/ c G: W/ ?7 tcross_marquee.style.left=marqueewidth+8* {5 h2 P' H% \ L' ?% ^
cross_marquee.innerHTML=marqueecontent
@, J5 q4 p7 G1 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 O" W' s5 f% F2 E, z8 ] Y}
0 v: F0 a7 k6 @1 b! Yelse if (document.layers){
: Z3 d; |5 k( B, b# w. R6 Lns_marquee=document.ns_marquee.document.ns_marquee2+ l0 C$ ]9 `8 S! O
ns_marquee.left=marqueewidth+8
' V( K; _7 t$ f& t4 H# w; ens_marquee.document.write(marqueecontent)
# U% z( v; k Y( i8 {& I. d r0 [1 cns_marquee.document.close()
$ ?9 w* D- y W/ vactualwidth=ns_marquee.document.width0 U- e. n6 E9 f5 {3 x
}
0 E+ G! ~% n% G6 r! |lefttime=setInterval("scrollmarquee()",20)2 S8 i$ x. o2 w, w
}
- X& r1 e2 C1 I6 _ @1 b& @window.onload=populate. ]2 S6 D3 }2 j, K% ~
6 f+ G: m0 G: f, ?
function scrollmarquee(){
" q) T e' E) h/ V3 A6 oif (iedom){
: M: s+ Y. @( s* [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# S- G0 c* j- g. I- r9 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 L- N% Y/ `; ^+ \3 I! R4 v
else ~9 N, H% `2 E$ b; H! | R% o
cross_marquee.style.left=marqueewidth+8
3 k5 F0 e+ ]7 _* V7 l: J6 Q
! r8 I3 ~ J+ N* Q& G, `; {}1 U; F0 F& ]9 k1 z2 s
else if (document.layers){
& _% @* c1 w2 _. @if (ns_marquee.left>(actualwidth*(-1)+8))
" G' \0 a; _ ~9 mns_marquee.left-=copyspeed' @; h3 H( ?$ R& n+ m! K: b
else
" m- w/ d3 A6 B" N" qns_marquee.left=marqueewidth+8
! v; t5 v* B# Q3 c+ k# s' h+ i}
% m1 n0 ~1 m4 l& z}: ?0 R+ R5 q* U# k$ J9 `" j3 b
1 l3 {4 Q) c. L2 k* u1 Oif (iedom||document.layers){
I9 y" Y. X7 Twith (document){" p5 v( ]: ?/ B& H! _, j6 `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' f8 H% Q, r& ]3 G tif (iedom){
8 P% X* ^; `: I4 Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ P+ ?3 [, @' N+ O! f& \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 A7 J& P% m/ ]& _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 t: e+ Q5 E- y& w9 P9 ^% ?# rwrite('</div>')+ J% m* ~& ?+ w- r/ L8 L- k( Z, Z
}" P, Q9 W9 w) M; s% W
else if (document.layers){, v1 s: H. q- ~0 \2 u2 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). s! l3 ]$ R+ M# C$ B4 i1 a5 T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); \: s0 Z* }( w- w/ b$ M
write('</ilayer>')$ |$ Q0 g0 l6 l4 t3 x
}
& r) `& u% g T+ `! T0 I% Hdocument.write('</td></table>')+ E. S4 o9 N# }/ w5 `" }# ^
}" }3 F" y3 E: a
}# ?5 t* e' o2 y0 l+ K) u
</script> |
|