返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 b1 I1 Q% N& k8 F+ B2 ~
var marqueewidth=3007 \2 }5 X0 \# x& k4 Z! k
//高度+ B. W% E8 w! I+ i" X- t$ M
var marqueeheight=251 e+ P/ d2 T+ p# f9 ?4 v- w
//速度(1-10)
4 a/ s% u8 q. C, lvar marqueespeed=3
" E/ Q" R  B1 s2 i//背景颜色- x" \& _6 Y* u+ Q
var marqueebgcolor="#FFFFFF"
- P2 z" J8 B6 T+ B//是否能暂停 (0=no. 1=yes)?
0 R$ M2 L& ^' ?/ |) U9 Tvar pauseit=1$ {* J$ y  I( b0 C; W, G" F

; Y; ^0 z. v9 \4 J& S& p//修改显示内容
( i. Y" g7 ]6 k& d3 n, F8 rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 J1 @6 [, T" ]6 |2 J% L) M& f. r: l# h9 y! f- j
  q! U3 h) z! Q. p8 F
////下面不需改变////////////& R- }5 r+ J- G! f+ F

. S! E, {" F# a, K2 Mvar copyspeed=marqueespeed! B% P5 \7 B4 }, V
var pausespeed=(pauseit==0)? copyspeed: 0' s2 }( j) L# p& O; u6 o/ p6 E
var iedom=document.all||document.getElementById+ k# W5 [3 V9 J4 t: g
if (iedom)* T/ @" k# A4 Q( }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); s  z4 {. n- ~: W) N
var actualwidth=''' y/ W- u7 T. U: m! n
var cross_marquee, ns_marquee
- Q6 m& c# D- l. i* l* l
4 E% u+ ?3 y- `* h4 |, \; Y* I( hfunction populate(){
7 e4 [, P& `' A" ^4 ]if (iedom){
- v# n" L+ Z  s! v. across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 c5 G- `# a: u  _
cross_marquee.style.left=marqueewidth+8
5 v% U* H" R6 }cross_marquee.innerHTML=marqueecontent
+ P+ l4 U/ S! a; c2 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ e6 I/ A1 R* C& i& j}
( ?6 b+ D5 c. f. [8 D, J3 delse if (document.layers){% a  s3 O6 M! ?; p. M3 Z
ns_marquee=document.ns_marquee.document.ns_marquee20 K- K! z9 @, d' V; e
ns_marquee.left=marqueewidth+8& H6 G6 ^9 @! Q+ f
ns_marquee.document.write(marqueecontent)
0 B# |6 G, o. R. Q( h- B- e) d9 J2 @ns_marquee.document.close()5 m, Y) P, E1 }% Z) z6 K0 f; z
actualwidth=ns_marquee.document.width' v9 Q# D$ s5 n6 N
}
/ W" ?. g( j1 A: h. h4 z+ Dlefttime=setInterval("scrollmarquee()",20)% v: a& x, R+ H, @4 D/ ?* R
}
7 b: q" T7 `  O. ]window.onload=populate0 G& b  c8 G' M9 f" H
  Y8 ^2 |: t4 G2 e* h% C5 g$ x- M
function scrollmarquee(){
- \9 e5 W# `$ O& K2 eif (iedom){! c" S( k  K( f+ Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" ]$ i9 c. ]# v- E/ W9 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! G  ~  U. Q, @. B$ k: c4 y  S% O9 ^
else1 U  q/ l6 Q) W/ O6 S- P$ l: C3 A
cross_marquee.style.left=marqueewidth+8/ I6 X% m5 e9 f8 Y! p. L1 |

! P9 _! U/ T6 `7 K- I}
) a" L3 r. A5 N: v" Z2 N& Zelse if (document.layers){* ~/ P6 m+ t- \& w6 n6 f
if (ns_marquee.left>(actualwidth*(-1)+8))
. H* D+ B- j5 e! U  W6 z) cns_marquee.left-=copyspeed. i% d4 M8 n* I6 F. l: K
else6 k, L. a3 J6 D9 c! u' `
ns_marquee.left=marqueewidth+81 t1 P' C8 J) v' x& J
}. k& z9 a6 A& d3 w
}
4 B4 J- y3 H* V# G2 o, U1 Q) S* f6 Q  p# H6 S. W8 }
if (iedom||document.layers){
3 }+ S7 W' t# ?( W6 D9 @+ k# C* Wwith (document){8 K$ ^5 o3 i/ M+ i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 {, Y3 W: s9 s
if (iedom){  k5 y- H% E/ G$ r* M* U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 T/ J2 V" r* Y2 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ f5 C4 F. s( O5 ]5 r* S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  q+ a3 V9 ^) {7 t( m
write('</div>')
* Y- V1 j* _# g, @  I$ Q+ z}, [7 r+ k- G3 k; Z  V
else if (document.layers){% b- g* @, O) W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 J4 I! B8 t6 E8 r' x! Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 q: T, Q) @  v. Mwrite('</ilayer>')8 e9 p# A& _, c
}+ R, x% R1 _, ~2 M
document.write('</td></table>')2 }: W" W: T" }' I
}: r+ Z% S% L8 j( g, d( R: I
}
, E/ }! ?" Y: w. N% j6 e; P</script>

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