返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 [1 k2 ], ~% l4 h& E. O
var marqueewidth=300; G( Q  `" p7 ~' M0 O8 q# B2 s! E* |  U
//高度
+ K( O0 x: D/ X& b+ B  w. n# W& Bvar marqueeheight=254 T: |* D$ s/ r, a7 {2 `3 D
//速度(1-10)# ]8 S3 f( [" q2 L7 L- F1 z
var marqueespeed=3
- `- B5 l: h9 u4 e//背景颜色4 ]) m( z% R5 o8 J" _2 @8 P
var marqueebgcolor="#FFFFFF"
5 o) E5 Y6 }% G, `+ I0 L//是否能暂停 (0=no. 1=yes)?
2 W- W0 \  |  R3 A* Uvar pauseit=1$ H3 p$ a# Y4 k! V" M- C( L( \

3 |9 n7 m3 {& _2 C; M" }) F# m//修改显示内容
' P( x4 l  E; i: B* a# ^# @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 w: R3 x  p* V

1 m) v% H( R  S+ g2 A8 ~8 [$ |1 a2 i7 I# @2 A: N& K2 n
////下面不需改变////////////
# [' B5 o7 u! Z5 z$ n
: ?' N: E+ `  G- N) vvar copyspeed=marqueespeed
1 \) L2 e* Y3 x1 T" Cvar pausespeed=(pauseit==0)? copyspeed: 0
: g& [3 J5 }+ t; r8 a9 xvar iedom=document.all||document.getElementById6 u4 j# p* d- i1 r
if (iedom)0 s/ @- i4 Z5 _2 m3 @6 T' k# q. Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 s4 ]/ G% b5 k3 r: r' ?8 w
var actualwidth=''1 E1 o. L1 B; e: P! W# K
var cross_marquee, ns_marquee) T0 O1 x  a; t1 V) i2 {

) O/ j" J( D9 Y0 k2 K' ~function populate(){8 T6 m" I, @. R! V. o
if (iedom){) n, [( J4 R# [: B( _6 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# N2 @3 k: D1 w4 i5 M
cross_marquee.style.left=marqueewidth+87 ?' t3 \0 Q$ k- ?
cross_marquee.innerHTML=marqueecontent
5 w( _, ~. Z9 i! }1 G. m/ Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( l8 h2 S& a, u& w, ]9 _4 L/ t/ c
}" a3 M! Y- o. V! S) q# A! {& C) W1 Y+ ?
else if (document.layers){. U7 F1 |. E* ~; V+ j4 G
ns_marquee=document.ns_marquee.document.ns_marquee2
, U! `6 V  y( Q- @3 dns_marquee.left=marqueewidth+8+ v8 q+ w7 X! ?
ns_marquee.document.write(marqueecontent)/ U# U* _6 i  i
ns_marquee.document.close()
3 g" M( }( d- d1 h3 J' `2 V. t) Gactualwidth=ns_marquee.document.width
- }8 G* X( I/ l0 ?}% z" C9 U' m- S4 P2 M
lefttime=setInterval("scrollmarquee()",20)7 V0 ^9 H" Z  @4 B" W" v
}) m* N# N( k' e0 s2 u0 H
window.onload=populate6 E) Z: j: x4 Q$ o9 q( P

% @4 m/ O- D, Y0 rfunction scrollmarquee(){
- g$ ~( j+ _9 `if (iedom){7 {6 O4 M- T, K1 P: C3 m+ E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, l% f$ K" x* Q% B, d& H- J3 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, p' s! H. E. e9 Q# l8 O9 s
else
- C; `; H9 m9 scross_marquee.style.left=marqueewidth+8
! p! r% J$ c# y' W2 g* Q2 S
1 J% L7 p8 u% O* D8 m* Z}
4 v/ X8 b% Q* G$ ielse if (document.layers){# B3 ^; ~8 j8 M
if (ns_marquee.left>(actualwidth*(-1)+8))  o3 n  _( m7 u, k) E7 G. j- }
ns_marquee.left-=copyspeed
! k- c; I9 q, n5 o4 Qelse
7 A! I/ Z8 l( j( g7 \5 b6 K3 Zns_marquee.left=marqueewidth+8) P7 S8 P# y) V) T7 X" [
}
* {( _) U4 z; ^$ R- I}
* W1 g- {8 s7 V& T& x. _7 p8 K, I) v) z) N. J% J0 o
if (iedom||document.layers){
: c2 g/ _2 b5 Cwith (document){
# D9 S& p+ J2 |* W3 C  zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): n9 V+ s/ C- L; M9 f2 f
if (iedom){
1 c' ^$ e+ Q  z5 f0 R. K6 J9 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 }  R( n0 I5 g6 w& F8 [  R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& S7 T! M9 r' r* t3 d4 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ ?; A  q8 S3 E( Y/ F9 K# h
write('</div>')0 S9 z: b& V) n( S  i
}2 m2 l" z; Y6 T, c4 d  @  [
else if (document.layers){
8 A. ~; D' b8 |% U. C# a! v( g1 q5 C/ Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% v% [9 e+ w' k# }+ d. _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  O9 c; A) k6 K4 c9 S. q/ d" wwrite('</ilayer>')6 C" m2 r3 V. L$ A% m+ g/ p
}2 w3 K: ]7 R9 `; ]; C1 ~. ~
document.write('</td></table>')  n5 U! ~3 M( ~2 u& V& L; ~  P
}
' d4 Q9 g* G. u5 m}4 r( Z9 M' y5 F+ m3 N9 ?9 C
</script>

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