返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 n9 Y* Q- ?. M6 D6 n
var marqueewidth=300
, L3 t) O$ j( ^5 a5 D6 S6 a//高度
. D" U" t: H# Qvar marqueeheight=25
- C. W/ F" a& U//速度(1-10)* m+ k/ r0 O; _- x! ?
var marqueespeed=3# i3 n+ W0 \/ @* U$ I
//背景颜色8 U/ D7 E- W; y# {
var marqueebgcolor="#FFFFFF"
3 R" N( o& Q; x0 _: r7 B//是否能暂停 (0=no. 1=yes)?
# ?( Y  ^" S- D( m3 U" kvar pauseit=16 S; N$ W' ?) S" F

8 S! {; Y' _+ ~, F//修改显示内容
: l$ E' w& R) k& I/ L2 l' ]9 ~; `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  y# s9 e' i/ s" @
1 F4 p" n1 O4 b8 a# p

  b2 @& u7 }7 M////下面不需改变////////////
2 d3 d- u+ `  N+ `9 P6 i& \5 {2 V9 M/ ^# J  \9 M
var copyspeed=marqueespeed# g' h3 ?- }& d: Z: K1 w5 Y
var pausespeed=(pauseit==0)? copyspeed: 0
6 R+ J! \7 U' w& A9 h% d/ @) X4 N& fvar iedom=document.all||document.getElementById( d: d9 h" s6 ~8 h
if (iedom)
9 H. w+ L7 I" P5 t! ~) O( `, B$ {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( `2 a7 e( t- \0 X' u0 u1 N$ evar actualwidth=''
+ X) t1 N8 c" O" N. s7 R) X6 Mvar cross_marquee, ns_marquee) f" B" X5 K; S0 I
2 q" N, u& r- {1 ]3 W0 P" H
function populate(){5 c' F4 D; A& ]/ j
if (iedom){) h. {' @: [: ]' Y, c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ p5 X0 m2 f9 l
cross_marquee.style.left=marqueewidth+84 W2 j' z+ L" a! K! T  V  n
cross_marquee.innerHTML=marqueecontent
# D5 \2 F1 M" S7 g' i1 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. A+ |( I2 i# H6 i( j) @0 M
}
  ?4 x4 K4 U5 P1 {' Selse if (document.layers){
9 x+ U3 Q, _/ @! n4 `0 yns_marquee=document.ns_marquee.document.ns_marquee2" w4 ?. ]* p; l, Y/ f0 D6 S
ns_marquee.left=marqueewidth+8
- M5 a  d4 j* k+ w5 Ons_marquee.document.write(marqueecontent)
4 P/ [0 y4 s1 y( ?ns_marquee.document.close()
! J, p$ J: c; O. ^3 y  Gactualwidth=ns_marquee.document.width
' n! p% R' R8 p& d6 n}% E& d2 S( c2 f5 l4 G8 H
lefttime=setInterval("scrollmarquee()",20)* a1 }' ]5 K  l) H
}
+ M4 m6 V( K$ Q1 _$ n9 cwindow.onload=populate
, V) r. ^& ?) C% R2 u* ]* B' r) f) \! S" X2 C5 R, D# n
function scrollmarquee(){
$ j. Y0 P' L) N9 i0 pif (iedom){
( Y! |- t. N3 h- o/ P# x0 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ L1 K+ Y: a2 u3 lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 ^7 q3 V% p7 y( j2 _
else$ D8 i$ D+ q- q' G. J
cross_marquee.style.left=marqueewidth+8
+ Q' |- z  o& A4 m- W
# d( [  P) g6 k1 |- C* S- o}& a$ [! y. L# q) `9 F$ Q
else if (document.layers){
& E) L) _* y0 u# vif (ns_marquee.left>(actualwidth*(-1)+8))
9 X0 |9 Q* R) G' H  S7 r' jns_marquee.left-=copyspeed) X* h8 [: X9 v: J. ]7 v% n
else
! @1 R" @- n, K! }2 Rns_marquee.left=marqueewidth+8
" A' _5 M. O6 u5 c# ~+ W, X6 p( J}, c; n4 ^& ?, P8 ?" e* N7 Y1 u
}) `/ ^7 k9 y% J$ m. f. z$ m

$ g7 j2 [3 P! @2 D" P: q9 I/ xif (iedom||document.layers){! V$ \, W* ?5 `7 K
with (document){
9 N- o8 A+ n7 J  i( |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) N! ]  y3 d2 z% d* t5 i7 Eif (iedom){! l2 G( k1 L4 f: e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 W6 J& W/ j* D  |% y  ~; i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). S( t$ H" v- n0 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 _' u) j8 |* a5 i/ \) nwrite('</div>')8 }* q9 W6 j! J5 ?0 N
}- i0 i% J! k% s  t3 M
else if (document.layers){
" y8 ~4 S1 L" \, Y& iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ Z8 |1 d5 L  e; u: h7 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), {" Y! l6 T; w/ o9 Y
write('</ilayer>')
% e& q( R) @0 j}
3 _4 ~# b6 m$ cdocument.write('</td></table>')( M$ P0 W3 I+ u9 w/ A; K, B% `
}/ ^+ H! W. I/ ^# F# p  {5 {, X1 r6 m
}1 x9 T0 }  ]8 q& D- w+ z
</script>

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