返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ _$ o' s  o9 U+ ]- F
var marqueewidth=300
" x2 D0 l- }* G3 V/ \+ ^//高度
' ^7 {6 k9 ?  i' |: C( g& Xvar marqueeheight=25
* q! g  i/ H" X2 E8 A9 W//速度(1-10)6 i# _1 z" z1 E( l2 V- m: }! }  }. H
var marqueespeed=3( i3 d' d( a) k+ `* v7 ^2 w. T0 x
//背景颜色
4 E3 x: l4 l2 n( M) y# e# Dvar marqueebgcolor="#FFFFFF"
: e: ^- ]% d/ f  ^" p* R0 H//是否能暂停 (0=no. 1=yes)?
/ O9 S9 P1 [4 Cvar pauseit=1
" u4 S. W0 N/ `% |9 |# y. k& t9 O8 [$ _2 C5 ^4 l& _6 r
//修改显示内容
/ B8 Q3 ^3 P# k' Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 _: m/ C" z7 i, R6 H

* {' y9 u" F0 C3 t3 C9 ?  G) I5 k
////下面不需改变////////////6 U3 J' j- ?. D

1 K0 h# Y, ?# M% I- qvar copyspeed=marqueespeed9 B1 T- g# n* s! x- p% P# d, W% r
var pausespeed=(pauseit==0)? copyspeed: 04 a. l- B! P9 `
var iedom=document.all||document.getElementById" g8 a" d6 n' Q. _) L
if (iedom)3 I5 ~7 F3 P) D9 a1 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; }( P; K$ l' f2 t1 \* _( Cvar actualwidth=''5 q* b" u: ]/ u! Q3 L1 ^$ V4 X
var cross_marquee, ns_marquee
) `! T' ~2 Z, J/ W: {- P0 t, j3 q; P& g
function populate(){
; Z' G* X( H) }* qif (iedom){
6 j6 {, c1 f  u7 T  Z+ [6 Y6 a% hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 _' Z! E' U# n* ]) E( P
cross_marquee.style.left=marqueewidth+87 X4 `# t/ i  e
cross_marquee.innerHTML=marqueecontent- F/ N) V+ m0 L5 G8 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 ?% [, o5 n% y! R- |( x}" N9 ^; [1 y1 o- L8 L( O2 u6 Y5 W
else if (document.layers){6 ]0 n% l# ^7 }6 F8 N
ns_marquee=document.ns_marquee.document.ns_marquee2" F, z5 t3 i+ F" X
ns_marquee.left=marqueewidth+8
1 i- X1 v" z3 b  F4 x; X) m2 tns_marquee.document.write(marqueecontent)
7 S' c2 }: G" G% Ins_marquee.document.close()
7 g: k* X( v7 ?# y, ^1 u: w$ @actualwidth=ns_marquee.document.width
7 E- i0 S' k5 G! G. I; W1 l}. K8 s' \% n9 F8 N
lefttime=setInterval("scrollmarquee()",20)  }' P2 T; x3 \
}1 [6 X" G) I7 O: u
window.onload=populate% ]3 @" E+ T0 c

: q0 a5 m9 @9 c; F9 J3 jfunction scrollmarquee(){
; S( b6 L6 e# Wif (iedom){0 ~3 s$ J7 _4 `% ?+ h$ l  |0 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 w# N8 K0 a9 \/ y# Y) Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; }8 a: T- i+ S" g  ]! l2 ~else
& p, g" [' A& Q, _/ x( K# ~! |cross_marquee.style.left=marqueewidth+85 ]8 x8 G9 N$ [7 g7 A% q: Y  g

7 e9 z) Q( \$ f}
. ?! u! D* j9 F+ K, }. }3 f+ _else if (document.layers){# N4 X5 a; g+ o- ]
if (ns_marquee.left>(actualwidth*(-1)+8))' g6 o! A3 s" _% j# n% J
ns_marquee.left-=copyspeed
  i9 L6 k  q6 k! Y0 u2 r% ielse* R/ w5 d1 v! o6 S/ j" k
ns_marquee.left=marqueewidth+86 T1 T# ~/ z* T2 u4 |
}" x/ \, [" Q7 ]7 w) K0 t
}
7 }5 S0 z: N/ N& ?1 O2 _! _3 ~' A+ q
if (iedom||document.layers){  I: R6 d) \5 L8 d6 {; m* ?( ^
with (document){
( L  c1 P8 ~% q1 v8 R: udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 e8 v7 T+ k* t3 ]9 t( W
if (iedom){9 {3 ~) h; {3 C/ w0 c! D4 O" p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 [2 M+ h# e, r+ i9 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" L* s$ q$ o6 y; w' v' ^& \3 m: Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ E5 \( B  u, vwrite('</div>')
% A* o( X" ?  h/ ~% ~}- R2 ~9 K9 Q/ @% k/ c! T; t
else if (document.layers){3 }7 i! g# F' E9 ~/ D0 n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 F, v5 F  F/ v& Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 n; x1 `9 `/ `3 I0 r7 _# n( U
write('</ilayer>')% e: `5 `7 X- l5 a$ M7 ^" c3 r4 I
}
) d0 X6 j& N7 Q  f/ A# Tdocument.write('</td></table>')8 t- d; @1 d% T
}! o( ^% ?. e8 L
}
" T8 t! D3 C: z6 r' d</script>

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