返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 u! h( ~( ?! \3 X
var marqueewidth=300" H/ z9 ]& I1 E( ?3 M3 k  q
//高度
& Y- e' |' ^! J' b; \, zvar marqueeheight=25
/ _& [+ ?1 f: o0 r0 _5 q//速度(1-10)( ]) r! d- w: u; B
var marqueespeed=3, ]. V0 i# c7 j( o! J4 N
//背景颜色
/ d+ F( x9 [4 k6 D1 Rvar marqueebgcolor="#FFFFFF"/ o, m5 C) g6 z  }: i# w
//是否能暂停 (0=no. 1=yes)?
/ I% y6 e8 s  U5 fvar pauseit=1
! @3 V2 N! K' G" u  S: N8 a0 b" j  H0 S9 m) j
//修改显示内容
0 U: @! \$ l$ L+ @( v  Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 }' A6 v* y" e. V3 o' S. I3 M) ^1 _+ o
1 ]1 ~$ L8 ]+ @- m& O5 \4 w
////下面不需改变////////////7 Y) s( p0 j8 c1 ]

% o+ P  W( j+ r8 @4 uvar copyspeed=marqueespeed3 U# N; C( E" s9 d- A% x5 b% {
var pausespeed=(pauseit==0)? copyspeed: 0
* |7 {7 X0 ]' F9 f' a( Bvar iedom=document.all||document.getElementById
+ z: X& F' a$ _# k  bif (iedom)
' r: b" E. b! F+ C7 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ b5 q9 p6 i% ivar actualwidth=''
# \9 f( Z4 v, g" cvar cross_marquee, ns_marquee
! b* c3 p/ d& X# c. r
/ x" y) @5 U9 a1 r+ ffunction populate(){/ O7 e2 w5 }3 l: L% s$ p
if (iedom){
# H$ ^2 [  e" W1 G% vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( @% x9 K7 q( {- {# W, v2 w7 k0 K
cross_marquee.style.left=marqueewidth+8
7 W- Y/ s* [* z8 w* ^4 T6 Ccross_marquee.innerHTML=marqueecontent. J8 E+ w  I/ U" L, P& m# @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 o0 N/ m/ g( z' w. P! _
}$ y' G+ D2 F! q7 _, c1 K
else if (document.layers){
/ F8 [2 ]! k9 kns_marquee=document.ns_marquee.document.ns_marquee2- A! x4 O* x: N+ L( j% F& j
ns_marquee.left=marqueewidth+8
+ L+ w; T; E( C7 Lns_marquee.document.write(marqueecontent)
$ n% r( I1 B% s! @+ q8 S  Sns_marquee.document.close()
6 |) [  `2 X8 t! m2 A; G+ a9 Uactualwidth=ns_marquee.document.width
- m0 g" h+ E' f7 d5 v}
# P0 W; o) K0 Y  R' Dlefttime=setInterval("scrollmarquee()",20)
  S. n' @: M7 r$ y+ Y6 I}
, l5 K/ W* u" |4 ?- i3 D, _window.onload=populate
) f( ?5 ~! e1 j5 ^# ?8 |
: K; ^( u/ \# T1 i" d* efunction scrollmarquee(){. l) Z: \% d. S
if (iedom){
/ Q" W$ [5 T2 i* M+ L* @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). R) U4 T% }# l" O  E& x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 e0 k5 g2 W) q9 s$ X7 T- a' ^7 M; _
else1 o9 H5 w$ k! d1 [, }7 a" H
cross_marquee.style.left=marqueewidth+8
" N7 S9 h5 F, [
8 F( h& }2 N. M}
( x3 r1 j' M" {% c, S! p) a+ kelse if (document.layers){
3 V6 e7 o' D5 i* c% Oif (ns_marquee.left>(actualwidth*(-1)+8)): B/ @3 j) G: B) n! E$ n
ns_marquee.left-=copyspeed  t; F3 [3 B! u1 w( ?7 Z9 Q: W6 Q
else+ K) f( ~3 I# i; K! V
ns_marquee.left=marqueewidth+83 F8 f* i' ]' Z7 s8 R( H$ H
}6 M% z9 d( ~8 u+ ?* C& C/ X2 z: K
}1 r$ M6 Z. ^) k# i
3 K3 |, W7 S. H! ]2 B) _
if (iedom||document.layers){
; \' |6 {- g" W! N) A2 Y$ t2 gwith (document){
% Z* _$ F% n' q, R- rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ z2 y& P, L( E" z; y' u8 Q; wif (iedom){& N4 `2 b% j0 m+ {9 F7 N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 L8 \4 m* Z, o- m& \! ^2 _! P% k0 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: }+ T: `: Y! K! Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; p2 r0 H2 b$ W0 m! g, Ewrite('</div>')
* l3 ~* d$ }9 W/ q% ~6 R}
1 T6 g8 U. J' v3 ?: v" celse if (document.layers){
) y/ d9 b& r4 a/ Z  q8 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; }2 z& n1 x  \, e7 }# y4 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 y# ^9 y2 u- m& y1 {7 x* C
write('</ilayer>')# }- J- C6 g+ _' m+ V  q
}$ R, u3 r. u. z5 U: R2 u
document.write('</td></table>')
0 C" d2 \8 Y& C$ m}% Y# v( V8 @7 y$ p2 @6 C
}
! T; |, x1 \, j, W</script>

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