返回列表 发帖

网页之跑马灯文字特效

//修改宽度# _0 C1 a2 d" ]6 d5 z- t8 }8 e+ Y
var marqueewidth=300
+ {1 ]$ A8 U7 D$ z3 W//高度
; i! Y/ T1 E5 l/ rvar marqueeheight=25
: l  t) c& x( t8 F6 R, [//速度(1-10)* |5 z  {8 |; R. H# L
var marqueespeed=3! u' W2 u  t. Q( D6 v
//背景颜色3 h' {3 h( H# U; f5 O5 M* d1 m
var marqueebgcolor="#FFFFFF"5 |, P. T+ z7 `1 u
//是否能暂停 (0=no. 1=yes)?
3 a2 s$ t0 t/ rvar pauseit=1  j1 N+ L' e0 x3 b

- M4 K2 `: ~- G8 `% m  H6 s) ?//修改显示内容
% `3 |- e* m! W# e8 Z0 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" @6 f+ K9 z. v. y6 r" X3 ~# @1 L
& p% o1 c1 s* ?% r: {6 g4 s8 a
+ Q5 q2 s* M* {% O: _0 s1 _////下面不需改变////////////
4 m6 ~, Z3 @9 P3 G8 E2 @
/ O" P  K; U2 wvar copyspeed=marqueespeed9 x. ?( C) }. s# j6 ]/ G9 p9 Y
var pausespeed=(pauseit==0)? copyspeed: 0$ c, S' I* H' F
var iedom=document.all||document.getElementById
$ P& z$ Q0 k, m$ p# p* Qif (iedom)+ V! l* v5 d, D0 W: {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 `. @7 r+ I' c& W) f
var actualwidth=''- c& f5 U" ?" N1 n
var cross_marquee, ns_marquee
; f# s. T' ^6 e* Q3 R2 z6 p
. |; \1 S# J! b) Ffunction populate(){
+ U+ i* ~7 c& ~# j7 }" a+ H, Oif (iedom){
: L3 f' a9 |# T" @5 c5 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 b8 o) j" ]8 L* Y/ ucross_marquee.style.left=marqueewidth+8
$ B5 w; v$ @0 m$ I! ]+ Ccross_marquee.innerHTML=marqueecontent# ^2 x7 N8 e7 b9 J. l5 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  R/ D7 Y8 `$ B; g% f}" `$ E7 r9 v+ a: r4 r' ^
else if (document.layers){& J+ Q. d0 D+ u4 }  H
ns_marquee=document.ns_marquee.document.ns_marquee2
2 ], t6 {  J" ]ns_marquee.left=marqueewidth+8
) \: H. r, z/ q+ L8 l. {3 m& |0 o/ vns_marquee.document.write(marqueecontent)
4 `  [# o+ C! S; M+ Lns_marquee.document.close()
) y8 X' d7 u7 J% Eactualwidth=ns_marquee.document.width
! L. _: m/ E4 s+ d}0 A/ I. ?" \7 d; r& h
lefttime=setInterval("scrollmarquee()",20)
) `4 h& c/ J4 c7 g}; P) x5 R- Z: w
window.onload=populate
# R7 U+ h" w9 ?/ y3 w( Q2 `+ ?; \, F* e
function scrollmarquee(){5 G; e% K( [7 c4 I
if (iedom){" i2 N" ^  ]8 o, h1 {2 ?! Y5 y, h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 M* o' i. h+ p: L! x, A: ?/ ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! I) A, k% R+ E, l5 _$ nelse" C2 z4 }6 @- r) W/ k
cross_marquee.style.left=marqueewidth+8
: F" g$ U8 h7 |: z3 c5 c- C1 I5 M( ^- }3 _" I  M8 g2 p$ U, `7 ~
}2 M1 _; O7 j2 z8 G; n
else if (document.layers){
. n% [9 a; I3 L( ^8 }if (ns_marquee.left>(actualwidth*(-1)+8))
0 {% D+ |, A5 hns_marquee.left-=copyspeed* C7 P/ n; A. n  Q" v* Z
else) E$ \  U# V. S0 s
ns_marquee.left=marqueewidth+8: v3 Y% r' Z# i1 Q
}
+ L/ d! }0 \( f+ T, Z5 G1 o" z9 M}
" T7 Q% Q* }, X# z
  e) r2 E  @; E4 |3 U, |+ L8 qif (iedom||document.layers){. f# w5 u2 z8 @6 O
with (document){7 X/ {* g5 H: h' E$ I1 W% F1 b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 I' g( M# t; I6 G0 O; T
if (iedom){3 p5 y; F/ K0 T' c$ \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ c6 S. R1 f" o$ A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, d! i- G5 @9 \4 _' awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' y# y1 o! o* O. m1 ~
write('</div>')  [, ?, u0 m; d) {
}- d: s: f# ]8 d" Y- {0 [, `
else if (document.layers){
) _/ U' k+ ?  I) s5 z5 [4 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ U# |+ w1 B5 k/ _5 J5 C. fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 I3 j6 ]) s8 `; j' p) U6 |  `( Owrite('</ilayer>')% _; F6 t# b- i; p
}
% m! V. D8 l' ^  H, Y) P' Pdocument.write('</td></table>')
, K. D6 F& G! ~8 x6 R/ @: }" F}
" l8 l5 l( C3 m. Y( ?$ r8 V}
* f& R9 A3 S# P5 v# o; z$ [</script>

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