返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 K$ {1 k- F9 t, xvar marqueewidth=300" U+ @9 n1 }7 O# t
//高度# f. A, K8 ~$ ~% f% t8 y
var marqueeheight=25
" L# n, I. b$ \, L//速度(1-10)
9 l4 X0 }( B/ p( M: L# d9 F# jvar marqueespeed=3
  {! h. ?& N* R3 @& V//背景颜色+ v; ]% {; P& A  ?3 v# e, U
var marqueebgcolor="#FFFFFF"
4 P; t" w6 S' L' B0 M6 E//是否能暂停 (0=no. 1=yes)?
) X) \" o3 n( R, I* d  Bvar pauseit=1' u0 E: Y) C5 W9 v
- m, u, g3 o6 \8 C" F5 D  E
//修改显示内容
  N) j8 t( s/ q, b0 i: b; nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 {* z- e5 }+ O* I6 _' E2 `6 [- `
# D, K, U' o. |; X  Y" k& b

* |0 q+ [2 C, w& b////下面不需改变////////////9 S# O' M! l/ s' F- H; ]- o6 Z6 e

/ K! D3 U8 E/ kvar copyspeed=marqueespeed
' n+ }* b' A/ \$ M* O; f6 uvar pausespeed=(pauseit==0)? copyspeed: 0
) E7 x* N3 Q8 Z) Lvar iedom=document.all||document.getElementById5 Q. C8 V3 Y2 b, `
if (iedom)
3 ^. d- L& e# U0 n1 r4 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; p% l- O. [  s3 U1 gvar actualwidth=''  N. \* C% Y' {" p5 f
var cross_marquee, ns_marquee+ Q! U5 X3 z0 ~/ R& A

, z7 M; ~1 ~' ]" qfunction populate(){4 W" |/ E6 n+ ~. G* E9 p) F7 g( O2 p
if (iedom){# H+ O) I( L/ u0 M- o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ h& k" l! [' {% p* _cross_marquee.style.left=marqueewidth+8
* R+ K# h* G, d) g# I* ^& lcross_marquee.innerHTML=marqueecontent
9 Z# y; j0 k' Z$ m! Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& Y9 E' ?  g% |0 G- ?: u" ~2 P}/ P1 v- T- k, S, Z/ e$ a* p
else if (document.layers){3 \1 C" m9 q9 C
ns_marquee=document.ns_marquee.document.ns_marquee2) z  D4 q( B! u9 S' C* f4 ?
ns_marquee.left=marqueewidth+8( n; j8 r2 h- e$ `
ns_marquee.document.write(marqueecontent)& D. A3 B: o! o8 @0 A# M) Z
ns_marquee.document.close(). o. Y" A4 a9 d* S$ ]
actualwidth=ns_marquee.document.width& |% N% Q" H  ?3 a
}
# u6 a5 W) Z+ _* T9 a+ e7 N- ylefttime=setInterval("scrollmarquee()",20), Z* K! W3 H/ m' t# S) d5 e) _9 I
}
! G: P; ~9 y# x) E) M5 nwindow.onload=populate
/ p5 G+ n5 g" d" {& V; p1 A
7 \7 K& A; {  ]function scrollmarquee(){
* `. U  m* W% l0 v: E6 Eif (iedom){
' ]1 }9 o' i5 ?! R3 m& cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 _9 N0 S3 ^# `; }7 x7 {; o3 G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, F+ c1 V0 J6 e; z) C+ b7 Uelse( z( j8 U" D0 h; e3 `$ @
cross_marquee.style.left=marqueewidth+8* W& u2 u1 `- Q: @
8 S  k. _: h4 r& u7 \+ y- S
}
; B2 W1 H& l5 R) Y) Yelse if (document.layers){
9 c. Q  R% _- s' D7 Y+ vif (ns_marquee.left>(actualwidth*(-1)+8))) @3 n0 `) p+ b& \: w1 K
ns_marquee.left-=copyspeed  [+ K( ~6 P8 d7 H7 m  x$ ~7 X6 c- e* l
else- E- p2 `$ E, k8 v
ns_marquee.left=marqueewidth+8
. {+ q. B, ~$ ^. z}
4 ]/ W) @% Q. _# R2 s% _' S0 K}7 B! N" }2 c, |( R

& S: R/ V& X  O4 L, Wif (iedom||document.layers){
& j! L; @0 |5 d2 U0 s/ s7 `/ xwith (document){; Q1 C5 Z6 Q5 T5 ]& B! h, A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 p9 f8 F# a8 ^/ H2 P, u6 k; q# Pif (iedom){( M8 a0 L' _7 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 n3 K  i3 t, t5 D3 p( ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# w$ S  x1 n7 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- j4 G$ F! h/ `- Y5 \
write('</div>')( A  }2 C8 Q& e) h
}  W3 Q3 V) C: f9 X) H/ D
else if (document.layers){1 r8 u8 H: K9 t8 U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ r$ _9 E0 z9 P+ Q/ p8 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& g% Q  @+ c0 L( u& j- x" ]( ]9 C
write('</ilayer>')8 C/ I: N7 U) w* O& _
}1 j. R" u7 }  g3 \% c% H8 P
document.write('</td></table>')
2 W' c# s: b* x' R  B}
2 F# U* Y2 w4 z5 W6 `}2 t+ s& O( X% n7 T# p
</script>

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