返回列表 发帖

网页之跑马灯文字特效

//修改宽度# u5 P# s) A* F6 \8 v* z6 M
var marqueewidth=3003 X+ L: |5 q$ j+ ~
//高度
1 A' w$ b$ d3 h- u- S2 a, @! Nvar marqueeheight=25' X% K+ a0 s6 n; D2 _5 Y
//速度(1-10)% p& i% b$ `1 V/ K* U
var marqueespeed=34 g! n8 a$ T% }' F% E/ F
//背景颜色
# o# Z3 q3 E6 Y& _: D$ h6 Uvar marqueebgcolor="#FFFFFF"
" ~$ m5 _8 o2 y  r" O//是否能暂停 (0=no. 1=yes)?" d# K2 I- e6 Q+ z! z% o
var pauseit=1, |+ H* E/ s4 H! ^

: \9 t; [' U6 [, W! _+ H7 f3 Y//修改显示内容! e$ @; c7 `9 \) a* t. d8 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* g" t, H, z# V! Y4 g. O- [# b! n

; F' v8 I7 J. n8 O1 s" v
$ h8 p& v4 O- ]& M1 T7 N: S% b////下面不需改变////////////
9 O3 `0 |6 `! |# i8 X5 ?! w
8 U5 t) }0 V, Svar copyspeed=marqueespeed( [4 ?9 n0 n; Y/ m: t
var pausespeed=(pauseit==0)? copyspeed: 0
' N$ W% w/ Q  @7 V1 }var iedom=document.all||document.getElementById2 E5 i$ B* H1 p6 h: E
if (iedom); h* L+ G) y- {  v7 G* I% L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 q7 }& d* w" N- Z- V. s, \5 fvar actualwidth=''
, [+ ?! F0 f' p) H9 U: Cvar cross_marquee, ns_marquee5 S: e+ c5 ^6 H8 C# F+ m( D
) _. `) O5 Q- a: g8 V
function populate(){
$ y6 J, s( I. a- Gif (iedom){9 p4 _+ Q9 B# L. O; u6 J7 }' `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ W. F2 H  u0 g! I; x& R
cross_marquee.style.left=marqueewidth+80 s2 e$ s3 w$ D8 k  U( |* Y
cross_marquee.innerHTML=marqueecontent
, I+ t. O+ E$ s  ?0 t% {5 v1 @1 v' @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: w+ `/ j0 `# T}
$ `) N+ }9 ?1 Q& |( `$ q7 |else if (document.layers){
0 b& R2 q' X( e6 O; S3 k! ans_marquee=document.ns_marquee.document.ns_marquee2( j. R& A/ c7 E' t+ ^
ns_marquee.left=marqueewidth+8
7 n' W/ s" ]) E6 P$ n" Zns_marquee.document.write(marqueecontent)
# T* D* _& i- r! }+ E+ q( o; \) pns_marquee.document.close()
8 N5 i) K' v/ q, c6 D) @actualwidth=ns_marquee.document.width- J$ X' s  _/ m, s( O3 ^' |. F5 g
}2 `/ G' W: L2 D. C
lefttime=setInterval("scrollmarquee()",20)
1 ^7 i8 a7 B3 c. t1 P5 \: n}
2 X& B* ^, W3 N- p1 T& n, A' kwindow.onload=populate
& @" y4 @& N4 J" t! O+ M' \
) p& e8 Q5 V% |function scrollmarquee(){' @( H8 H6 }- r. L
if (iedom){
( q; p8 E; ~; \2 H+ z% x9 K# O7 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ j0 l# n5 a  Y) k# Q/ w% s  scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" |" J: y" Z8 g! ]1 r) o6 [else: W; O; F, L5 k$ o$ O7 O) ~
cross_marquee.style.left=marqueewidth+8
' g$ l1 v! t2 h" ~4 C  M, \7 Q" ^2 b/ T/ x- s
}
% e" A- S4 ?' ]6 _8 uelse if (document.layers){
+ @* a! l2 N7 a- S5 H$ zif (ns_marquee.left>(actualwidth*(-1)+8))2 P- U! u, I: P9 X
ns_marquee.left-=copyspeed, w. d8 m4 R* Q- [9 P2 R) D0 i
else
% B. J& i2 R5 [* W8 |ns_marquee.left=marqueewidth+8: d3 O7 ?" X: [! c5 i
}
; T- }8 M. q4 E( x& l' v}& i0 _; o& T$ y4 G& s; K# D
3 u4 |1 J7 F4 E+ p: Y$ R+ h; p
if (iedom||document.layers){
8 v7 @4 f: |5 C4 `9 r" n* Twith (document){
1 c% f* @- O& p+ M7 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 V1 K# v: O! u3 m3 M7 n6 m
if (iedom){
; X2 O- g3 ^9 N& j" Z2 |* cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' l) m$ X! {& I% p& pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 y$ l; r" M) K5 j% b! _- Z5 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 L: G" @! l8 r5 e2 f- V" @write('</div>')
0 a0 h2 [. e" z! R& b}4 B" z2 g' V/ C- H: ]( Z* U7 a
else if (document.layers){- m( J: @" [' f4 |+ W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): C% K& g4 p  D1 U4 T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, o0 M$ ?# {2 C5 \  Hwrite('</ilayer>'), r' n) W% V7 t
}2 ^, S# |  J6 w' Z* o- b+ Y1 c
document.write('</td></table>'); C& g) H4 D* ^9 A, A. R, W
}7 @" K8 {0 T, p3 ^
}
( X; X9 S5 h( b0 t% g  @1 H</script>

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