返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 x, p" z! O: o; |! l* v- w8 X
var marqueewidth=300, T( i$ F$ O& h/ I
//高度$ S. Q4 ]$ S% k$ `
var marqueeheight=25, ~. b  x1 [! V+ |( ~; z
//速度(1-10)
7 v/ v3 E  }+ g/ ]var marqueespeed=3
; ?" `& ^4 k2 U$ b$ Q# N//背景颜色; g! n% M( l+ V4 M* G
var marqueebgcolor="#FFFFFF"* n2 Z; J1 a7 f* S- H
//是否能暂停 (0=no. 1=yes)?
) W+ S5 [( e4 Kvar pauseit=1
5 H+ u) i5 ?0 o) v0 s0 @, d/ l
: P2 H: S6 q) y5 R7 S" P//修改显示内容* }+ D- P/ o: C8 b! \4 c! v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' W$ }8 i$ f8 s/ O6 A3 K
' f! u- S, R  h) U( a  f

' Q+ i' k* ~$ {6 \9 z9 [. F7 A////下面不需改变////////////% P0 [+ w2 `1 b  H7 S; r# |4 h* d

% N0 e! z8 l' \8 m- }. J, Lvar copyspeed=marqueespeed
/ ~; a1 O& M' g& v* M/ U3 `1 s# Evar pausespeed=(pauseit==0)? copyspeed: 0. ^  |# a  ?8 U/ t/ n4 a) h' s
var iedom=document.all||document.getElementById- o! v$ H. ]) @! T3 p4 ~8 ?
if (iedom). L8 X0 ?: I- t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* [  J0 X+ c% h+ `( T+ D* C
var actualwidth=''
5 C1 N+ u- z# Nvar cross_marquee, ns_marquee
6 u9 m# m; j4 E. m! N
& ]2 L, {. c( Jfunction populate(){% C1 O' @6 \- m! U
if (iedom){8 M4 b" E( ]5 d, h8 Q+ X' M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* l" L5 q3 C3 l- `9 qcross_marquee.style.left=marqueewidth+8
( _. m6 n' O3 N8 R; ^* icross_marquee.innerHTML=marqueecontent
! F+ n6 @% S( X/ Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, n$ r% F  j3 Y: k( u% H' g
}$ l: c! B1 C3 U  S5 w8 z- q
else if (document.layers){) h5 c% B6 ~6 ^: Y4 x% u9 a* `
ns_marquee=document.ns_marquee.document.ns_marquee22 o7 W1 v5 j) _1 q& Q% z
ns_marquee.left=marqueewidth+8
7 x. D7 t  K; k. @ns_marquee.document.write(marqueecontent)
/ {# F! V' d! @  g, i  hns_marquee.document.close()% Z+ o; {4 p7 s/ [
actualwidth=ns_marquee.document.width
5 P* \/ O, x( v" ]. A* t}; C. y; N3 W+ O6 p& d) V
lefttime=setInterval("scrollmarquee()",20)3 b6 X. m3 i' W
}
7 q1 O: w" r9 e$ c* r; }9 r4 O9 Mwindow.onload=populate
. R& T, w# U+ ~( f" v
( h9 Z2 ]# F8 Qfunction scrollmarquee(){
( d. a4 H, b# y* l: lif (iedom){
" r& n8 O3 v$ s: h9 T& x. eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% A- {8 B$ P' I; ^- |& Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ ~7 M6 k/ o3 Z/ y7 C2 c+ telse
% o: X7 E8 a5 W, A) f+ Ocross_marquee.style.left=marqueewidth+8/ |" m; Q% m; [6 V. e

/ b' K- g- a& b2 a( F! r& G8 L}
3 f- [  M* K0 J: ~& T- p" P! ]else if (document.layers){
' g: W- `$ b0 [6 k. c' bif (ns_marquee.left>(actualwidth*(-1)+8))
$ y: E9 Q: s: K; jns_marquee.left-=copyspeed* F* c* w& w# [% X& Z* M- I! V
else
3 k# [* B& f  y8 \- uns_marquee.left=marqueewidth+8$ T' Y+ o$ w6 O3 O1 X' t, {3 i
}
/ @" ]8 i9 X9 e) _! Y: X1 r}6 H1 K: T5 {6 h7 g# y5 z
- X6 I1 K5 V0 F# ]8 ~
if (iedom||document.layers){
+ X3 R$ I: n, ^5 x) z9 o4 f4 xwith (document){2 p; M& ~5 T4 X- X5 ]/ b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); v& f' ~6 e$ E. w1 T5 h
if (iedom){+ }( m3 U+ L7 _# l/ x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 n0 E" o! _% }  f) L' E/ h+ N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" I0 R! P5 q, d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 n5 n" w" ]" t5 _write('</div>')
, w* M/ @' I) q  y- d( l}0 C5 u! {* o  `6 }
else if (document.layers){! W2 q, i: F# W0 ]( I- `- n1 R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  C9 g1 u7 ?1 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 i4 n) i: y3 T+ ~- G& C
write('</ilayer>')
+ z; I7 j3 H3 H$ s}
/ @- @' s* {- r# S" \- b! cdocument.write('</td></table>')! L2 U, @) k% X
}
' `  D' a, Q3 {; a1 ~1 Q9 V9 X}/ p* @; Y& S, O
</script>

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