返回列表 发帖

网页之跑马灯文字特效

//修改宽度, b1 Q2 \5 s9 J  u: b& i
var marqueewidth=300
: ~# m$ y# R$ g6 x& l0 G//高度3 E: L/ ~3 I: A+ d) [1 |
var marqueeheight=259 Z; k+ I. m  u
//速度(1-10)/ D% }$ D5 \6 |9 V/ c* [
var marqueespeed=3
1 b/ f" A" s  ~# e+ \//背景颜色0 e4 i" k. [' O; E# ^
var marqueebgcolor="#FFFFFF"- h7 l% X0 L. L) g2 g
//是否能暂停 (0=no. 1=yes)?
. G. f+ g4 o# _$ x& f  kvar pauseit=1$ ^$ }! J. r: G& h; X& \, u9 B

8 s+ R6 [* B2 L/ t& x. R//修改显示内容
' _( C: _; H( }& p( |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# T# l) X- _  A2 {

) {/ O/ n/ r' o0 q( V$ [! U2 t
. F" ^5 s3 b. ^  J$ l////下面不需改变////////////. C( A4 f+ S% q, B! T/ W- |# O

; k& ^1 ]; m1 r1 _var copyspeed=marqueespeed* j$ U/ z1 W: F, |; C. h
var pausespeed=(pauseit==0)? copyspeed: 0& f3 D2 _7 L4 J8 W+ e( e
var iedom=document.all||document.getElementById3 e+ O. C) K& G/ R. S5 D& N8 W
if (iedom)
( @# f$ Y; {3 N/ idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& Y. E4 d5 Y5 c3 f0 r1 h# Fvar actualwidth=''
7 F" B+ A# T! t9 @% `$ m' b% ]var cross_marquee, ns_marquee% g. Z# _2 x7 y* X! o0 a
5 o3 A9 p& i0 c5 c! M! x0 a+ ?
function populate(){5 `% m: t; J: [7 ?
if (iedom){
# a: c+ b4 K5 T( X0 v2 q- @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 ?$ m: x# v+ Q2 N  |6 U
cross_marquee.style.left=marqueewidth+8
% O9 Y) N. S7 _) q# gcross_marquee.innerHTML=marqueecontent
. l, f# ~& w/ O: D* sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 K- a4 h% X8 J* R6 l
}" x, Z0 g3 Z7 w$ l
else if (document.layers){
- t. z+ E# Z2 p4 Hns_marquee=document.ns_marquee.document.ns_marquee2+ l6 a. O  B4 S# j, g5 X9 J, L
ns_marquee.left=marqueewidth+8+ o9 i! p% ^4 D6 {) c
ns_marquee.document.write(marqueecontent)
0 T& \; K; x" Y  n/ ]+ @: U, r' uns_marquee.document.close()- S$ q7 t- W' \" k7 P9 {3 f
actualwidth=ns_marquee.document.width% ~, u$ T7 X4 K0 G! H
}7 M& I# G" U: O' x! c
lefttime=setInterval("scrollmarquee()",20). d( H- ^- C8 u' i. D4 k' Q0 {, _
}
$ R; d8 p) T; I/ v0 Z0 m. twindow.onload=populate
) N, W5 `4 n/ h% n5 I2 J2 T8 ?/ ?! g0 p3 Z
function scrollmarquee(){
* n( h0 L; k# Eif (iedom){9 V  T# T+ U# e1 O2 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' h' ^  }" \; s6 r( X2 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 ]7 e8 ?/ k) L3 ~) t- w
else
( q% U5 g5 {/ g* Fcross_marquee.style.left=marqueewidth+8
5 {5 X4 W% ?8 R  n
: z, F6 A) V4 t}
1 ~5 B+ d; N5 lelse if (document.layers){
, t' N6 x/ ]) b  ~9 o5 ?if (ns_marquee.left>(actualwidth*(-1)+8))2 G+ T5 Q( |+ E9 i
ns_marquee.left-=copyspeed
% y, u6 K% Q( w- x' oelse
( r: G! D2 P8 a5 z- rns_marquee.left=marqueewidth+8# [5 O/ k. M' n! c
}
7 g" i3 C  t0 c$ s% r- ?8 j}
8 L# j4 O& i6 P# n) c% b$ r* d* N: G  X" c' l/ }9 K6 B
if (iedom||document.layers){7 Y# f/ k  N8 b( B9 s
with (document){5 S( G% k) A& Q; p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 \( N* h, L* a) h( \if (iedom){/ P  C+ o+ d' J3 Y- B) u+ H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 i! e- D4 S* d/ u+ J5 t( R: f# d3 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). ]/ H( p& W* v5 \0 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. }5 F; |! w1 j7 B7 `: `6 nwrite('</div>')* o7 z" ~6 E3 G8 X
}" h5 B  |1 k# b1 s. I0 G
else if (document.layers){' v  z% K, a5 ?, {9 t1 P8 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" D% W8 a2 V2 s1 Q% J$ i& q7 ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): h& v. Y0 j5 w  ?' p
write('</ilayer>')8 \; n: O" e6 e% S, b( P9 S& ?
}" x3 Z2 M" |- A) U8 M! ^* F: ~
document.write('</td></table>')# N; i+ c+ W% t- h% K
}
% A$ Y# k+ T) I% i& q" a7 T2 {& V}) M  P# t* Q2 e* \  a" t9 n3 G
</script>

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