返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ u) R; _. ]6 v. ~( N
var marqueewidth=300
1 @  z7 l! [+ T! f2 C  h//高度! q! i7 }; [; C( n8 t' r
var marqueeheight=251 S4 Q# l+ ~. O) R/ Z
//速度(1-10)
8 r& x1 C0 P' H3 lvar marqueespeed=3" _$ C4 u. `  {( D$ D+ T6 U
//背景颜色
7 O9 f8 W/ w' Qvar marqueebgcolor="#FFFFFF"- i8 ~  O/ M, t. L7 c" q; J% f
//是否能暂停 (0=no. 1=yes)?- s2 K) Y2 Z4 B9 q
var pauseit=1
3 ]6 r) k5 `9 V! A- C- j/ y' }" c, u( P1 T( r  f, P* C; c
//修改显示内容
. w5 F1 r8 x  r4 Z" \& Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 Y9 \6 [' o2 [; g9 k+ H( c- D& H, N2 T& Y- C
! ^1 b5 J0 X, A  q: D) W" D
////下面不需改变////////////3 T! w6 `& G2 O$ \# l  A

7 j% p' Z, O, W1 x7 ^/ Pvar copyspeed=marqueespeed
/ E& k  r% q- r  Nvar pausespeed=(pauseit==0)? copyspeed: 00 I6 {5 {' O: @, F+ [/ b" N1 B6 I
var iedom=document.all||document.getElementById* @4 z( q# {7 o
if (iedom)' Z2 @# U- N$ k: Z. G" a1 r+ ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 J8 b6 F2 H& w4 A+ D8 B$ [var actualwidth=''8 d1 X1 u, V" h6 V: g9 ^
var cross_marquee, ns_marquee. U# g/ g% {0 q+ |# V9 k
, q+ _: j$ R7 m2 h" f
function populate(){
  R9 X" j% t8 n) k4 o# _if (iedom){1 ^/ w/ p7 @4 E3 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) @4 n0 y; p6 [+ [( q  P. ?4 s
cross_marquee.style.left=marqueewidth+8
# t7 V, |, c5 Z. p# z% _# bcross_marquee.innerHTML=marqueecontent/ p4 X3 a6 _$ {! N' B. ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ \  j( i& j2 f# Z! {
}
3 a( m2 y# M2 |) }3 w* \) ielse if (document.layers){/ q& q; a$ x- ?
ns_marquee=document.ns_marquee.document.ns_marquee2
" T* V' ~/ F$ [: y% sns_marquee.left=marqueewidth+8' F/ g4 C6 G  B5 [& Q% p
ns_marquee.document.write(marqueecontent)
  V8 A  f' U# a: ons_marquee.document.close()
7 I6 C" l0 f* i, Q5 C  Ractualwidth=ns_marquee.document.width
  `  Z; R6 u7 Q1 M}
% @/ F) F( H* alefttime=setInterval("scrollmarquee()",20)
3 k& {' h) e+ Z" }: K1 y}
) K1 ~# @1 F2 x' Rwindow.onload=populate
( b8 D, `) ?% B- B7 ?5 w
3 a8 {' v8 E1 U9 K  ^3 u. ufunction scrollmarquee(){  q3 Z# l( @: v. Y& A
if (iedom){% l* s9 c# M' Y, a* u+ S, g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) L3 a# M- r8 q) [; ~% t% c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, R: M$ Y( T5 M( D$ p5 d% _, {8 Aelse4 ^& x! d$ w" t1 `; a
cross_marquee.style.left=marqueewidth+8
' n' L4 B& ?9 g5 R) l8 {# x
2 @; L- m- L+ s1 d0 ^}, c' j0 [( Q( |  \
else if (document.layers){4 `/ d1 B" ]+ V2 S5 f
if (ns_marquee.left>(actualwidth*(-1)+8))6 G2 w) [! k$ [$ u+ Z3 x# c
ns_marquee.left-=copyspeed- n  J; ~/ ]) `9 b% E, |
else; b3 {( T9 B' }0 {% S# W
ns_marquee.left=marqueewidth+8! }* b& C4 W% M+ x. Y7 Q: a
}4 f- V2 U* w2 @, m5 L
}( h& Q+ {9 }0 ]9 }+ A0 g

3 `  b. V5 O% n/ x0 _# j9 fif (iedom||document.layers){
* x* j9 h  w; J8 @' ^, {with (document){0 H  `& _, [$ P- B% U' i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  J( g0 [6 f0 i# `1 T3 G
if (iedom){
1 S- S/ x. \; b% l0 d. B$ v7 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 Q$ b, T7 r& f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 G- p% [/ z7 q9 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) N% w8 ?# Q' A0 wwrite('</div>')
( f; M" c5 v0 v; `, k% D}
7 d  i6 I; j. z) N/ Celse if (document.layers){
1 l+ G! H4 ~, G# E% F( wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! l% x# @2 |  {' O% y* I' A0 ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), G7 j5 ^* ~+ o$ _, _
write('</ilayer>')
  s- h5 O! o& |5 d1 e( y}7 g0 w/ i: [% c) h- F9 p
document.write('</td></table>')
/ V0 G( v: l' U% d2 A: F) J}
; t6 j7 d/ `& ~# B% K' M" @}
. M4 h& ~( x& ?3 Q; x3 W</script>

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