返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* h. ^. Y: a8 j5 x/ o+ |& Jvar marqueewidth=300& O- m! p% U, w. T
//高度) ?7 T  s. w% p6 d& B+ e
var marqueeheight=25
- r; l' \9 G# l& Z) A* q//速度(1-10)
( a7 ]6 g/ i" t* b4 D8 ]var marqueespeed=3
; S& ~4 M' r! v//背景颜色
# k4 f, W. Y- K+ Z# k+ a6 ]var marqueebgcolor="#FFFFFF"0 j* M3 W3 [+ }
//是否能暂停 (0=no. 1=yes)?
" ^. `9 r  w( Y, e1 Lvar pauseit=19 f* x& k% @3 Y9 M3 e

, h) p8 e# X' d9 c8 l; W//修改显示内容5 p" ?( |$ m8 K; }4 Y# Q2 o6 k2 ~+ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# W5 l/ [$ D, m9 }
# H4 M* M, t: [$ w
& [7 ]+ B' j5 K* ?0 q' {2 A5 C////下面不需改变////////////& \6 J( U: j6 p! b

2 e% h7 j1 |" L" a, Vvar copyspeed=marqueespeed
% d% n  Q6 g9 Dvar pausespeed=(pauseit==0)? copyspeed: 0* W. o8 o0 P  d+ a/ F
var iedom=document.all||document.getElementById
5 M( f# I6 r2 n, ?: t% U0 tif (iedom). ~. L3 {) z2 O( o! y) M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 d, n# ^+ y" E* r" [* qvar actualwidth=''
  P) }2 P5 C2 Avar cross_marquee, ns_marquee
9 G3 I6 j8 ~* n  S' E, L/ R. @  r4 f' f2 m4 w# J
function populate(){
5 F* o  q- N4 Vif (iedom){
" s2 `! ]9 j0 L: W# [/ Q% U2 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* S9 i) G# _% U. q: x, z
cross_marquee.style.left=marqueewidth+8! Z/ P% F8 A/ Q& |3 v
cross_marquee.innerHTML=marqueecontent
) S# t# F* Z5 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" C" ]: G- c, |}
2 ^9 Q/ s4 F  |& _3 p) melse if (document.layers){
5 ^) R4 p4 v+ _  h9 m7 @ns_marquee=document.ns_marquee.document.ns_marquee2
' J# l8 k7 m9 V& i( nns_marquee.left=marqueewidth+8" M1 a0 G6 f% G4 ]- m
ns_marquee.document.write(marqueecontent)
& D7 x7 R& @( L& ?6 i1 m& T* e& _# S0 i, ens_marquee.document.close()
) X' Q& w  u( z; Eactualwidth=ns_marquee.document.width
6 D8 u# s5 @- e' X8 s}
7 h) \# g: ^, {lefttime=setInterval("scrollmarquee()",20)1 E) ]3 s% E+ G6 J+ e- M2 W8 C6 k
}4 f" X  t2 i4 ^$ t# v+ D
window.onload=populate: v; y: Y$ Y2 s3 H4 j; E7 L: V, g. b0 V+ ]

& S1 j; y/ l7 V" r) jfunction scrollmarquee(){+ }  `* I, S, J* w
if (iedom){
0 H  ^" y5 q3 c5 V) C5 t1 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 v8 k$ c! N/ u" h, [- gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ V$ m) M) ~# q. G/ E7 telse# L, i  P1 u: l
cross_marquee.style.left=marqueewidth+8. S8 t7 @" F4 G2 [: h0 e
1 ~. \4 ?! [- J8 O
}
- g* g( i8 c: _$ {else if (document.layers){9 }5 t3 Y. _( b) r$ |+ |/ p5 W
if (ns_marquee.left>(actualwidth*(-1)+8))! R9 R' G) `4 v/ b0 Y  D
ns_marquee.left-=copyspeed- v. h% M8 w4 w( b
else
5 H" {- J  _4 H- L/ c$ z! o9 kns_marquee.left=marqueewidth+8
7 G! H! V/ t7 H: o  q7 M* {) a# M9 R6 W}
. b7 X* V# Q  F% ]3 y2 G* V}
* ~: e2 ?' q; y$ X, H; E% r
7 l& ^3 ]' E) e5 V" o: Zif (iedom||document.layers){
; Z  M! d3 }( ~1 ], K" Q8 t7 v3 Qwith (document){+ T' E2 }/ R# u: {  l; h4 g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& a8 {% `, P. P( f9 `9 b; v
if (iedom){
# s2 J% o6 c; I* H$ u$ g% r0 Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  b/ F9 B3 \' {+ H" o  Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 u# F* k* }* J8 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! C" a9 u* Y/ D, a
write('</div>')
% X) {+ ^" r' o+ a2 A; c/ w}
) ]( K0 b1 E9 y+ g! z" s3 O1 Y9 pelse if (document.layers){
  K8 l! g& x' m" g  w+ }: \4 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% O6 O$ V- ?, j% {% i/ [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, E2 Y: F# C1 [0 W. J' Gwrite('</ilayer>')' W/ ]$ B$ [" V% n7 F, [$ ^
}2 w: n9 k; x3 ]5 a8 T6 L% {
document.write('</td></table>')
0 J. t! v% x9 T4 z" j: V, W, M}4 H3 Q: u2 h2 l3 @+ W6 o5 m8 q
}
& E$ F( Y+ L2 u" x% ^</script>

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