返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# p' X% r7 R; @* s) dvar marqueewidth=3001 p% h2 S! \/ w) S' I6 `
//高度
2 e  y7 N5 o9 _* m* x+ kvar marqueeheight=25
. L, j$ D$ S+ D# g//速度(1-10)# N" d: b2 a. H1 l
var marqueespeed=3& R5 m7 M" T6 I/ a( E2 l
//背景颜色
9 X1 E$ N; Z& `% B3 d4 nvar marqueebgcolor="#FFFFFF"3 i' g. v1 g( ?& H8 B. G+ Q
//是否能暂停 (0=no. 1=yes)?
: q+ P$ P$ A3 J! a( e+ jvar pauseit=1
1 @# a; V' p+ X4 |- d
% R  f( \% J3 K2 {' @- {//修改显示内容
& w0 r/ q2 X2 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 N" M! `; y6 @5 i

3 k; v* j% q; F0 b( A5 ~
0 R0 i5 f+ X0 k) {////下面不需改变////////////
2 h( d7 B8 A! Q2 I. m1 C; V+ i- s3 Q) @1 S% b) }# m0 |, U
var copyspeed=marqueespeed
  q0 B7 V: G1 s; o' Nvar pausespeed=(pauseit==0)? copyspeed: 0
- T: d4 q* i& ?3 u7 `var iedom=document.all||document.getElementById
. U' G/ s% F0 Y* O; k: _% @) Bif (iedom)
& Q- `2 P5 ^. `" }  Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; ^) K8 {$ ^& {var actualwidth='') j& \) B6 a+ E6 d: a
var cross_marquee, ns_marquee
( f6 o$ n& m) {$ B, `
: g+ x: O2 p9 \+ Dfunction populate(){" ?& v2 `* K: m" I) w5 ^/ l
if (iedom){
5 Y: C$ R/ j: k/ pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) L% g/ u# A! ^# @cross_marquee.style.left=marqueewidth+81 |1 i3 g' K- a# ^/ v$ J1 n
cross_marquee.innerHTML=marqueecontent; D! R) N) ]8 Z9 k5 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; U* S/ }+ ^7 m6 c7 D4 n4 N
}
/ Y6 k9 m8 M' A8 c. y$ x: Welse if (document.layers){
# C( h3 u; x; D9 c7 {7 Ans_marquee=document.ns_marquee.document.ns_marquee28 m. Y1 ]( I1 j& a0 z1 m
ns_marquee.left=marqueewidth+88 [+ r, _* i+ M9 O- a
ns_marquee.document.write(marqueecontent)
9 C* u4 @2 N# W- r; f  i: k, ens_marquee.document.close()
: m. `6 Z0 G; {( R: h, pactualwidth=ns_marquee.document.width3 V, ]" o4 l' w
}
7 u- ?! n9 b8 Dlefttime=setInterval("scrollmarquee()",20)
- _! F* P5 c5 Z( }7 C}1 r/ Q' \. A/ x2 u
window.onload=populate
0 x% B- [/ E: E  B0 W7 |  f
8 e0 s8 Y/ R# H" pfunction scrollmarquee(){
3 t* f' d; ~2 R& Z  l  wif (iedom){  e. \' z; H1 i& h1 L9 i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# L/ t' }  @) M: \' C( t5 B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" y" T* G( Q  x2 X* Aelse
  u( J: S/ n3 s* ccross_marquee.style.left=marqueewidth+87 b, C, p; ~& l0 ]% l% @/ o/ ^( c

2 u+ C2 w" u7 y6 R$ h}
3 J6 L4 J: W' o" velse if (document.layers){  p. C4 l* ?5 ?: `
if (ns_marquee.left>(actualwidth*(-1)+8))+ _, c8 t. i5 `; l% l7 {' R
ns_marquee.left-=copyspeed- ~7 \: `7 S9 t
else: e- ]  Z" o: _# N  A  j1 P; h
ns_marquee.left=marqueewidth+8
# I! ^- N. e2 L7 N, k# Q% u) s7 V}4 [* a8 e2 \5 K, i9 f
}
6 ?$ b8 D9 P- e+ N$ N/ p2 @0 N
4 b% C9 j( q& @, Q) ?7 B; uif (iedom||document.layers){7 B4 Q0 `, q7 E& G/ R' X) I7 o
with (document){
0 Z( M. h& S" v' j! N" S6 }$ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& B# d3 o% r. S' G/ k& A( mif (iedom){, `: |% ^) ^. e3 A# ]4 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 ~; X% u; w$ s- S9 z# X; Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 W8 t$ J4 g# P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ E7 `5 A: v! g2 Q* x& V$ k
write('</div>')# q$ ~( i) @) h* y( O7 k5 j
}4 h7 R. N5 ~) e4 K
else if (document.layers){
! t2 }5 _5 z2 }' K9 q) q" |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) N& L" K' x- Q1 v+ Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), O* ]1 h7 \2 z' Q, k9 L4 E) P
write('</ilayer>')
% F6 @& j% h6 Q) m% H}5 A0 w' M: W& L# `2 a
document.write('</td></table>')
  Y% F, A3 J7 ?1 u}
' v, r- D, x1 Y/ f}
: ]  y! R& y( K: m0 [! K</script>

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