返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 j# D; V3 D2 w6 h, {var marqueewidth=300
% [" s% E& O% L# P//高度
! ]- Q" T; r  w4 Q2 m( r; Fvar marqueeheight=25; \0 V. ^3 u  P/ W: I' Q- b
//速度(1-10)
  v$ u, y, G9 o/ M" w- Tvar marqueespeed=3' y% o% l4 Q3 J% @  @$ ~$ T3 \% k
//背景颜色6 J7 J3 W* F! w( B3 [  h
var marqueebgcolor="#FFFFFF"
* k# e- U$ }8 J! v//是否能暂停 (0=no. 1=yes)?
7 C7 U! O4 G" C  }% I" q  i- P8 @3 yvar pauseit=1
  h5 T; `6 i8 t, G) C. Z* X9 ?* S" z7 q, Y7 d1 L0 y
//修改显示内容
& z0 o# Q, ^8 h" t/ C9 k, Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 Y! q2 Z$ F4 a. X
5 s, A3 g0 e! h% v

) x" h6 K  y/ X2 J////下面不需改变////////////, G5 W, H* H- [  ~$ S& U$ v! ~
5 ~0 O! m9 b/ g1 }
var copyspeed=marqueespeed% l! |/ B9 i5 p
var pausespeed=(pauseit==0)? copyspeed: 0
/ J- i5 Q! y( Zvar iedom=document.all||document.getElementById
+ X& d: Y/ t4 \$ s9 J; eif (iedom)
4 w8 R" N0 e' ?" M8 {( z% X, Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 u& A$ Q0 K# C
var actualwidth=''& X  _; v  h. M0 X" C; |! u
var cross_marquee, ns_marquee
  V& m5 S% |0 r6 x$ E) C; m
& K4 b5 X4 H( [function populate(){. y( |- B! ~" c3 i/ @+ C, _9 l: f
if (iedom){
1 _) V5 o8 }/ V2 W; j# wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; n; ~1 C; i8 l6 ~, C4 ^; V' |
cross_marquee.style.left=marqueewidth+8
0 s% [, q% `) r7 o( M' N+ hcross_marquee.innerHTML=marqueecontent- _, U4 w3 F" L0 M& B3 c: J5 v7 ?- I: Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 |* e' j% z0 u% h3 r" l, {
}. M8 _" Y% H, n" B
else if (document.layers){2 W& R  z1 p8 ]
ns_marquee=document.ns_marquee.document.ns_marquee25 m1 ~% d1 e) \
ns_marquee.left=marqueewidth+8; x' U# |0 A! r, V& T
ns_marquee.document.write(marqueecontent)9 |& n/ r5 ~3 ]8 }8 b6 D6 O
ns_marquee.document.close(), U7 U- r# H$ d1 o
actualwidth=ns_marquee.document.width" P9 }, }. Z6 c' f, j
}1 @% x+ K. [2 Q6 k& j) y) R% p- ~
lefttime=setInterval("scrollmarquee()",20)
& Y, ?/ S/ g! u- u" j}4 ]5 H5 |6 b/ |' N# a  F7 C' Z! r5 p
window.onload=populate2 ~0 Z% H- j: ~4 M& Q$ i: Z
9 `' g) Y0 I  k5 b# H8 Q' n/ E
function scrollmarquee(){
7 ~# s3 W5 p- Rif (iedom){& n2 Q3 L2 }7 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 S+ `$ [9 W! W2 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' {' a, c* P, ~8 Kelse( n* N, R% z0 _. X7 L
cross_marquee.style.left=marqueewidth+8, t5 H8 t1 z; D6 e" ^8 C4 t
7 j- S9 f2 j1 s& m$ a8 o
}  C* a( Q$ Q# @
else if (document.layers){
& A- P8 T3 b& O( f- T1 X3 d: Pif (ns_marquee.left>(actualwidth*(-1)+8))6 k' V% \; M' y1 Z% _2 r8 L
ns_marquee.left-=copyspeed) [: J6 {% O3 \# N
else
3 f9 G) E! f9 \% G, H9 p( uns_marquee.left=marqueewidth+8
9 y, C6 h9 d5 ]% J3 M. e}
: u3 X8 c% ]6 H' z: n5 g}7 o* j$ \! d. O. w( q  w0 ?
/ T) Z# P- B9 L/ g5 D
if (iedom||document.layers){; ~( K( }* s: M, i. o8 V
with (document){- Y+ X% n% p! q* N4 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ Q! F! M3 W8 \' V2 Aif (iedom){
+ \4 G0 {# I1 Z- E) _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  `; O/ c& x+ p3 P7 Z# F; x. z* u* L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# D4 P6 P' Q1 D. T7 m  H0 y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); I8 l) L+ l" g9 |7 N- }# {
write('</div>')
; t* T' j3 o) K6 F" B) i}
9 G2 L; j- N- G. g: Jelse if (document.layers){
- Z/ M3 C* F* i- p2 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ a: D" r+ B- _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 v0 m8 S% Z( g+ H! V! @1 a; C
write('</ilayer>'), ]# N7 v5 I' b
}
) W! W; k/ U& m2 ^/ bdocument.write('</td></table>')) u1 H- d5 k9 ^  p1 @# N- |
}
) w( A# _' g% P$ k, K}* M2 D( P6 p7 u3 U$ a- x6 m
</script>

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