返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 W0 G; O# D7 {0 O1 ~  K8 j: }7 {var marqueewidth=3000 e1 d. d9 W! x# F( u9 h( N/ c
//高度
0 k- }: a. i: r- P3 x5 R) Avar marqueeheight=255 x& d* ]: t& v+ G
//速度(1-10)& c" q& M9 G, p1 e; n+ f
var marqueespeed=3
8 Q8 C" m5 n6 J& l7 {//背景颜色& l. B6 t9 V7 i
var marqueebgcolor="#FFFFFF"6 r# J2 P: f: b' D
//是否能暂停 (0=no. 1=yes)?! a7 l  {6 |' c/ [- A* y6 b
var pauseit=1  c; ?4 s9 G: X7 e8 ~
! g' E0 k  D% I5 _! p' Z% C
//修改显示内容
/ h) n- M5 w8 a% X, R8 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* T: r& D; I6 t: {
3 R; |; f# J% M' `$ x3 u1 [
4 O# H% f" @% y6 s% G: h) @& V
////下面不需改变////////////* O7 T5 b9 u% j% X) u4 B
' ?- s0 ^' X3 Y
var copyspeed=marqueespeed
2 e2 W6 {! |# I4 X* |- h5 {var pausespeed=(pauseit==0)? copyspeed: 0
! j( {: }! o( e' P2 F, D" Dvar iedom=document.all||document.getElementById
: a8 e% [0 b, a3 h% }  }  b$ K! ~if (iedom)& T, y- B2 a0 B7 v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. Q2 ?! Z% e% r8 b+ Fvar actualwidth=''
* B% d; Y& K$ Tvar cross_marquee, ns_marquee3 e, p6 r! o6 L
+ ?; Z2 k6 V% S
function populate(){1 q) n: ^9 V  y) l
if (iedom){- ]9 H# c$ m4 T2 M& G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, n: B; H5 o9 h  _# wcross_marquee.style.left=marqueewidth+8& i: k1 |4 Q% F5 i* E7 k. {6 x
cross_marquee.innerHTML=marqueecontent
$ k4 f- v' i9 h1 W; T) Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 b6 x8 c8 y+ ~8 i5 b+ T, K2 ~7 ?
}
0 A# H5 D% v4 {3 k: [3 Gelse if (document.layers){
3 U, L) E7 M0 F9 }0 \! Tns_marquee=document.ns_marquee.document.ns_marquee2" c0 p, W% i3 [- s
ns_marquee.left=marqueewidth+8
, I6 e. }8 `0 A# M* L0 K: S  Ins_marquee.document.write(marqueecontent): P1 x* O6 T; j& }) V; C, L9 D% E. ~
ns_marquee.document.close()
7 q3 ~$ s2 g. {7 nactualwidth=ns_marquee.document.width
4 x. ^" N  P$ x" u3 L6 ?}" T: W% P) j$ `4 m4 D/ B
lefttime=setInterval("scrollmarquee()",20)
. x, K& w: w, O# U7 q; A% K* ^}
# w0 J, [8 J! O5 \4 Xwindow.onload=populate
( B* Q, m- p1 M, y, F8 S% x+ S( n+ u$ u6 {4 ?
function scrollmarquee(){4 c2 e  E" ^& ^/ F' Y
if (iedom){* ~5 N) Q) P, {! g5 d2 A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) R0 @9 @" L5 B8 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* R9 d1 n+ `7 L3 yelse
# w7 u. w) h- O: P, w- Ocross_marquee.style.left=marqueewidth+8/ m0 L3 k7 y& R0 V7 d

7 p4 T: }# `3 a; O}2 f6 T6 p; Q! A: S" C0 M7 ~3 b. U+ p
else if (document.layers){
- H% _; w1 [+ Q, W) x: Z; |- h" Tif (ns_marquee.left>(actualwidth*(-1)+8))
  _" h) I7 ]: P. u2 r4 D$ M& Xns_marquee.left-=copyspeed$ A! J! _6 Y; e
else! _. g5 Z" J1 A( q1 y6 }* u
ns_marquee.left=marqueewidth+8
- X- E- Q! G) X  l  m}5 {& Q+ O  _1 K, X8 }. H: S# T
}
1 P1 b: `/ i, Z# }
& ^1 w' O( M! N6 W4 S! o& \if (iedom||document.layers){
, @# g  S. z  f! g1 I/ }$ ~with (document){
& |# ~" }3 c( y" Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" [( C" T  p4 e$ c8 E/ s1 m5 cif (iedom){
1 d) R$ e* ?! z0 |. Z8 y( F% A$ bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. n5 s- d  t: M1 y) E. y$ o1 [1 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" h, F" U9 b1 j+ ^. k% W' s9 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ O3 u; g# }* Zwrite('</div>')* d* C# T" L( o( h
}: C2 q. U3 H' j; Q0 O1 j
else if (document.layers){1 C/ z9 T7 i& N' K' |9 X) p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! M+ K( o+ y" X& j" S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); n1 B  K, ^! P* N0 m2 a" a
write('</ilayer>')
; r7 H# b0 E) a/ e  A. f/ t}
9 X1 [  e3 Z, O9 Ndocument.write('</td></table>')% @6 E; L( V+ s, T
}
3 w& e9 b. d) c/ N}
5 N( |+ m/ {- W6 [" s- R</script>

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