返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 ?& Y" _, ?# ~6 C0 S& Kvar marqueewidth=300
. @6 W% Y1 S0 i; j# w, ~//高度
; ~% k9 C, I% M1 o7 svar marqueeheight=25/ T7 Y( p) l; o6 J
//速度(1-10)
/ B6 I  B6 a) d" g! c% k+ M$ b1 wvar marqueespeed=3
! |: Y2 z# m- q% f: F* H//背景颜色
0 s% v& u; Q8 |' O% ?4 K7 }  tvar marqueebgcolor="#FFFFFF"% H# }( [# A* X# ^7 g2 f1 W- R
//是否能暂停 (0=no. 1=yes)?
) t) C  S% C0 M4 u0 Yvar pauseit=1
& p4 c, a# c( I) R4 b) v3 s1 v  H
: g6 O* W/ T& l5 c- h//修改显示内容
5 N6 P% i. S2 R6 |$ lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( q! h; }5 s4 `' ~3 P8 X  [8 J

! z% r- T& M2 r1 B; p5 L9 \1 ]; E1 P: T8 w3 z
////下面不需改变////////////+ j7 [& _* t2 E. y- q2 f3 A8 ^$ }6 c

) G# m. Y4 o+ R- i/ D6 _var copyspeed=marqueespeed/ E9 \7 S8 [& p* r. T7 \
var pausespeed=(pauseit==0)? copyspeed: 0% M! x7 r) c) i
var iedom=document.all||document.getElementById& h8 l6 Q- E# W/ ~
if (iedom)2 x( n) Y) H" q( C( c3 i/ P. v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* P  F6 K5 Z; ~$ Rvar actualwidth=''
' a8 H+ [# T" K" bvar cross_marquee, ns_marquee
( u7 |' M# A0 L! C& d
7 P7 b9 h8 B) G1 Nfunction populate(){
9 X6 @: x8 o! g, N+ _3 ~if (iedom){
  L# e, k3 M6 X+ u9 M. fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. ~, w: Y7 c' S/ D8 g
cross_marquee.style.left=marqueewidth+88 R; d$ F; L' {3 f
cross_marquee.innerHTML=marqueecontent
; w0 {5 f+ o4 W1 L5 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 K" C6 G( ]; p! z0 `, P
}8 ~/ u7 a" U" R: a& q
else if (document.layers){) s& Z/ t' k+ s5 v9 k) @, h/ r9 w5 j
ns_marquee=document.ns_marquee.document.ns_marquee2+ }' _& m" ], o  m, ?: S. W! b
ns_marquee.left=marqueewidth+8
6 Y0 f- }! \! f. Z4 Mns_marquee.document.write(marqueecontent)1 f, _$ H) p0 T. j
ns_marquee.document.close()
" q3 i* @4 c4 i8 f! Wactualwidth=ns_marquee.document.width* R- A: p0 F2 c# [
}; `" H( C" s1 F) ^$ I- ]8 _* H
lefttime=setInterval("scrollmarquee()",20)
4 h- Z2 j/ I1 E7 E}7 k* c( T2 o1 Y2 a
window.onload=populate
4 ~/ ~, A; _( m1 ?2 a' i3 h7 S8 }
' d2 w5 W9 \" v" U! s3 F! Lfunction scrollmarquee(){
8 D6 _$ [  ~- qif (iedom){
: y& A& q+ N2 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 j# ?% t* k9 K5 a. ^) i! }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) d( ?  y$ f) Q& q  p
else
. q- y* z8 X( z2 ~1 T( h9 q: R$ Ccross_marquee.style.left=marqueewidth+8
0 I1 w. d% i, C) G1 M: N# x/ a) b$ O+ f  ~5 [2 D
}7 i+ A5 Y4 q+ O0 U
else if (document.layers){
! m2 g! r9 b% Bif (ns_marquee.left>(actualwidth*(-1)+8))7 N+ X" B4 D5 |7 v  [$ w( x
ns_marquee.left-=copyspeed, k8 z/ R2 T; [% e& k& x6 |. `3 x% Y
else# c6 D+ f" W: R9 X, R- p& Z" e4 T
ns_marquee.left=marqueewidth+8
* f, |5 G/ o8 O3 Z$ Y5 D}
4 f  W4 @; a% B3 p& R}
* f0 t$ H- b/ f+ W/ Z
: [" F) _' D" pif (iedom||document.layers){  c6 x$ b' F6 T8 L# O: w& v1 t
with (document){$ G" ]1 i3 `+ H7 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ^1 E+ v8 b. Lif (iedom){
- f) C% v4 M0 n8 X7 m9 Y) a0 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' B6 d# c0 M4 P) N, }2 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& x/ g1 u3 i- Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ j5 _" J' ?3 l' [" K5 `
write('</div>')
0 k- \# Q' A! y3 U}
/ s  R, G/ n8 j* x# P0 Ielse if (document.layers){
  n3 }) b4 M% ^  S- H2 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( m7 H/ B8 N6 z1 A  ~% H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 O6 b& u, [" w7 X+ }write('</ilayer>')
6 b4 U, ~7 O3 R}$ J; J/ I9 g+ k- o% k
document.write('</td></table>'): L8 w8 B; q: \( ~6 `2 [( t1 |
}) e9 Q* W4 ?( h$ B9 q
}5 G" l% o+ Z$ d; U
</script>

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