返回列表 发帖

网页之跑马灯文字特效

//修改宽度# y- ?- v3 u& p3 W  H7 y" M
var marqueewidth=300
5 A' K6 P, S7 I  E; l9 I7 \/ B: U/ i' U//高度5 |: K7 E, q  Z$ e9 ~" H# w; m4 m
var marqueeheight=25$ O% ?# l" H) }# t" {) `
//速度(1-10). z# {9 p6 k1 n1 j
var marqueespeed=3& j2 F( h7 n4 K" M/ c
//背景颜色) l% C: ~& a7 I& a! ?) ]/ g! I
var marqueebgcolor="#FFFFFF"; H- N8 y; c3 Z4 m: [: X
//是否能暂停 (0=no. 1=yes)?
4 R/ B4 W+ T  g/ L/ }  svar pauseit=1
8 ^) T( d: b6 h- H- E9 [' z9 P* ?8 _+ G+ O, i
//修改显示内容& @  r  N" U9 J/ s' }+ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: k8 s" V, h' Y
* f6 y- {4 r) U- {7 @1 Q& j0 E* s8 b5 ~$ o
////下面不需改变////////////8 y" |3 p' G: K

8 I, u& C& @% Y- ^6 C# wvar copyspeed=marqueespeed
+ M( {! E/ o' gvar pausespeed=(pauseit==0)? copyspeed: 05 j0 Y6 ?0 ?2 l/ a( g
var iedom=document.all||document.getElementById
% [7 Q, k* q' u7 X0 m* w; Nif (iedom)
  a. n4 J1 c9 m2 r" X# ^2 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); W  V6 v8 \  I7 u* W. `+ t
var actualwidth=''
0 D2 L2 _) x% ~0 q" l0 I0 O. K; `var cross_marquee, ns_marquee8 C0 Y! E( d9 Y# ^0 s

  g* F. }1 X5 B6 M' ]4 s  \function populate(){
) M- ?/ n. h. @* M& w  |) Kif (iedom){
2 e: y. k! P, Z9 |8 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) L. a+ j4 h& o  Ucross_marquee.style.left=marqueewidth+8
4 i# P1 [% ?0 Z. r. V& G% G  @cross_marquee.innerHTML=marqueecontent
% N8 w1 v1 M3 I% c2 W/ Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 O3 G3 L- t4 K
}
+ f0 r2 |. i- p" |$ u3 J: yelse if (document.layers){- P2 L6 V, I! v
ns_marquee=document.ns_marquee.document.ns_marquee2
! j1 n, K4 u, Q9 L# M: ans_marquee.left=marqueewidth+8
6 H4 @% R6 k% i# W) Mns_marquee.document.write(marqueecontent)
2 C4 K* g7 Q" F* `ns_marquee.document.close()
9 j! T/ R/ x* [0 m, s% C' ractualwidth=ns_marquee.document.width
- r, k# F* l2 Q' z' L/ u4 @$ M8 ?}
" V5 \% ^2 G$ s' elefttime=setInterval("scrollmarquee()",20)& E/ K1 q6 H5 Q( v3 _
}( N: ?/ x# x% p" i# u( ]' A
window.onload=populate# n  h, e- s' `2 a, f; h2 f

8 k* u6 a7 _7 L( L9 \function scrollmarquee(){; F; }! P% a: A; O" v
if (iedom){
+ h7 @" h: u0 r5 d1 M1 `. iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* ~9 z6 p: t1 G; M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 w# Z  Q$ K. J% S; B9 d6 A& \* f
else* c7 P" l, m* S/ i2 w
cross_marquee.style.left=marqueewidth+8- Z) }' ]" D2 ~+ V1 h1 S4 V
9 m3 s% S+ q6 X
}
" J" U3 l$ P5 \- V+ V) a: melse if (document.layers){4 e& A' d) R  C7 s
if (ns_marquee.left>(actualwidth*(-1)+8))
4 l5 ]7 `8 }' X3 j: bns_marquee.left-=copyspeed
) K7 v8 _' M% S' }else7 q. I4 F  Z. Y4 T* M; v
ns_marquee.left=marqueewidth+8' n& m1 K4 |3 I/ K. a* [
}. ~) C8 a" X3 c! k! V. C
}
9 {5 P- ?, J, [) r5 _" E6 a1 U0 G1 S+ W* j! }  v
if (iedom||document.layers){
, F$ t; n+ n  z7 x% u5 |with (document){
+ ~- @, X3 ~3 K1 b; }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): H& L5 H0 l9 F, Y9 y: E! e: y. K! n
if (iedom){
/ Q! G$ j; C6 W) U  m* @, bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), Y0 L% S7 ~8 T$ `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 R+ B, ]' ]. H. h6 W3 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 ]+ f- q; N" u& y7 }/ |
write('</div>')
8 \: a& b0 U! g3 ]) [}
- I2 ~3 `$ j8 J+ U! {, T' gelse if (document.layers){+ U' q$ o+ a; S7 i8 O7 F1 O7 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). Q5 T8 q: V3 S2 M2 O1 g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; U$ \( x0 X8 Q4 ?& Uwrite('</ilayer>')
3 H- |! W; h  H, ]) X}
0 T, a4 P2 z1 I9 J, _7 {document.write('</td></table>')
- Q9 ~" i4 _/ ?- h2 [4 r}
+ S) m3 k- C- S1 ~}
; i" Z: G: |, n6 R/ D</script>

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