返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" |" j6 s/ d6 L5 i8 ^0 z9 N0 Zvar marqueewidth=300$ o/ G8 M4 h& T; E
//高度
( M# i) ]- m- T! S$ E4 Bvar marqueeheight=25) \) S) ?7 x1 v6 @5 v0 e4 y" M+ m  C4 s% ^
//速度(1-10)
, E9 L5 Y- G8 Uvar marqueespeed=3
1 W; U$ B" M2 e/ K: A//背景颜色
, S0 n0 B* n. ^* ^! yvar marqueebgcolor="#FFFFFF"
9 k+ ^. U2 J! y8 n" h//是否能暂停 (0=no. 1=yes)?& N) G0 l1 j  A+ ^% ?# N
var pauseit=1
" _4 x# {' {, o2 e! v
) r; m+ C" X" t6 U//修改显示内容
! I9 \* p% r/ V( ^( w! \5 Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ ?8 ~' I$ T. Z
( m+ \! z% ^3 |( b
" @7 Q/ ~: M% ]0 d////下面不需改变////////////
4 p  S) T0 Q4 l+ ]: _& ^5 r2 |
6 A- r! }2 N- o( `6 bvar copyspeed=marqueespeed
8 j. @8 ?7 `* s, S# Z, Ovar pausespeed=(pauseit==0)? copyspeed: 0/ q" M' _5 ^# v/ }7 C/ O0 C
var iedom=document.all||document.getElementById
5 _1 u; b8 ^- }* _9 Tif (iedom)
5 d; O8 {" j+ [6 w$ l8 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 C  j9 o; ^" ?& u
var actualwidth='') Q/ A9 i& T2 r) T! ^( `4 n
var cross_marquee, ns_marquee0 j1 [. ^0 h0 D# y3 ^: e

: [. q4 r9 M3 G+ `2 ~function populate(){
6 c$ x  ^7 G8 S5 B9 P  [' }if (iedom){: T- |% K& }; e. _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& _4 L8 ~7 t. t. U+ Wcross_marquee.style.left=marqueewidth+8' a$ e4 s) S7 k6 n7 ^
cross_marquee.innerHTML=marqueecontent
+ e7 I! P- B; t- h6 T" L7 w& B& zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; s" T5 ^. R( A  x
}
9 p/ H; I8 S6 j, W" A* helse if (document.layers){
6 @6 e6 M7 M0 uns_marquee=document.ns_marquee.document.ns_marquee2/ R6 ~" D3 ^1 S) t* {
ns_marquee.left=marqueewidth+8
! X- G8 W) x2 A8 K3 P' [3 jns_marquee.document.write(marqueecontent)
7 k  `% N9 Q8 ans_marquee.document.close()
) l5 ^' j! ~9 y+ `8 }& Ractualwidth=ns_marquee.document.width( [' {7 ?6 B" _. Y. m1 c  S6 X
}
0 L7 ?: s" f# `9 b# p+ Y! K  X) Klefttime=setInterval("scrollmarquee()",20)
* Z$ N/ R4 k- {7 l  u# X}+ g5 m+ M) E2 h  I1 A
window.onload=populate
" d! [' I, T; \3 u( ~) Y1 P
( K0 S( X, Q" {, ~function scrollmarquee(){
  r! V& e9 N% w. M% L$ Zif (iedom){0 z. u) s* e6 A: h/ `, [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 c" _* Z1 p0 F9 \2 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  @- v/ w( j' e" M- N
else0 }0 t7 l$ \9 G) m9 S3 _+ P
cross_marquee.style.left=marqueewidth+8
8 U5 z0 I' j* r" {/ S6 _$ ~* c/ c( ~$ W$ j, S5 c/ e! T
}4 F! |6 @# `. `9 J/ P
else if (document.layers){2 }+ O) Q0 O  k+ k+ m
if (ns_marquee.left>(actualwidth*(-1)+8)). i0 S3 G. V/ d; h$ c% W3 ^
ns_marquee.left-=copyspeed
$ {6 k3 D4 |9 W- G% P( Y  eelse6 g2 F  g  W: F" W1 ], y6 S/ W- c
ns_marquee.left=marqueewidth+8$ ~* h' g6 A2 ~$ S4 o
}
/ q% w3 i1 s; l1 B}
# ?/ K* x0 T5 g! s, L$ t( S& I% j7 y: W% s" `1 c3 M
if (iedom||document.layers){
8 |8 j# [6 u& ?  ]0 X$ cwith (document){5 s, R( u2 P+ S- v3 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# f* E+ _, c# D; t0 J. @
if (iedom){5 r; m1 w, H) g: {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ Q# D2 z( x) Y- t# n$ F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! o9 m- Q, D% l7 h5 N$ I/ {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& Q" c, u* C6 D6 u$ Q. w3 v
write('</div>')
9 X  D0 r) e# n. R2 F# p}/ ?  s! F4 a9 L
else if (document.layers){
& A  }- S" x6 t4 X/ x+ rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" m1 g  g/ A5 W2 Z* Q; `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 g: k, v& q, v7 t* I0 }
write('</ilayer>')5 I4 R9 b0 m6 w, H0 u0 ]
}
$ K1 X) l# u& v6 w) Rdocument.write('</td></table>')
2 d8 t) K2 p! z- Q5 Z}
: g) z7 e) q! l; X' t9 S5 N( Q}# |  V. Q& {  t7 |
</script>

返回列表
【捌玖网络】已经运行: