返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 X* R; Y4 z  k! e6 |: u, M3 wvar marqueewidth=300
6 G9 [2 z* x, A2 a- e% }//高度1 `" j( }' G1 R  {: R3 `4 ~3 z
var marqueeheight=25
6 x+ @- o5 o+ L//速度(1-10)$ d1 a# G& K( F, w; W6 A
var marqueespeed=34 n/ V; d2 w% c% n2 |: |
//背景颜色
8 p' i6 s" I, i$ ]( z/ Evar marqueebgcolor="#FFFFFF"
7 V+ `. n) V9 X, S6 q//是否能暂停 (0=no. 1=yes)?3 y- k# ]/ r$ Y* X7 q5 I
var pauseit=18 v/ @* C6 K) r: U
, U# n* _" j' w3 g8 I3 H: T& Z
//修改显示内容
# @" O" V2 J0 r! ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. I2 V" D& ?, z& `3 H3 U
& N- F- ]9 H' t8 F, d5 v4 [& B; w! m0 ]) n& e! a7 P  g% h
////下面不需改变////////////. T% ~1 k* z- V2 z

  l  @5 N5 k* _+ b: ?8 i/ vvar copyspeed=marqueespeed* f7 h4 g& G; E' p# c( A. r
var pausespeed=(pauseit==0)? copyspeed: 0
# X% h1 I) o  M) n* X: Cvar iedom=document.all||document.getElementById/ T# j* g% O0 S/ J' T5 D
if (iedom)
/ V, r2 [  i  I* H. ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* T1 w2 y8 Z( k4 r- I& R0 `8 h
var actualwidth=''
+ r6 q! e) R, [0 Y, cvar cross_marquee, ns_marquee, F# V/ T4 C& `4 M. x" \
# L- D) n% S7 P* M8 s
function populate(){
; O4 A3 v) ]' m% rif (iedom){2 w, a! X+ T4 d/ {" ^* Q5 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 x: b1 v  K% L, ~- H9 |# ocross_marquee.style.left=marqueewidth+8+ V/ x% }( D7 y0 z  w/ ]( R, d& M/ u
cross_marquee.innerHTML=marqueecontent
/ L7 P& b* o3 W' ~  s& X" W" [3 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% y" [- t, I+ w2 h
}
+ C* f- H! r  G8 @4 ~5 nelse if (document.layers){+ t" T! q- C$ @5 S5 r" c
ns_marquee=document.ns_marquee.document.ns_marquee2+ E7 n& v/ o" M6 u
ns_marquee.left=marqueewidth+81 x1 k/ N8 S5 Z0 Z
ns_marquee.document.write(marqueecontent)
  e& I" V7 Z* p: S' hns_marquee.document.close()/ i3 a3 m5 ~/ n' D, c( q3 F' c
actualwidth=ns_marquee.document.width' [+ h6 T1 W, v8 ]
}; N# F2 a& }8 R' E
lefttime=setInterval("scrollmarquee()",20)' Z  d' _9 P! g' f( I* P7 H5 V2 g
}# z- Y) h( e( o8 A1 B! G& l2 ]
window.onload=populate
! ~& ^( q7 X$ k+ v9 P5 i' u0 M4 H
1 L1 H9 a9 p) t. k+ F; ]0 Bfunction scrollmarquee(){2 e; b7 z9 g9 q
if (iedom){/ B0 v8 L( L- X: ~/ i4 G2 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 A: P: B. A3 l. o' tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ S4 S+ D4 `4 a2 Jelse7 r# ~( [- w9 t$ B( X5 Y
cross_marquee.style.left=marqueewidth+8
/ z6 W; U5 N7 ?7 W' x7 s
) \7 T% @1 p$ _. D1 m! l0 F" [}
1 U) ?7 a, Z8 I- Qelse if (document.layers){1 f+ u2 W2 \/ @# w5 f
if (ns_marquee.left>(actualwidth*(-1)+8))
  m' i6 x' H4 L; E3 R7 P4 vns_marquee.left-=copyspeed
( M, I. m$ F# U$ L* ~% e# l5 welse: g" h5 J; f. K4 |2 _7 {
ns_marquee.left=marqueewidth+8
! Z  u: \  g4 F) C* `3 L}
3 D6 E0 s% O- I7 l}
' a0 F/ ^* G, O+ c7 h  C1 Y. X6 E8 Q$ L1 l( V! D  V+ y) ^
if (iedom||document.layers){
& \7 @1 O1 }: D8 y8 Dwith (document){# }- l' A& b) D; f2 b' B; L* Q" b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ k* M6 y% t9 d5 v' `4 K! [) rif (iedom){6 x9 O4 a+ r6 }; V5 K+ [' Y0 D. J6 i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% k6 R0 G5 D) q* ?# e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 C; G, z8 l7 b3 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), Y- ]2 ]" L. |, q7 L& h; h6 P
write('</div>')
1 X8 M' c( l% y! o' K. p! n}; y7 u1 f" z6 j8 `, B/ Z) l
else if (document.layers){* v' Q! _% b- l/ Q3 z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); |( J& O. U4 O! S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& d- H% z' m0 S4 S% m
write('</ilayer>')
2 D" B! H8 X- b4 l2 {0 G9 p}# t# T7 H6 h  M& z* E6 v
document.write('</td></table>')
4 Z) H* Z( g8 \/ b5 {4 Z7 v}! \# ~- u6 F8 p; E) M/ A( q- {% ~
}
; z6 _" B" S5 Y* t</script>

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