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

|
网页之跑马灯文字特效
//修改宽度; `; S5 f& H: Y5 l( V# F
var marqueewidth=300* h' _/ V! p6 Z2 D9 H! B
//高度. I6 x- A6 c2 p
var marqueeheight=25* u; ~( | O4 j) A; ~8 K
//速度(1-10)
! A: U4 y' { X: l' fvar marqueespeed=3
4 T, H! v, j ]. B9 D. ?8 b* U( r//背景颜色 g/ j5 c* m, S- @
var marqueebgcolor="#FFFFFF"7 U! |+ Y2 d+ Z
//是否能暂停 (0=no. 1=yes)?
: k; n# B2 S4 Mvar pauseit=1
& L* M8 f' W {2 m; |2 H/ q2 C9 C+ @0 n. j
//修改显示内容
- Q, q+ q3 ^$ r* m3 ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" g5 d T7 B" m% M
0 s5 P/ m' u2 w2 G1 v( {# C/ J3 ~0 m% a* x; n
////下面不需改变////////////4 z! y+ n! b. G/ b s
& f+ Y' T1 r5 \4 ?6 Jvar copyspeed=marqueespeed
5 a( ^$ K0 P! v) P" Qvar pausespeed=(pauseit==0)? copyspeed: 0, e7 P, H& }( X8 b/ N
var iedom=document.all||document.getElementById/ V K- T) y# [6 q2 }( A
if (iedom)- Q: a: [6 k" W$ g6 p* Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ e( A8 [! [' j% L
var actualwidth=''0 \2 e# @% |, x# K4 K
var cross_marquee, ns_marquee
- C& c( t! x0 L* d5 Y9 @' ^* A2 i& z2 Z$ R4 `, F. B. H1 I
function populate(){$ x' U$ K/ n2 n7 ^) j" |9 d' v
if (iedom){
$ A, `1 v5 f* ~* b) icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, y# t' a" _- m8 rcross_marquee.style.left=marqueewidth+8
& l) s% L1 P4 a& W4 Ocross_marquee.innerHTML=marqueecontent3 `! ]0 ^: ~) P' k% J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) j# f( a9 j) c) F
}$ r% h1 \2 z8 Q4 r6 L
else if (document.layers){& Z1 a/ A( p2 \9 b( i
ns_marquee=document.ns_marquee.document.ns_marquee2( U8 h2 ]2 W: U
ns_marquee.left=marqueewidth+8 j7 i" A! h+ a" G8 s
ns_marquee.document.write(marqueecontent)' J# s3 |4 a- o/ T" [
ns_marquee.document.close()
0 S. S* v$ _; |2 factualwidth=ns_marquee.document.width0 f% e }! r- q& ]! L! w
}4 n( ]5 k+ l4 m. J+ V
lefttime=setInterval("scrollmarquee()",20)
, t- z9 q! e6 S- f% J& h}
+ U) M& v1 \. G9 jwindow.onload=populate2 r( w: Y$ B& f& [* L
. S9 k; p" P" O/ Z6 wfunction scrollmarquee(){
: Z; d* Y4 q& ^if (iedom){
2 r, h, S& S4 h: I! Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ ~# |; V" B8 t* ]7 ?* l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ z" i% A; x/ w% t0 @6 Z6 x+ |
else0 i' W4 ~. t7 s! d# d" x
cross_marquee.style.left=marqueewidth+8$ t' s8 L9 Q2 y# e
0 E2 w! _9 B+ @2 w: c}' E& j: q- `! S- i- f
else if (document.layers){# W2 K$ p4 I( `1 O
if (ns_marquee.left>(actualwidth*(-1)+8))6 Q! _8 Z" }! o7 s) U
ns_marquee.left-=copyspeed
4 ^ k) d$ Y9 j4 o5 u: Zelse3 U! X, N1 S c4 [$ e
ns_marquee.left=marqueewidth+8+ c6 M, M- V( ~
}- J' @9 i. {6 }6 A$ ]( w5 z& `( {/ V5 O
}
1 S/ O' I" s' o/ T- z: h" x" `7 _/ ~
if (iedom||document.layers){% I- R. J) @# a" f5 y8 C4 f
with (document){4 r' ~1 b9 m: `. e" r3 B; z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( o6 b7 v4 x# G) [# }& |' c
if (iedom){
. A$ W4 U- w# v2 L9 u- Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 g0 Y+ O1 T# q( p5 S9 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 t% z) O# ]( P5 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) B7 [0 @2 G. C# N
write('</div>')' l% `' | |3 i& }
}0 S; ^, D2 e$ N- g. S
else if (document.layers){ E! N# U: G4 S0 @1 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& j1 F4 P* V3 W6 l K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. o8 p- u( Z0 { K, m2 v( K1 Hwrite('</ilayer>')
) Z* p% L# D. B}$ m0 ?( P% J5 r
document.write('</td></table>') Y; h) _; F% \5 ?9 k$ v
}0 N9 k. ?6 M5 H+ H* u& y
}1 K0 Z6 a5 s+ c) V. R# R
</script> |
|