返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 ~/ c* {/ i  H2 f8 _var marqueewidth=300
3 }, m3 h7 i9 F$ y: t6 ]//高度. |: H/ u0 C" z  {+ `
var marqueeheight=25
* L2 T. P+ P' [//速度(1-10)$ B8 w$ d. Y: u
var marqueespeed=3
" _5 H3 {0 m+ x' R! g5 E//背景颜色
7 D4 `. P: p( o3 {. _/ t6 gvar marqueebgcolor="#FFFFFF"' V& _) x6 C: b% r9 b, S
//是否能暂停 (0=no. 1=yes)?
* e) _8 d# m% f' k+ p+ ^var pauseit=1, l0 d: w) i1 h$ @

% x+ {3 V( n1 m  x6 u8 X//修改显示内容
  w/ d2 P2 m4 V9 l, j/ ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, v* f3 e1 [1 N& |" X: a& K
* ?4 H- Y+ y6 I0 _: J
& x! _) H& f8 E3 j# j////下面不需改变////////////% f* z9 `  b9 a! e3 k0 E% e2 n
6 c; ~- z# D0 H  z5 g  ?$ q: {7 ]
var copyspeed=marqueespeed7 v  Y: x. u% Z5 \+ [
var pausespeed=(pauseit==0)? copyspeed: 0
( s. K2 R6 E& \. Tvar iedom=document.all||document.getElementById+ J2 w: g( @) Z2 P1 a- }8 c
if (iedom)
8 A( [- l3 {* q! P( edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 w1 m$ u9 b2 f1 F/ p" A% _3 T
var actualwidth=''* g5 y2 W9 t3 H- _# `3 s8 t
var cross_marquee, ns_marquee
2 x  t- t5 x4 ^( f' g, k8 ^- }
' i# v1 U$ j9 m* Qfunction populate(){
/ w2 [/ u, E5 _, \if (iedom){5 W7 H* u. p8 z, }- }+ A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% S0 r: c) {0 I$ f% U) x$ @cross_marquee.style.left=marqueewidth+8+ k% q6 y; _5 O1 g
cross_marquee.innerHTML=marqueecontent
$ J# _% }, ~) t- ?3 Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- Z, n, z! ]( E0 {+ Q}- K& y1 v' m* t
else if (document.layers){) T+ N" v5 W  v. T0 W$ o
ns_marquee=document.ns_marquee.document.ns_marquee2
+ z* E& y6 r& P2 Nns_marquee.left=marqueewidth+8, D5 v; J/ Y$ j* B$ a4 `$ U- v
ns_marquee.document.write(marqueecontent)
& g, y( T. N/ M2 k2 Qns_marquee.document.close()% r: B5 W1 b8 r' _) [! y7 }1 N
actualwidth=ns_marquee.document.width
0 F, G! E9 b2 J* ^7 \- G  B}# u( I% ~1 [5 m0 |5 m% c' H
lefttime=setInterval("scrollmarquee()",20)* I$ w' k/ T: C, A( Q
}
, |# W1 g% J( [) G3 x; Awindow.onload=populate
* q& q1 j/ s4 z' b5 B+ }6 Y9 C0 T/ z* h, o/ [
function scrollmarquee(){
- K% ?, g4 T: Q2 c. Kif (iedom){/ d' D( I% P3 B. w. K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; r" d/ J# ^7 d* `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 `0 L$ L* W% d( S) A
else
( j7 {8 Z7 B4 I/ B6 ecross_marquee.style.left=marqueewidth+8
9 i7 P. c/ u( Q* r6 c1 R& N5 R, ^5 H; k
}
4 {8 n+ }0 Y0 o; g' relse if (document.layers){$ _' L% ~' r3 N! _/ z5 [; y
if (ns_marquee.left>(actualwidth*(-1)+8))
+ N+ E' Y) Z3 H9 P* s& k7 c+ uns_marquee.left-=copyspeed
6 z5 q# ?4 [, C- j, U) f- lelse) E$ A( ~; R( X
ns_marquee.left=marqueewidth+8
/ W- U- Q: Q: X9 H}
9 J, o9 M0 O/ s3 `}( T7 z) ?" V) F8 ~

  i  M# h3 {2 I1 ~2 f' e' H) Sif (iedom||document.layers){
6 I1 `! q3 S* Y" l8 o6 f" [with (document){( B6 W% q# Z# v; I8 q1 B/ e2 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 m/ j* j' m6 x, Iif (iedom){- G# O# S( O( }9 ]- t0 O7 d# q6 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' i5 t, f: X2 R2 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; I  @% l7 a' Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 \7 v5 \* K4 e% k( G: l
write('</div>')2 L0 l. }9 j, m, P5 S
}
9 \% ?7 v1 z, w: _0 Q- eelse if (document.layers){: u# [1 c, w: i" e4 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, G2 j1 a' g* pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  i6 s) B' H+ t- j$ Z* T/ K8 R
write('</ilayer>')
) r8 I6 j" W% R* d! \' b}9 _# o) X1 c; _0 p5 y
document.write('</td></table>')
& p4 y% q8 L5 h" `' W! t}
5 J5 s. J; Q0 I}, ^9 e, G/ h" Z3 e
</script>

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