返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: s/ G" R) ~  t0 _( nvar marqueewidth=300
* ^$ R* o7 i/ U//高度
( C& B. j' X# @2 R' h& a9 dvar marqueeheight=25: Q) k) O9 A2 c, G9 D
//速度(1-10)
5 _- o  L/ ?. _1 C0 wvar marqueespeed=3- H2 Z: W- d9 D! |
//背景颜色
& K( s* @# |5 d7 y6 l! uvar marqueebgcolor="#FFFFFF"/ \; ]* @+ }0 B* b  @$ t
//是否能暂停 (0=no. 1=yes)?
1 O0 F$ C0 y" X4 _+ p! nvar pauseit=1
8 ]6 M1 K$ b% E( q3 ]$ L
4 C% m% p' V  y) q' [//修改显示内容! T: E" S. C' H5 \: q5 M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ x4 @  g# m7 q$ T0 U4 o9 x2 O) u) N; c" n6 q* r+ a8 L
/ P  C. @' M0 U) q$ j$ d  g
////下面不需改变////////////
; V* w- M# D8 o+ F8 Q& g
' z" _* B! E# W$ Mvar copyspeed=marqueespeed2 ~! b( x" A. q+ C; S
var pausespeed=(pauseit==0)? copyspeed: 0
1 g' |$ a6 s# t8 d, Qvar iedom=document.all||document.getElementById
% N# D3 i- M5 R! t4 i; z; A0 yif (iedom)' G1 G/ ~1 u' U, J! b, ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 C1 x" q8 e0 H" Y7 avar actualwidth=''3 K! N% z3 P+ W* m2 n& S# ?
var cross_marquee, ns_marquee
6 E2 H2 F# m  \0 \5 U' @$ v! U7 Q/ j5 U* v: S
function populate(){& Q2 r. S% k" N+ g
if (iedom){/ F& J9 P1 W  a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& ]( N7 g. @- a4 x; a( ~cross_marquee.style.left=marqueewidth+8
( ]; n5 T; y6 A( D, Dcross_marquee.innerHTML=marqueecontent$ @: Y9 S$ x  S0 }" ?* w% Z4 b( Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 P' K1 J6 l+ ^0 d5 w; e}
' O2 C9 H6 J6 I$ f* P! qelse if (document.layers){
( q3 G8 `) H9 Rns_marquee=document.ns_marquee.document.ns_marquee2
5 D% z; p9 b; Y# N# qns_marquee.left=marqueewidth+8
0 Z: h2 U7 P* |3 g8 Ins_marquee.document.write(marqueecontent)
# q: O; O; v! \) gns_marquee.document.close()0 e6 K# @; I8 Y1 v: N
actualwidth=ns_marquee.document.width: e  Z& W: o+ t" r4 d
}  R1 g2 ?: a* {
lefttime=setInterval("scrollmarquee()",20)
4 Q9 p/ B" f! ]6 h; j/ @}
% P* J- u$ L! }& B. J) Z( Owindow.onload=populate
6 H1 n. a- K- T$ j: D8 P) ^6 C; A( c/ o9 C, R, S
function scrollmarquee(){
. S! G$ u/ d& j+ pif (iedom){( U/ A  M, s1 i: B- L7 {+ ^! P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) x4 J7 _: X1 |2 \5 Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 v( _& \0 ?3 P0 ~2 y$ |) G1 Melse
0 S5 u% g: X7 i* }cross_marquee.style.left=marqueewidth+8' e  z( X, i5 q/ L# ^

5 t9 T8 d5 X- \8 b: z}' N: y1 C- w9 _" i8 f% d
else if (document.layers){4 Z6 ], |/ F5 N: t" K' A/ X* p
if (ns_marquee.left>(actualwidth*(-1)+8))$ Q! d; P: Y! D: i& g* z5 V- }1 y
ns_marquee.left-=copyspeed
% W- Z# w9 G' e/ J* G  r# Z$ Yelse
4 p# }; ]' E3 q" B/ L9 pns_marquee.left=marqueewidth+8. ]$ s9 \( ?0 O0 P4 g$ A. a
}
& U: l" I  l5 K' x* V. t}
! m) d* `9 R$ h( @5 W9 v4 U5 U
  g* [5 ~6 @9 Y! {6 F. q4 {& sif (iedom||document.layers){
0 w% n. j4 ^5 G& E7 u4 ~with (document){
( j# K$ N! p/ e/ d% [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 q' a$ U3 M2 T- ^7 @if (iedom){
2 t# `( n' F5 I% p5 _, X5 vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! d( ^3 z- A& q) m6 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# m3 g- v3 {( Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 {2 \( p. e2 J8 y" ~, {2 v* }write('</div>')1 q2 G# [3 _$ @7 k% ?
}' w" S  ~  s8 o4 l$ ]
else if (document.layers){, z$ _! _- N- B# J. }, G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: V: k5 a* p4 `$ \& Q# B* P9 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ @. R% C4 f2 F( kwrite('</ilayer>')" f: O% c8 [% ^; u! Q
}
" @# {2 S! x3 xdocument.write('</td></table>')2 m# K' j7 K% Y; \! D: f
}& s, R- T2 o4 F; i2 i: T8 J& Y
}
! A- T$ p' H9 `7 Y- d4 e</script>

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