返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ r0 C% b1 \( ]4 A3 Z/ s; qvar marqueewidth=300- G" B& X3 K. z+ ^0 j4 H
//高度0 D: _$ s6 k& i4 D
var marqueeheight=25
6 p$ H1 S0 @0 ]' B//速度(1-10)
; m5 J8 L2 R8 P8 [8 u* d$ Evar marqueespeed=37 d/ \+ F0 d+ |: h
//背景颜色
' Y+ `7 o# e( W* Qvar marqueebgcolor="#FFFFFF"
0 F. @8 \/ @" X  |//是否能暂停 (0=no. 1=yes)?
9 F' Y$ e$ U4 r5 \6 P2 f' yvar pauseit=1) h2 [0 Z$ m- W, G0 a5 \# Z* ~) z
3 C- M3 x& j' Y' z' K
//修改显示内容' n5 C6 h$ r6 |/ |0 l$ y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' h5 U: E& a& v( o

/ u: l- g# B; K) T- J2 y4 M) ]# |
////下面不需改变////////////
! [, e5 }: U- O: `, K. F, O" k+ N6 ?: x2 {  \
var copyspeed=marqueespeed
/ E/ r: k, h9 v8 _3 avar pausespeed=(pauseit==0)? copyspeed: 0
6 P/ K; {0 }9 b3 R1 gvar iedom=document.all||document.getElementById" S. ]) w. F7 d7 z/ }4 l$ u
if (iedom)
! E. _  B1 @2 p5 ?0 l4 |; ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 Q7 h; t& S! s
var actualwidth=''
6 @/ q$ d/ I5 z9 [* qvar cross_marquee, ns_marquee
# W& }2 N' F4 W1 a1 _. h* k& ]4 `: z2 S  Y% P( M3 f
function populate(){
6 y0 r! ~+ R9 Q7 f, o' Pif (iedom){' }6 n* K, Z; \# O! m  z: s. T" H. M$ S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 b, Z, t' L- x) N! Ncross_marquee.style.left=marqueewidth+8
0 l" T6 h% v' K- B& `) tcross_marquee.innerHTML=marqueecontent
0 H& U/ ?4 v. `7 v4 h4 j; W; qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 K& M# q8 v4 k: A$ R}
1 O) ?4 M6 Z) u! Q; O2 X1 j9 Belse if (document.layers){9 n9 A% ?" h+ M1 H" X
ns_marquee=document.ns_marquee.document.ns_marquee2
3 H  X( n+ w) ~ns_marquee.left=marqueewidth+8
5 V7 ]3 z0 E$ u% s: s. X7 D4 k6 Vns_marquee.document.write(marqueecontent)
7 k7 l2 [$ b; K6 fns_marquee.document.close()
, C( W& T( g. h1 X/ p) v1 kactualwidth=ns_marquee.document.width
* }- {4 L5 ?$ N, x: K9 `2 M. D}
" u7 c9 z+ |2 L. t7 K% [  llefttime=setInterval("scrollmarquee()",20)
, J* z1 E/ {6 k/ y3 K}: P/ I$ A5 ]0 D$ [/ P& ], v/ L
window.onload=populate
1 \& m" L) |* {2 m; p! p+ R* m' e  i
function scrollmarquee(){
1 j. h9 n  \, ~1 ?) V! Nif (iedom){
. Q7 [" ?! o8 q+ l8 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' y# ^- s4 H0 i3 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ g. {; F7 U8 }9 p9 H" \- s. K8 y+ h
else+ d2 S' l7 o' i) r9 h- h
cross_marquee.style.left=marqueewidth+8) ~- q- D/ z3 o- O6 I2 ^4 L
. l6 K# a  @/ }" O
}7 h3 g0 [0 X. Z2 F0 o
else if (document.layers){8 Y; V- f. a- i3 Z2 H0 o3 c7 d$ D
if (ns_marquee.left>(actualwidth*(-1)+8))
, p5 ]# E: F1 Z6 p/ \1 _ns_marquee.left-=copyspeed2 Q; r0 W0 P6 n- I
else( W$ l6 X; b9 z& d: G& q( {1 E3 i
ns_marquee.left=marqueewidth+8
- e! J/ M. F( r$ Q}
) g) ?6 q' a# L+ s" \}8 ?' U, I1 t7 S( B1 Y; {1 ?

" y3 [, n* h3 i- r  B' L, iif (iedom||document.layers){
' x# K( K& o. j1 P* A* Kwith (document){$ H4 s) P: @! n; x7 A9 f) k2 t7 d0 `3 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 P# y( H' U3 t3 V  z( k$ x
if (iedom){
, h! j% }% T. E% f! a: w$ n3 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- Y: E- N, t' [& q  X, g. Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ q7 _4 `% N# r+ l# s2 M1 |$ C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( R" a4 D* R0 w* x) G0 _
write('</div>')
. A* O- {) C8 o( H3 r8 H}# ~4 G8 i9 l5 ^* X
else if (document.layers){
9 Q' o: J" D- T6 K2 j7 [7 t5 Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* V7 G" W! l( d* W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 M# M6 n2 a5 n* K0 g% W
write('</ilayer>')
* O3 K/ [9 ?/ w& j8 C% j}
. u8 q. K: D3 `1 }6 I, t  J# q- ^document.write('</td></table>')
6 s& J  i' L$ V+ l) W/ w+ y}, k2 {1 [5 u; |; ]
}
3 r7 O  N2 \# X$ |$ B# R</script>

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