返回列表 发帖

网页之跑马灯文字特效

//修改宽度& E  C0 G7 }6 U( {& n
var marqueewidth=3002 ^9 h: G% r. B! g  l
//高度/ Y4 Y; A: M* n: g3 V+ }! V5 y
var marqueeheight=256 J' f4 P' |) C
//速度(1-10); I) E. w/ T9 Z; g
var marqueespeed=30 ~/ ]. V1 u  ?9 M2 C$ J$ f* e
//背景颜色
3 a; j& u2 X7 Lvar marqueebgcolor="#FFFFFF"
6 I8 j: ?+ n' t: u( p3 R* j//是否能暂停 (0=no. 1=yes)?
$ R, O, f, `* ~6 P, H/ j2 e1 J9 V7 T8 Lvar pauseit=1
/ f$ j# o: |3 J2 ~
% |7 [: m6 s$ R1 O1 X& Z8 P% Z9 r//修改显示内容
# y, g1 z. `. e4 w7 A8 V  zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') q+ D5 |6 d6 f0 Q6 Z  U

; z3 N) c8 T/ k  D- q/ R( O; Y  G) f1 y' z, D
////下面不需改变////////////+ \- a0 i( |5 f& H  t
, G3 r3 X# W: p  {3 e/ E
var copyspeed=marqueespeed
7 z$ ]' c& o: o  [/ o/ Zvar pausespeed=(pauseit==0)? copyspeed: 0
8 \, D6 I& [" L' b0 [8 }) Yvar iedom=document.all||document.getElementById
( A% m9 y" j+ `) R# n' Oif (iedom)6 ^+ j9 d# x3 {( u* T; W2 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 H7 R0 J: ?* G$ s/ a* h1 Nvar actualwidth=''
5 E% k$ Y# P- C: _var cross_marquee, ns_marquee6 }" S0 I" W2 y3 ]0 P
" M) t  K, i" q/ P
function populate(){8 C. j. j" G; k3 t# `* Q
if (iedom){) p* {" N# n3 }: O9 f) S3 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ {( A3 g0 _' u9 bcross_marquee.style.left=marqueewidth+8
3 D2 @0 E: v! U9 z' K* vcross_marquee.innerHTML=marqueecontent
) ^6 @" U8 N7 V/ _* t, }8 n  Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 Z4 ^' E. k+ O& J1 i. h2 z}
8 D8 P  q& r' F5 K1 h5 jelse if (document.layers){
2 L3 f- ^* G% _7 Dns_marquee=document.ns_marquee.document.ns_marquee21 i( H5 g) h1 ?6 N+ ~3 G
ns_marquee.left=marqueewidth+8, R- |$ B  x( b! ^% f9 u/ `
ns_marquee.document.write(marqueecontent)
4 }6 h) d+ ]" d5 |6 @& I, l' V/ e  Ins_marquee.document.close()9 F! v' M# l' L. \. l
actualwidth=ns_marquee.document.width
, r& G  ]* S6 a( l3 @8 j}
+ H  }/ p0 a2 C) ]- flefttime=setInterval("scrollmarquee()",20)
7 ?$ f) e: e9 `" {) p3 K0 b" P9 l}0 `* Q, T4 G1 g- T) V) c0 N% o$ m
window.onload=populate
* K- m8 U, t2 Z6 Z- ?/ y6 C5 J: O4 K0 P: k, `+ l
function scrollmarquee(){
1 ?* w- Y9 }2 w- j1 c+ Y3 ~1 `8 Jif (iedom){
% a+ N( `0 k& a# [1 K+ a( Q& @* e2 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) E* K: [, z/ ^0 E( T. o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 l8 S4 d; F8 R3 `4 g  k" v& k
else3 c& d0 n( W; `, P) V7 d0 i
cross_marquee.style.left=marqueewidth+89 _1 A$ }$ m6 e% x8 x
  l& M" [. S+ n3 P
}, Q% ~' o: V9 R) u: \- N  n
else if (document.layers){- ~! v, a7 P; t- |, x' }! g
if (ns_marquee.left>(actualwidth*(-1)+8))
( F9 x9 g* R+ o% ^( h# {! T- a. Z- C7 tns_marquee.left-=copyspeed
  C* |" c" D6 c+ D' Eelse5 }0 W) S+ O' F4 p1 L- X
ns_marquee.left=marqueewidth+87 V* f7 x% g& p& `& g
}, j! L  u: T6 s0 d6 i3 ^1 V! B, \
}
. h! M' @. v% w6 {5 l" z1 `: D  }1 b' _/ t7 Q& s
if (iedom||document.layers){! ]6 d. S% h( i9 `0 }  p' B
with (document){
; o$ ?: i5 e6 q2 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ X# K) j& {- J: ^8 p5 Jif (iedom){, ~& b$ s3 i' [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; M* U. w8 R8 O# y' Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 }" M( e  c7 [% R0 ?# awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 R: ?9 G/ B3 ]8 ~+ H. f
write('</div>')- s1 |) Z' l9 t# L3 {
}7 [$ o! }# x' y, V( b* m8 N
else if (document.layers){. N/ {4 q4 p1 b) N% i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 c; N' U; ]& t* \4 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" l+ a9 T; H' r( t+ P/ ?1 Gwrite('</ilayer>')
. l4 o, t7 H  {$ b  H, M}
% J) d1 K0 Z6 Z8 [0 D/ W! Ddocument.write('</td></table>')) W. K) }' o- H1 V) S. b9 a2 C
}& _9 f  l' o& ^$ }( q; p
}% r. q7 q. ~3 i# d( z
</script>

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