返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ w0 L  [% X  I
var marqueewidth=300
. K7 g5 z! ?2 P; w* y//高度
! q4 |. x$ o3 P1 c% c/ p2 l6 \+ qvar marqueeheight=25" q$ S- {+ ?/ Z- s
//速度(1-10)
7 e3 P/ }4 x6 C6 ~  S  }6 Z. g2 Zvar marqueespeed=32 W; h5 b' [) Q9 d6 \
//背景颜色5 t, _* z! K; ?0 a
var marqueebgcolor="#FFFFFF"3 Z0 @* C0 h9 V: w
//是否能暂停 (0=no. 1=yes)?( r) N$ j$ p3 F- I$ `
var pauseit=1  U3 v! C5 Q7 J' `, s
5 R' S, R8 S0 y* [8 ~
//修改显示内容
: u# g# |; m( _1 c# Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& C' c5 J% a  U2 O7 I6 X4 i+ x$ V
' r3 x4 M* j+ J. u
$ p7 r' F- j2 v0 C) K/ A, L7 j8 X0 [8 J////下面不需改变////////////
1 c* N5 D$ X+ }& q( ^
* l0 g1 x( F5 Q3 lvar copyspeed=marqueespeed( H( v! D4 L/ I. Y
var pausespeed=(pauseit==0)? copyspeed: 08 ?& ^# g7 @6 _& x
var iedom=document.all||document.getElementById
0 b, g* S. Q0 f! Mif (iedom)1 [: d: d& G: F  a" r. x+ V; H8 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 Y  U* J3 |- ^$ Dvar actualwidth=''
' {7 K' w$ E% ?' K. k$ W: Mvar cross_marquee, ns_marquee& p$ v! I; k% v! ~1 i
4 C, r4 B0 ?8 Y$ A. {9 N
function populate(){
0 v) v$ i( j' L/ L) n/ O4 Eif (iedom){
  Y8 v' w7 N" O; \5 z$ U" ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 Z1 Z: E3 Z8 G8 Z) @2 P
cross_marquee.style.left=marqueewidth+8
* W" Q3 ?( C4 K3 |2 c0 fcross_marquee.innerHTML=marqueecontent
0 x. q9 Z+ q( E/ _  C4 J/ zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, r* }2 e2 q, s! z2 b' E+ r" W, q
}; f1 T1 d- e, w& Q$ \
else if (document.layers){
8 ^: W3 t" J0 H7 mns_marquee=document.ns_marquee.document.ns_marquee2
0 s4 \" m1 P+ i% p4 O" Q% h2 `ns_marquee.left=marqueewidth+8' ]4 Z( M) p1 M
ns_marquee.document.write(marqueecontent), b$ n( U5 U% M' r( _, u
ns_marquee.document.close()3 r+ E7 H& ^, o
actualwidth=ns_marquee.document.width6 a1 `5 Q$ C8 R. H
}
6 v* I; P$ \) \' C+ ^lefttime=setInterval("scrollmarquee()",20)+ f% F4 S0 u- i4 T* b; K
}
' M6 R% l6 l: A! B6 o- [window.onload=populate
# O, ~$ g9 v1 h3 h! |  u, T, a. b, J" S! J( A
function scrollmarquee(){
. r. r- A: \1 ~/ D  M% S' Xif (iedom){- p, L! c0 A! T& Q6 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' j& D; m0 ]& T) R- G3 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 Q* g1 V. ?! T1 Q4 Z7 i$ W8 ~, R
else
' ]/ t0 f2 d' G8 B8 w* Ccross_marquee.style.left=marqueewidth+80 u0 N# T2 C0 T7 _

/ Z# H! B( ]' j# Q& v}
8 S: P  g, D" H! _else if (document.layers){
1 H, g6 n; H5 J; @4 Eif (ns_marquee.left>(actualwidth*(-1)+8))
& M1 s, h1 P8 Yns_marquee.left-=copyspeed
  b" F  ?$ |" Z  P4 L) aelse
1 G1 Z1 U3 S. N4 h" s" Ins_marquee.left=marqueewidth+8) F5 t# O. g4 F* ~- p/ o6 P& X$ h1 ~
}
: F/ p4 n4 ^( ^" s}  E" i' T, q. Q6 T: m4 M% h, J7 y5 w
! m' }% |; U0 H# ~6 p
if (iedom||document.layers){; g. [5 U1 N3 e
with (document){1 n+ L$ A  }7 g* \. w  v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% G0 e# w3 f1 U9 x9 Z5 I& D6 z8 h
if (iedom){
! h  ?- `# `1 U. [( @. P* q; ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 _, l8 L3 {3 s  u& G( V* Q; Y; {, C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' _$ S" y' y* f* G' {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 [" _8 F: p: D$ f1 n. d; H! vwrite('</div>')
3 d8 N0 B% x# S" I) o' R+ |}6 o) J' W9 A4 ~. V/ j1 j' n8 y
else if (document.layers){
% u' U: K  K7 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) K% o6 U9 g5 z" \; M4 dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( x8 x! N( j; w, o: I. |write('</ilayer>')8 H3 x: t4 Y, B4 B: H/ V
}) {- I4 H  c5 S
document.write('</td></table>')2 O8 `6 v$ B/ O* D2 b4 |" P6 @
}
3 g' n5 o: o  T0 Z2 G0 n}: M$ Y# x. u" `/ J
</script>

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