返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" ]/ V( ^1 @/ R$ b& Vvar marqueewidth=300
# t6 C. ?* s. L, t6 f/ K  \//高度. |$ q3 K5 ?5 I( L$ ~
var marqueeheight=25
& b* w+ U. u+ n& n. k9 b, Q//速度(1-10)3 q+ ^3 j: l9 \& x7 W
var marqueespeed=3# u" t; G! T& z) N% a; }
//背景颜色
& G) X* r. G, @9 T( ~var marqueebgcolor="#FFFFFF"6 o5 _0 m1 b, {' k
//是否能暂停 (0=no. 1=yes)?
) {% L1 a4 d; F  m/ xvar pauseit=1
/ g  c& U- {  Y4 n8 ?, J- k
8 K( Y+ i$ A, v, }6 D//修改显示内容
. V/ C1 i- K* l  w4 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ m# E) L5 x- S' w7 i2 t7 b1 [1 f
1 |4 y4 V; E& _) a6 n- R1 @% [& n

/ m  u$ T- j  z! d2 B5 Y////下面不需改变////////////
& m( q, z! n: j/ O! s) D# S; t! j! w7 T1 _, j/ w
var copyspeed=marqueespeed
7 M# n# X0 E' o: E3 Ovar pausespeed=(pauseit==0)? copyspeed: 0
/ \3 R0 ], _; O! D3 Nvar iedom=document.all||document.getElementById
( M# U( E4 L8 d# A* d1 c' U' {9 pif (iedom)
( w' L5 ]( l* N) Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: x7 A3 m5 B  ^# K9 Mvar actualwidth=''
0 d/ i2 K$ P1 A+ c; wvar cross_marquee, ns_marquee+ C2 o% Y: `- A* c$ X# f. \

7 q0 d1 a2 t) g- }. Pfunction populate(){, Z/ E8 |! _4 i' F2 i, t0 V
if (iedom){: L7 H9 v/ a) V1 {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' v' M$ [# g4 B3 u* K
cross_marquee.style.left=marqueewidth+8
( }( r, e- ]5 R! r0 Rcross_marquee.innerHTML=marqueecontent
* H9 F% ^4 G5 T$ Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" K" S" v& q' c* c
}
8 v4 f! R! k8 l, g5 S  Q- w2 U: Felse if (document.layers){
+ _0 {! g( M; d9 Kns_marquee=document.ns_marquee.document.ns_marquee2; z& r0 Y0 m" P: X
ns_marquee.left=marqueewidth+8
" J1 @$ [, c5 f# T/ ]ns_marquee.document.write(marqueecontent)' H9 N; |% Y7 y% M* a
ns_marquee.document.close()
" C% B! Q. X# B* C1 hactualwidth=ns_marquee.document.width
3 i8 H: r  _- w& O+ i}
& R5 B6 s+ ?1 X, D( H: M; m0 Elefttime=setInterval("scrollmarquee()",20)
% |2 e  L9 B) d8 a}0 e, T/ e, h7 A. \! V% o1 Y" T' a
window.onload=populate
! o3 K( X* \5 `2 [8 X0 s: O5 c
; P9 K9 G5 \' h% a5 R$ {function scrollmarquee(){
6 G6 P8 Z! P  Z; uif (iedom){
2 P7 g/ X; ?$ H6 N- k7 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ @3 j' C% L5 J( `* Y9 I2 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" D' q7 s4 g: x$ t4 y# T" O: T6 W0 p. ?else" ^+ L# D4 K" [5 S" l/ U
cross_marquee.style.left=marqueewidth+8; y$ J/ V$ `# J9 U1 M' u* C* b

; e8 [6 {" s* _}
$ H- b' m3 ?: t! B1 v+ Lelse if (document.layers){( X( U; X; i% E& q/ X8 J: ?, H/ l6 E3 z3 X
if (ns_marquee.left>(actualwidth*(-1)+8))
' k$ {) j. E. |& W$ Z& n' Jns_marquee.left-=copyspeed" r/ L/ T0 V  |( g2 o/ i
else
( O# l9 x. I& M7 o( B2 j4 Sns_marquee.left=marqueewidth+8
7 H2 T; I( j' c8 e}
2 `8 }, y* f) c; {}
. T1 [3 Q+ d* E  [
; l2 Z2 K$ ^# x! n, s7 Nif (iedom||document.layers){; h1 t# _( c+ N' E6 t# i
with (document){+ _+ i6 [" J( H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 j; r+ @) w( t: g7 Hif (iedom){7 \9 [+ k9 ^/ N  X( d" _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 o  y* z, o7 F/ N; L: b; Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( Q+ A* l+ i7 T$ m; _. R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& D" e) j1 C6 N2 }: I8 h
write('</div>')% `! ^9 u) c) c, v: j+ E; q
}9 A; @' o4 z  u
else if (document.layers){
% H6 T! t& L4 C# x1 Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- o2 M/ o! B1 x* Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& u. v7 d9 m$ U: R
write('</ilayer>')7 b6 @2 `$ }% v0 Y
}
3 Q4 K% ~8 C5 u/ ^/ @! c, H5 [document.write('</td></table>')9 W% M& \9 m& T6 d. H
}
( ^) d: E4 a& e! E) i}
  T' t$ i# a8 V</script>

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