返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 J: b+ p9 o9 \8 h9 r
var marqueewidth=300
- x) v( d: x9 C9 p8 U( e( A//高度1 x8 d, s4 C9 E; [* j6 D$ p
var marqueeheight=25  p4 z% O6 Z, C0 h- e& Z* j' A
//速度(1-10)" c* d. L/ Z, h" t
var marqueespeed=3
  S4 r+ \; j/ Z; d( S/ O//背景颜色
8 D  u! d. V! N4 G9 wvar marqueebgcolor="#FFFFFF"
' J& J, U% h* ?. c( L- n//是否能暂停 (0=no. 1=yes)?2 k  K0 o" O  |
var pauseit=1
/ y7 w4 l* Q; N9 H: `/ R# n% @7 Q8 z) M; h) P. [9 V0 u
//修改显示内容
6 q$ z" W% e3 Q# ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' Z/ O; W$ }% [  h

* @' N3 A% K' [/ }! C( E3 O. h: ~
+ R+ n6 N" ?9 I" _+ Q1 G////下面不需改变////////////6 B7 |; Z1 }, o4 I4 W
3 }; {; D2 R5 c
var copyspeed=marqueespeed4 x1 k4 [# l+ v* l8 i5 _  w  ^2 k4 U
var pausespeed=(pauseit==0)? copyspeed: 0, t" `- e: ~0 f, J
var iedom=document.all||document.getElementById
1 ^8 e- o4 `5 \. u( D0 a1 kif (iedom)
* s/ C- m- n' u' ]: odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 K/ t( K. t) [7 t) @7 cvar actualwidth=''
7 [% q3 S: l0 cvar cross_marquee, ns_marquee
" }3 r7 \+ Y$ A' k" w. h- w7 ~4 @8 Q
function populate(){
: j; }$ K* N4 r# I( bif (iedom){; J! t! _: H; l% U5 g# P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 B, A5 ]4 x: L3 v" I
cross_marquee.style.left=marqueewidth+80 s/ Y1 \. F. K/ _' ~0 A' a; P
cross_marquee.innerHTML=marqueecontent, g% _2 p# {! D3 x' I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 s* u& h# I- A- k7 C}
9 B6 T; o9 J8 F; g! H2 P+ u4 S4 I8 Uelse if (document.layers){
& g$ ], t  @9 J- h$ ^( Mns_marquee=document.ns_marquee.document.ns_marquee24 T0 A$ |( \1 s( L- ]/ w3 I
ns_marquee.left=marqueewidth+8! u% A6 @1 M" z! }- M- z6 S
ns_marquee.document.write(marqueecontent)
' A9 ^* I6 u  ^3 p4 X! C  o# ^ns_marquee.document.close()
% n& K* w4 A0 X0 e0 jactualwidth=ns_marquee.document.width
, j2 ^+ y& V8 J8 s$ [}
" K& R* V5 R" n. X! }+ q! r( t$ R& P* vlefttime=setInterval("scrollmarquee()",20)1 Y7 _. L) r) W  l7 D4 {- K; H
}9 Y# n, J0 K, B+ R
window.onload=populate4 G* s- b# J- D* [, t3 {% N

, v! ~. x3 C* c! t3 G8 Gfunction scrollmarquee(){
  S& M+ E! j" L% f6 |" a' O0 a+ k! Aif (iedom){) I; n+ z( J" o0 w, S. o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! T# _& F3 M& y2 n: M) _1 R0 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ V4 F+ [+ X" g; U' J1 j+ x* L8 I7 gelse2 q9 h- `& s  P: q# ]2 b
cross_marquee.style.left=marqueewidth+8
0 w: s3 \/ ~2 N  u5 I, `7 P  k! a
}& q* `: I8 @, g- q* `
else if (document.layers){2 l. M! h& _" ?  o; @
if (ns_marquee.left>(actualwidth*(-1)+8))
$ m( u5 h# Q/ p8 h; sns_marquee.left-=copyspeed' S9 i8 M+ [, M7 Q: Q  C
else
* {$ z$ S6 A+ Q& Y# T9 r# Bns_marquee.left=marqueewidth+81 T$ A" A! C6 ~; t$ Z% s! O
}
0 d7 {, W  A6 l- i7 A}
$ {( P( U1 Y  x* ?! l8 P
3 g' P, f; m3 O2 {4 |if (iedom||document.layers){
& L: l; M' R  r6 H! F, k& Wwith (document){
1 {7 e3 v, X/ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 m# Z; q/ c$ W8 |7 X1 t7 I
if (iedom){5 |) B4 x4 \! k0 S4 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) k& Z% T! m( L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). ^: F, e7 y0 z6 |( r. X" @! j2 n) L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) f  p" K+ k  V2 u+ o; o" Z
write('</div>')
$ z7 z7 R: C8 }}$ I5 r) k; {! B/ M5 H  m
else if (document.layers){# ]: ]- ]6 g0 h, {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); ~  f# r# ^& [7 c  R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 V% R( L& v% ?! M1 [write('</ilayer>')
7 M) @, G1 c% v9 q}
9 b& J+ y& }' |# B* P% o. Xdocument.write('</td></table>')
+ [3 g. u3 }! i) [0 k. c}7 N. x3 |7 @, R3 v& ]. a& k
}2 e% K7 X. T5 V+ y) [( y  t8 N
</script>

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