返回列表 发帖

网页之跑马灯文字特效

//修改宽度% L9 q8 @; M% V0 V- K/ x
var marqueewidth=3005 U' H/ U; c! t
//高度# ~. r$ M8 C1 C, s  ~+ d
var marqueeheight=25# d/ ^( }8 Y* @9 o
//速度(1-10)0 f8 b1 v1 l- e, ]
var marqueespeed=3
9 t: a8 |3 W  j+ T* s& s//背景颜色
3 M7 X9 E6 H# `* kvar marqueebgcolor="#FFFFFF"& T7 h- t" |; l7 Q' r
//是否能暂停 (0=no. 1=yes)?$ _! e; t5 R, }$ o1 N, p
var pauseit=1
! a/ E4 l# q9 c2 N8 L) n6 y7 ^: Z4 `6 C% m# ^4 I0 |5 o4 P
//修改显示内容0 k/ Z  P' z8 e# e6 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& f5 }6 }2 p! l
9 R0 \" g4 G1 r& ^0 G
6 b3 _* I$ p9 L1 c9 G6 R////下面不需改变////////////% t* T: \- Q# E

  a9 t/ m3 z1 x& ]var copyspeed=marqueespeed
) {6 q0 p0 I. Q, Z9 f- u5 dvar pausespeed=(pauseit==0)? copyspeed: 0
/ c% _" j0 d% o) Z. d6 ]var iedom=document.all||document.getElementById' u! k. Q/ Y/ M- U" y9 \. r7 q3 v
if (iedom)
/ l2 }: Y  |4 b4 R8 ?/ wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 k) j6 g/ [4 ]* Q0 B
var actualwidth=''
( t, M& A# @( E/ b! Bvar cross_marquee, ns_marquee( Z9 {4 l* K5 w* g9 d; }( q9 z
" C9 Z& g: `, q8 t' q
function populate(){: V( ~' n) E7 V. _4 V$ q+ X/ h
if (iedom){
2 I9 z; D3 E5 u% Q6 U; h) ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( l0 f- ]+ B" z/ K1 o3 ~' R& ecross_marquee.style.left=marqueewidth+8' b& z5 W  y! }7 a6 \
cross_marquee.innerHTML=marqueecontent+ E" }+ L1 ^2 w5 |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ q6 e1 G7 O) b) A( R6 V% B  r6 [
}
6 \1 {: ^$ Z5 N% o2 h( _; X, eelse if (document.layers){
, Q4 M" R; F; m. Y4 R  d' H. r/ dns_marquee=document.ns_marquee.document.ns_marquee2
: j6 S6 n8 K5 I" ]5 Hns_marquee.left=marqueewidth+8
8 C/ u8 q: F. M$ ~# Qns_marquee.document.write(marqueecontent)3 h; ]# m# ]" A. B
ns_marquee.document.close()! q8 M* z7 t$ h. t6 P# Z) I+ G4 _
actualwidth=ns_marquee.document.width' j5 p* {' _$ u8 ~" y) _
}
# Z5 J9 Q# U( e# G7 y7 [lefttime=setInterval("scrollmarquee()",20)
( G% }2 e1 R) P$ u+ f) O  p! b}
2 |/ c0 X# P. ?+ r3 awindow.onload=populate. d/ J4 ]+ H$ {0 P9 W+ }

: l$ |. ~# J( |7 U5 c9 Xfunction scrollmarquee(){
) R' ]- e7 E4 b# M5 \; F& p6 F; Dif (iedom){
' e4 |% B$ X0 H0 ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ o" _* b7 z% Q: X; S7 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 ^$ `- J8 l4 d: i7 Celse5 [: r$ D& G$ y& {1 K
cross_marquee.style.left=marqueewidth+8( j" x- K2 h- n* n) j) S/ g
: E' e. p# A& f5 r
}6 [9 D3 c) a( ^9 T
else if (document.layers){* l; O; Y( {/ H- I' D; h, g+ R
if (ns_marquee.left>(actualwidth*(-1)+8))' w* j2 A6 _9 ~1 F" ?
ns_marquee.left-=copyspeed# x& r% X- D6 o/ u5 ]  Q
else4 T9 y! `" ?& G, _# H( D3 L& b9 Z: j
ns_marquee.left=marqueewidth+85 [. R* S6 N1 K" q
}* y  g2 E: W9 l2 y
}
" G& X% J3 \# g' M/ O0 g% e* y
) }1 ^1 S, \# A  Pif (iedom||document.layers){
/ G$ y0 z! ^: y4 gwith (document){# {& W- _" c$ Z5 I/ D7 J. m7 y0 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 h+ \8 q5 ?' T/ R5 ]
if (iedom){
3 R- |, p, H, A8 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). D/ L* n6 t0 Q) p7 M/ N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): p/ h) I; l6 e3 a# w6 M' A4 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 \5 _& M9 n1 U* g* j' B* hwrite('</div>'). n( S( p! n6 s- u) @6 b- [
}
6 _  L  w( `6 S" Y* O' S& |else if (document.layers){4 S2 m% N9 a1 |9 H: x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% p  a- p- w. T% `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 n- o3 L4 M( G. _$ w7 jwrite('</ilayer>')
, P; x3 A' @) g; S! b" ?}
; }! j) u* l$ C4 i& ldocument.write('</td></table>')  J( ?% S0 D4 X1 k) k- P% ~" o9 Q
}
: ]% ?* j' c6 t( `+ x1 e/ q: H}, ]8 V2 Z* }% t; r2 d- V
</script>

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