返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) v. P  P+ _' E8 l! G3 Cvar marqueewidth=300, |1 B; w$ o. x9 n
//高度0 A" c0 Y" Z/ N. J# i/ D. t! |
var marqueeheight=25( H! l0 g1 ~  h$ B5 ?
//速度(1-10)" }3 E% l  C+ F
var marqueespeed=3
' J: x2 [6 e8 C" `. l//背景颜色! V- L, o8 J/ H( q1 k6 d5 F
var marqueebgcolor="#FFFFFF"4 o5 {- L0 u2 u" E8 c$ G
//是否能暂停 (0=no. 1=yes)?
- \) Y' w* N! b8 Y. E8 h* Ivar pauseit=1
2 G, r! l# J( l. p& `' k/ p+ f0 Y  O: Q
//修改显示内容
4 O( m" G/ S0 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  t1 F' ]4 l' m4 K

2 x+ B1 e) g* K" y- ?* i; a7 N
5 @/ x3 ?8 m" F; [////下面不需改变////////////
. F# C" K2 N. T& f/ A) R5 P) L& u3 d( w; ^
var copyspeed=marqueespeed
  S. m9 l0 ?2 X" svar pausespeed=(pauseit==0)? copyspeed: 0
" E  z. X% I  Y' ]var iedom=document.all||document.getElementById# L% M7 @# G) {& j8 u
if (iedom)
# J0 a* N3 D* y4 Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& j  M: f# {( E3 ], j
var actualwidth=''
1 c9 A; W) e) m9 l1 c& T3 @1 o3 svar cross_marquee, ns_marquee# B" }" ?3 x! x# k( b

& N" C. |1 @  t' g( \& P! P. r& Dfunction populate(){* `4 {" h5 p$ x" j
if (iedom){
& |' Z% X8 D9 L: C8 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* r: N2 l6 i% s# `4 u, ccross_marquee.style.left=marqueewidth+8
  ?- i/ D) b# q$ c& h7 Bcross_marquee.innerHTML=marqueecontent! S) A: e) I/ n! O) F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  u4 D$ I! f( Q- G0 V+ {, S* Y5 q}+ L3 a: |4 |+ e9 l& z/ e3 L7 [
else if (document.layers){+ ~; a, B: [3 }- a9 X
ns_marquee=document.ns_marquee.document.ns_marquee2
" a/ n) u/ H& I7 V; [ns_marquee.left=marqueewidth+8" I7 c3 s- v- Z! O2 }" ^/ m7 y; B
ns_marquee.document.write(marqueecontent)& v) Y# `- B) p# Z
ns_marquee.document.close()
& W0 i" V: j/ K5 T1 m' R6 ?( T3 @  zactualwidth=ns_marquee.document.width2 q/ V3 ?" n7 ]; E9 ~( u
}
3 Q% g7 [, m$ L0 G5 `lefttime=setInterval("scrollmarquee()",20)8 x' A: B: Y+ a6 b  s% e9 c
}
4 p; x$ g: b# b$ w1 N5 fwindow.onload=populate" M4 v) ?0 ^. d9 A% K( H: Q
: P  G! Y3 g7 a- [
function scrollmarquee(){0 i% R" _6 T1 }5 [& K( r$ r# e$ k( B
if (iedom){
  ~/ Y) X( e2 m. eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- w- Z( O$ N( W. L# ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' m  c, D# Q& i! r: u3 @else
0 ^! G; ~( [7 ?cross_marquee.style.left=marqueewidth+8
- p; c2 Z4 Q2 `, i- a, n! @/ P, u+ [; T4 N$ M
}
, {" d$ q8 A# f; A' d. k" _else if (document.layers){
/ o" E+ `. w8 Z: m6 Cif (ns_marquee.left>(actualwidth*(-1)+8))" ?0 I# l& G$ s+ ^$ D1 H; n- ^# s' M
ns_marquee.left-=copyspeed1 C7 D/ D4 h( c4 U
else4 W6 @5 V1 w, L% a
ns_marquee.left=marqueewidth+8
8 l5 A9 `* h- G}
- x7 C- z( m- d% n$ a9 Z0 d}
0 u7 i9 C. K/ C* p& M, a- k9 ^9 o0 v
if (iedom||document.layers){
5 p9 [+ I! T3 V) ]with (document){
  u5 u, C: }, q8 G) ~) Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 k9 L- R8 ]( W
if (iedom){
# _5 `: [- B. c% [. o2 O) u8 u; R7 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) u. j0 ^; N8 F; W/ Y0 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- \) S0 _* x! Z7 K% X* I( ]- ~! Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 J9 N, q. x' M" C
write('</div>')
9 n# G7 R7 @) t/ ]  H' p}; e* {' y- T0 m; q2 l- \
else if (document.layers){
  d3 I' P; b5 e6 ^/ y/ y. f# X. Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) b$ J% ]+ ~8 l+ W* F8 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): o. }9 u- c/ l
write('</ilayer>')
7 w8 m1 ~9 s. m9 f/ A}; L' _* m( O; E
document.write('</td></table>')' q/ n3 f, Y& v( M/ u
}
5 P' y, ]3 @2 o% U7 h}& z# R* j5 ~, h% |4 [" r/ S
</script>

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