返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" b) y$ E% w6 U2 s$ Dvar marqueewidth=3003 W$ e- W) \& \' E
//高度
8 b' F$ }. ~, m9 V) f4 G/ Fvar marqueeheight=25
  ]) g* S; M' o4 S//速度(1-10)0 m- v5 i0 O1 e  \( \( o# H: H
var marqueespeed=3
0 x# y4 E" \, V4 w( e# x, \//背景颜色
8 \3 |% E- r. J; Kvar marqueebgcolor="#FFFFFF"9 w9 i& f' K7 `7 y  L
//是否能暂停 (0=no. 1=yes)?3 S/ h$ Z2 P2 k! E( f) v; q4 p
var pauseit=1
# k1 |& S9 u' j  r2 m3 U, n: A- Q! }9 U
//修改显示内容
$ ~8 c. H5 K1 A& Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 Y+ F% e! E$ F9 y* P& u
* b/ t$ q& b- n8 q0 X2 P* a
7 ~: f6 K, S3 R5 ?
////下面不需改变////////////
: t* }2 p# c! u# f2 W% H' Q  `5 {2 u3 ?. }& X/ \) m" e5 A! r
var copyspeed=marqueespeed
: q& e; z' k. G7 l8 Ivar pausespeed=(pauseit==0)? copyspeed: 00 j7 k. D3 j3 O& L
var iedom=document.all||document.getElementById6 T$ w. R# a) y7 i3 N
if (iedom)0 f, `4 Z/ @( b" q; O* N6 n) D; i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' a. N1 D  g6 e. tvar actualwidth=''
; L$ s; y& \( v) X) }' Uvar cross_marquee, ns_marquee8 {. B% F* W; O% [1 b  p, s
& V( O: ?( v8 j- l3 D0 `
function populate(){- y9 P$ K4 W+ G8 ^. I# D
if (iedom){/ D1 }+ I4 y- e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! f6 `( U" C. u' P; E
cross_marquee.style.left=marqueewidth+8: d0 I- r9 l/ a: ?
cross_marquee.innerHTML=marqueecontent5 ^' C$ @+ B; b6 I+ S4 v% n; A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 B& @* L' H# ~6 X}
" T& \6 V( ~, c. W# H8 I) gelse if (document.layers){
" ^5 X2 s- w, R+ T* @3 H, Rns_marquee=document.ns_marquee.document.ns_marquee2  w# U" S* L% w: f  Q/ r
ns_marquee.left=marqueewidth+8
4 E# U: ?) c0 \6 H/ ans_marquee.document.write(marqueecontent)
7 `( [5 ?" s1 g2 k6 Yns_marquee.document.close()
* g. [+ l8 f' B  s# Z0 o; pactualwidth=ns_marquee.document.width7 w2 ~) j2 {9 H) T4 J  o
}
9 x: V. O, a5 h+ q3 ?) |6 Elefttime=setInterval("scrollmarquee()",20)3 w$ q' A9 g3 W$ f0 L
}' b: D$ [2 \& Q4 e
window.onload=populate: W5 t% O8 t- I" G# g4 l
* [  q* W5 n1 z3 q: [: h
function scrollmarquee(){' G" I8 R' W/ ?/ ~/ I' [- H
if (iedom){( F. u* n- D3 W$ V; Z& Z4 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' e% x6 I; U5 S6 a4 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 e) X- k0 L( o/ X) p" k/ v& {else
: u& p6 P6 M4 Zcross_marquee.style.left=marqueewidth+8
4 Z  I. E, H' ?3 w
0 @( f0 N9 W+ s) J}% x0 z) ^# P5 _3 y
else if (document.layers){
3 ^5 [* g6 y7 [9 t# Rif (ns_marquee.left>(actualwidth*(-1)+8))
2 _6 z- Q7 f0 g9 `ns_marquee.left-=copyspeed
8 x4 V/ ]: R) R1 j" _2 P: {; Zelse
7 t% ~- F, i; s; Q! `2 ins_marquee.left=marqueewidth+8, F% q% L. {! W7 `0 u3 p# l
}4 j- |6 [7 _! W7 V4 M) H1 }
}8 h1 J3 l, q) f9 X- Q/ `) v
# o5 l) y1 R9 P5 S) H+ W$ L, y, f
if (iedom||document.layers){/ C# i/ O( \' `% f
with (document){% @" @, q1 f8 i: e7 _( w9 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 k: D+ a* ?# a$ v( S! Dif (iedom){' e1 l, c) [8 Y( i4 T- g5 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' o' f; A: U9 r' t4 d, x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# z  C* R2 A9 l6 b* Y, m1 x, X( H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( f; Q6 e2 y( W6 D8 U3 f" o% e9 }
write('</div>')  u' _% f4 R# e3 e$ C5 w# \# N
}
# d/ Y4 g# @, j( H) W0 r+ telse if (document.layers){
5 {  I- `/ \6 p7 ~& s# r9 lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 C  G% R5 D; T8 l+ cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ U% L9 |" a0 D3 g5 N
write('</ilayer>')  i! P% N$ [: l& {; H, U; g$ }
}, Y0 N3 Z' Z4 B! W; d
document.write('</td></table>')9 s  o  }( g1 M4 }
}
% m+ c9 k9 X# S3 g/ j. m}
; |6 `2 y1 ?6 D$ W1 D: S' X</script>

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