返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. Q# M6 Q* @- _var marqueewidth=300
( _$ ?" [/ d8 N. n) s//高度4 y7 }* p" a' Q" Q! s
var marqueeheight=250 P5 C( Y6 |, `: t% C- h
//速度(1-10)+ E& g9 l- M6 X5 U
var marqueespeed=3
. u/ x# C: k; t/ t//背景颜色
4 n, ]' a4 ^, p1 ivar marqueebgcolor="#FFFFFF"
& Q8 @' G- S# k& Y' g//是否能暂停 (0=no. 1=yes)?( b# y& ]( J3 `: G' ]% i: ]
var pauseit=1
( Y* ^1 Q6 o; O, I( q* z* ?2 R/ H9 O2 z( e; z, C7 O
//修改显示内容
4 n8 ~" {* N5 E" [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. N" a0 }: ?! Q8 g
+ Z# q" h; Q' T1 }) J% h) E+ z4 A8 r% N% }: x# B  |
////下面不需改变////////////$ f1 j" g2 e  n6 P9 e& ~2 s8 k! w

( J2 j" ^$ h! l: H5 B3 o, J0 rvar copyspeed=marqueespeed# d$ d" r7 P' V+ |# \2 _" W8 L
var pausespeed=(pauseit==0)? copyspeed: 0# V/ l/ n* I1 u, s
var iedom=document.all||document.getElementById
; q4 }0 _. W0 V# z+ }  H* P8 hif (iedom)2 e! D$ H0 Q/ u0 `) ?/ S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 n) E' Q3 v; o. M% @( p
var actualwidth=''! i6 n% ^0 G2 l( y1 W  s0 O
var cross_marquee, ns_marquee
) s5 |- s" W' i4 G5 N) i& V) E* a! @. Y
function populate(){
% ?+ ~9 F- Y6 |( o/ [* fif (iedom){
" P8 d, \6 E' @4 n  H' d* Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, c0 @& }9 L+ P- t6 T: X0 U
cross_marquee.style.left=marqueewidth+8
1 R" q$ c1 b! P3 u" @3 w9 Ycross_marquee.innerHTML=marqueecontent
$ R0 {' J4 P( @- eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 A! k, ^* a6 u. W# k' P}
; j/ s# p6 a3 j* u% I' m* Aelse if (document.layers){9 ], J: \/ C: J: P& r$ x+ |  Z+ h
ns_marquee=document.ns_marquee.document.ns_marquee2; Y. g! U. p# x5 e/ g" `% T
ns_marquee.left=marqueewidth+8, c# [0 T$ j1 m) J. A$ A5 s# ]" o
ns_marquee.document.write(marqueecontent)/ p" N* j+ Q# F* U- I' z+ Y
ns_marquee.document.close()) E5 k+ c* n1 l- O
actualwidth=ns_marquee.document.width
+ e; s; ^9 @; f! d" Z}
6 |' @. ^  N/ a/ Q" V8 flefttime=setInterval("scrollmarquee()",20)  V* F# _( }6 P# C
}% q4 m: I6 p5 ?5 M! T* B. P" T
window.onload=populate- k3 u0 b: @" f4 c0 ?& r. _

; q6 g7 ^$ J% }" @2 z$ Mfunction scrollmarquee(){3 a9 m0 _: e1 X. z
if (iedom){) B2 x$ s3 Z2 t/ y& a, L. l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! s* J0 U6 A* h. {5 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. X: s* ]4 `/ U2 qelse1 A# w" D# i$ C8 l. w9 A
cross_marquee.style.left=marqueewidth+8
  o: {$ \7 z" K) b$ k
. L. K- {( `5 H" m/ P; V& ?}& B5 m& `- Z% H! t9 Q) b
else if (document.layers){
% Y( W, v) u& N9 Uif (ns_marquee.left>(actualwidth*(-1)+8))7 t3 {& F8 q. ?9 `' g" f
ns_marquee.left-=copyspeed7 y7 Q6 w) }. K* _! U( |  Z
else1 K8 Y4 n9 O$ u0 _5 z2 K# @
ns_marquee.left=marqueewidth+8
: N/ g0 u+ e% Q}, e! q: P$ d0 g! u& y
}: \8 v. n7 n( W5 V
; R  r8 u' `$ l4 Z, n! T1 k6 a4 a* k- {
if (iedom||document.layers){0 i0 c# m8 Z5 j# H! \( A- R0 `$ W5 P
with (document){
. A9 v( T9 x/ Q; X7 W$ Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& T7 x, L& p# c7 g: Z# u" ^* eif (iedom){" l* n" a3 E3 S; C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( j' i, C1 e: k. `) Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' L. L# M( F( f: l% y; ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 i5 _+ s# i5 v2 c; S9 }( @6 n
write('</div>')
( i- m) ^* [$ D9 D% A}  p: g7 k; V7 G" u! g' H
else if (document.layers){5 E4 n" {4 d3 b5 B* u& u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 |& P6 j4 H$ ?3 t" P* Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' I" q7 b! J8 i9 b# k- ^2 t6 N5 Rwrite('</ilayer>')$ q7 I+ Q! ], G7 C1 u7 J, y
}
2 b2 ~" P& M% U+ kdocument.write('</td></table>')
7 f6 i8 h: O# K: l, s4 K}% R! Z8 Q. v. m1 y+ \$ C) Q/ O1 l
}
* A& T" {2 @* O( e+ E! @</script>

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