返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 ^  c  R2 j3 i. Y& E
var marqueewidth=3008 }/ C" h+ l1 f4 q  @. c
//高度7 q8 l8 y0 e* v" Q3 j
var marqueeheight=25& m* k0 x: v( e' M6 |
//速度(1-10)4 m0 p) ?9 I3 N- F% {
var marqueespeed=3! E$ n/ o: e. j& \
//背景颜色
' @3 A2 M3 f5 h( H0 Jvar marqueebgcolor="#FFFFFF"
' v# J" I2 u- i7 j7 F; ]//是否能暂停 (0=no. 1=yes)?
+ g0 U, }4 I! hvar pauseit=1
  b/ t6 D# n9 Y# ?5 G+ @7 X3 Z/ q& A  l8 C7 ?) |5 W& ^
//修改显示内容
0 j$ ~- `1 s; Q% b- bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': G% {' A/ m- n& w7 U) G+ J! ]) E
7 S; E0 s3 y4 w

9 W! M( F. V7 x; c3 q/ C////下面不需改变////////////, t6 M& P9 d; |8 v$ F& D
6 _! x& ~$ }0 G+ s, W
var copyspeed=marqueespeed
, [/ J3 t8 ^2 b. g# A, zvar pausespeed=(pauseit==0)? copyspeed: 0
2 u  s  s$ G' r  H  }) |0 z0 tvar iedom=document.all||document.getElementById' R& n  b& L0 Y- t5 m3 E- K/ Q
if (iedom)
" p) e  ~- q2 Y6 \8 O! E$ l9 P+ udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). R: l. k* m) x, N0 _
var actualwidth=''& b$ m9 h) z1 Q4 M0 r
var cross_marquee, ns_marquee
) ?( N2 U! v6 ?" M- j
  ^9 v! E8 K' c2 nfunction populate(){
. X' Z( w! {5 W* _( v1 qif (iedom){
9 O/ g, h; p% U4 l) O# T; u2 U7 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, t8 {+ A- S* X# k
cross_marquee.style.left=marqueewidth+8: c& E  U, Q6 z- f- S
cross_marquee.innerHTML=marqueecontent, W. p3 i: z4 Y' G  F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' Y- F# ]5 z; m}
& ^+ r- R) C+ u( P* [- k+ welse if (document.layers){
: N; T" k: v- D+ z1 vns_marquee=document.ns_marquee.document.ns_marquee2" I" p0 [% Q* i* z
ns_marquee.left=marqueewidth+8
" Q) ~# R4 O. l" T: d; `ns_marquee.document.write(marqueecontent)
9 K3 l: n  p* Cns_marquee.document.close()) _  c2 ~6 }; _' ]1 k) i
actualwidth=ns_marquee.document.width
9 u2 z) W9 `2 c: I2 ?}8 [& n. o3 L0 F6 F
lefttime=setInterval("scrollmarquee()",20)
* Z# z. N+ q8 @$ I# d+ u}/ _, a4 _, w( \9 H3 e- Y$ f
window.onload=populate: w7 R/ x; e4 k0 P% v

6 e2 z$ u9 Y+ R& p' Z% {# i# Bfunction scrollmarquee(){
2 o6 p3 A8 C( w- {+ iif (iedom){
  C: y+ A' V3 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 J/ R6 L7 \% Q) i) O5 ?  r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 `4 R6 L: n6 M' a& h* \7 [5 m$ A
else
+ @2 l% r+ \. W6 p7 r* kcross_marquee.style.left=marqueewidth+8' f' |, y6 F* E( G/ `+ K# r# V
7 h) Y, a8 t4 o; u: B
}2 W/ I2 m* Y; P+ @
else if (document.layers){1 R' @0 q' r& q/ u" v
if (ns_marquee.left>(actualwidth*(-1)+8))" j" u* j  K1 V& y. R4 {
ns_marquee.left-=copyspeed% f( E+ {# i* {( i6 J1 _9 ?& u# G! J
else
0 r/ K6 n) z3 {% I3 r- H% z/ Gns_marquee.left=marqueewidth+89 o( g' D3 @/ m# e4 r
}2 t2 E3 }/ S1 B# H0 G
}
. j  o0 U1 N- E  x4 N6 ^, P3 x1 f& h+ {7 Z
if (iedom||document.layers){5 X( ~/ p- M( x
with (document){
5 S1 C" c' T- |* f1 S. Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 P  {7 i1 x$ g
if (iedom){
+ C. [0 C$ `0 h# v# S2 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 Q3 V1 z+ w0 F9 m. m6 i6 K' dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). A: G+ ]9 X, y% {' l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) W' @2 N: H5 f) cwrite('</div>')& x9 P& Y/ A4 [% j
}
6 n) [  a2 Y1 m: celse if (document.layers){! l5 O( h& x- w1 E  e/ _( j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 o7 b. v. z: w& Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, {) F: A5 r" I( O* _write('</ilayer>')
! M9 B7 s' h% c& m0 I}
2 R- z* m  z: F/ \! x* Y2 h9 zdocument.write('</td></table>')
) ?, N( m% ?% i. w}/ l. A+ @% @9 T8 B" I# l
}: o/ q0 O/ l( ?- Q; [* w
</script>

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