返回列表 发帖

网页之跑马灯文字特效

//修改宽度: y3 W% N4 J/ L1 z! J2 n
var marqueewidth=300
. O- l8 Y! }2 V+ f//高度: W( c& L4 B3 \
var marqueeheight=25
  ]0 _4 T9 q- s$ D1 e//速度(1-10)" v1 r6 _0 U- E7 e; X& F6 w5 e2 L; m
var marqueespeed=3
8 P( _* T, N; H& {5 L1 v: _0 s4 f//背景颜色6 y* m1 B4 G7 \: ]5 ^. B
var marqueebgcolor="#FFFFFF": M3 k9 }4 v8 t/ g0 x; Z
//是否能暂停 (0=no. 1=yes)?; t$ }. p/ V$ a1 B8 x$ q
var pauseit=1$ r! e  E2 ?' j( H  R; Q

7 p! x; R% I4 x/ Y//修改显示内容1 k: Q; y1 [: Y3 u6 I: A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': A7 v% s& C9 T0 ]2 L$ I) o  U' `+ Q

6 J! ~: X  Z- s5 {# g$ |4 w
! G6 _( [$ W/ z7 L////下面不需改变////////////% r8 P9 R. a5 L. [
) x. U7 E- b( ]. ^  k
var copyspeed=marqueespeed
3 Y1 U$ U* R' B4 tvar pausespeed=(pauseit==0)? copyspeed: 0
- x* G: W" O! Q: E8 ^var iedom=document.all||document.getElementById/ O3 C' |- U7 a: g- i
if (iedom)2 A5 q/ e  F4 k5 R) x* V( R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, z* [8 `& _2 c4 f8 j  v, U4 Rvar actualwidth='': s# E  s- H5 B# s5 a# a
var cross_marquee, ns_marquee
, u3 c! Q# f5 S
! s0 A2 c  ?+ E! Rfunction populate(){
) r% ?; Q$ R! z- t) k( oif (iedom){
. a, ?5 _& N/ icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 P% c4 V, w( R3 E. e9 _# S7 Lcross_marquee.style.left=marqueewidth+8, a6 w/ ]: k4 b6 Q
cross_marquee.innerHTML=marqueecontent
7 {1 _$ Z4 V( u4 }" ]) Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; d6 ^7 _9 H: ]* k7 D% a. {- O& ?: x, W}, y3 u) s- z. s8 f% Q$ B1 v
else if (document.layers){
! ?1 l8 |" `3 U. Q9 ~ns_marquee=document.ns_marquee.document.ns_marquee20 I3 V2 P( j. t$ `+ i
ns_marquee.left=marqueewidth+8& v2 ]2 L- V  _/ S- Q
ns_marquee.document.write(marqueecontent)
6 ?/ |; }2 u( ?+ Qns_marquee.document.close()
! O3 ], O/ E4 W( Y" nactualwidth=ns_marquee.document.width  ~* c- s% L8 J) k  d, X9 O  @
}
) |( X- \/ {6 A/ Alefttime=setInterval("scrollmarquee()",20)
. h$ _2 W4 v# T+ a! t1 x; P1 g4 c$ v}5 }8 D! h1 h) i9 E/ k
window.onload=populate1 G# q5 B3 ^0 @8 k( s" Y% ?
% U3 S' X' L1 B
function scrollmarquee(){: [% q$ l1 j. W5 i# }2 I
if (iedom){$ Z) X8 T1 L! ?' v4 M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! {0 J. R( p' G) |" t, s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# w* m/ w' D5 I* W/ a" m) U
else
9 y; h+ f6 X) P2 hcross_marquee.style.left=marqueewidth+8
! S7 ?. C1 m4 U% R1 c/ E% o; B- F/ k& j8 H9 ?* @# g  V
}: v$ o# l) F. Q, C
else if (document.layers){6 ?3 I5 p1 x2 E  Y/ a; i
if (ns_marquee.left>(actualwidth*(-1)+8))% \* U. ~2 u5 V! z" b* j. l3 c" D4 B1 p
ns_marquee.left-=copyspeed: {7 F5 @* @; F+ i2 @# H
else5 a4 F& E+ ~- a  C% ^4 j* k
ns_marquee.left=marqueewidth+8
+ J: l0 U& [+ K$ x! p4 p7 F0 h}
7 |. q+ R6 B4 T9 K( a9 e}) |+ W) V1 V: u3 n1 s7 W& [, a# B

1 b; h) f& g& h  R% @0 ^if (iedom||document.layers){
, D0 @2 S* A4 s' B) cwith (document){
! N# l( O6 T, h# E' X0 xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, S+ y. _- N7 H# hif (iedom){" f8 X& i7 x2 o* B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ p' S1 x+ R2 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; n2 l( w; \6 |! h' swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Z( c) g1 r0 n5 c! l
write('</div>'), {$ ^% Q6 n: ]# a. y
}
0 j2 m% [' s4 ^+ j" Relse if (document.layers){
$ p, C( `7 u6 X0 z2 P8 |9 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 O0 z! ~% c, G5 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 D4 P3 O; H7 a
write('</ilayer>')6 x+ z/ h1 V7 r* i: _1 v. {
}
6 ~" B/ W1 S. r6 u; a$ ?+ b+ p" l7 odocument.write('</td></table>')
- E" R! a  u5 [7 T4 K}- U1 }3 O8 B# ?  P: d$ y
}
/ s) W2 G# h+ o3 b1 w6 e</script>

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