获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 f! e) B& u0 \1 S
var marqueewidth=300
  U5 C! L% r. ]//高度2 Y  T6 c) a3 x. U) H
var marqueeheight=25
  [) ~( w1 |: M) U//速度(1-10)7 r6 h' O2 L- W1 l
var marqueespeed=3
4 d  A4 j- D7 d" \6 L) [//背景颜色
& S+ x' n) a, [5 u/ ^% `% h+ O  |" Yvar marqueebgcolor="#FFFFFF"2 x/ N! o% M* [- n7 H  k9 P' r# m
//是否能暂停 (0=no. 1=yes)?
+ A; i2 {- |9 d+ C, cvar pauseit=1
1 B& h# i8 `) ~: H. H# O. \/ C% E0 s9 V6 y$ C& C- e5 I
//修改显示内容
( {6 ?! q# b  X6 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' Q! C2 X0 L% @+ [% ?0 q
8 `! P0 C6 o9 ~, D" y* P7 T7 a/ r- M  n, p: I4 n( n& G
////下面不需改变////////////( A6 V: @) B3 D. j, D+ w

* w  g! R! J! n* _% tvar copyspeed=marqueespeed
; i' R, L! I2 Ivar pausespeed=(pauseit==0)? copyspeed: 0
1 m3 h" i. C$ \( i' nvar iedom=document.all||document.getElementById+ s$ U9 {4 R% o9 v( p
if (iedom)
1 e) U, A8 s, g, g4 \0 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 O" j& ^1 V, G, V2 ?var actualwidth=''4 \; H! i* I7 d# P! H
var cross_marquee, ns_marquee
6 ]! z' H  O2 ]( K
/ y/ S/ P2 {7 u6 [! ]+ ~- pfunction populate(){
( Y+ r0 }  A3 Z9 m# f) aif (iedom){
# F- J+ r2 V6 Z5 L. W) W+ q0 }: Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" h2 F9 z+ Y$ s0 b9 d2 r' ]cross_marquee.style.left=marqueewidth+8# s$ e- `8 N2 W" `
cross_marquee.innerHTML=marqueecontent
% c+ J& p, D. G" r8 Z  Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ ~9 I+ K* S' b7 Y
}
: c8 w0 T$ \" C6 ~) U# ~else if (document.layers){& [, l" P# S7 O/ U- z' F0 z" I
ns_marquee=document.ns_marquee.document.ns_marquee2
7 _3 p6 d# l7 G# u2 Ens_marquee.left=marqueewidth+8
. x4 u3 C: [  ^! tns_marquee.document.write(marqueecontent)
% r* W0 M: D6 l+ ens_marquee.document.close()
9 V' x8 G* y- I: Wactualwidth=ns_marquee.document.width3 H+ X4 `, _% |* h: l) [4 X+ \
}- Y" C2 Z% J+ t
lefttime=setInterval("scrollmarquee()",20): g5 a0 M0 Q0 \7 u2 G( o' t
}
% ^2 _6 F: J+ p2 Bwindow.onload=populate) X4 V7 ~7 `; f+ m9 Z

0 ~  M. p9 c$ x/ \2 O0 I* efunction scrollmarquee(){
1 H7 s# z  p. i- L7 y  `6 Yif (iedom){
9 P# A( M  m( O8 Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) G2 d6 v3 R7 m/ y7 W! ^6 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ Q/ ^  b0 R- X  C) A
else, P' p2 d( |6 i; @5 S
cross_marquee.style.left=marqueewidth+8
, g3 C" |( C5 g. G; A! S! N/ [% S! ~" s, Z. e+ a
}
5 N* z1 s8 S- ^) V2 ?* \8 R  gelse if (document.layers){
! O' l! C2 d& `. Y$ fif (ns_marquee.left>(actualwidth*(-1)+8)): n$ k* ^. ^! L4 \  O3 g5 C
ns_marquee.left-=copyspeed
) V/ s8 w# F0 ]! E1 Y/ felse
' C6 u4 p8 G$ F2 o7 [# \ns_marquee.left=marqueewidth+8
% O) Y6 K2 {5 }5 g}. q/ F/ C1 P0 p( W9 l6 f
}) P  H' q' G8 |8 j/ [$ o

. D: P  f: v# a' U2 j' d' r) N0 c8 \if (iedom||document.layers){; R8 G' F0 e" W8 F2 `7 ~
with (document){
% ?) B! ?1 F# b" \; u0 g1 Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ h* G/ |& [# ^  m9 b3 p4 g* y5 Hif (iedom){! ~: j( U1 Q* h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  L* D2 q4 L% d& q/ f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( v, X7 l7 [3 M" i; a" A! j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 B% f" S7 F7 R" Kwrite('</div>')8 ^2 w6 D- |" y! e/ ^, b5 t( d
}
! `: P5 C2 {: W, f; |else if (document.layers){
8 }& r9 B9 f0 @1 i3 o9 T, L8 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 b: o" Y( y) e: D0 e9 x( ^) n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% L" w/ E2 a& D# L+ @$ X6 ~7 i
write('</ilayer>')1 ~2 ]. N. E3 }8 ]
}& ]: r( U: B0 L$ R
document.write('</td></table>')1 x# [0 X! ?) C; d3 N1 n
}' ?* ]( {; E4 |! `) H0 y$ W
}. x# j. v% J- O: g0 ]8 P8 A
</script>

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