获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ u2 ^' _- I" T! J( h, T
var marqueewidth=300+ G% J3 F+ d+ S" x( q7 ?5 q: y
//高度4 N$ n& Y6 K% z' W1 H
var marqueeheight=25$ S6 |  @3 g: j2 e; H& Z& h; T
//速度(1-10)
) ]6 U1 G8 U, f& \, B0 hvar marqueespeed=3
/ b  e1 M* k; D6 N! J' d//背景颜色
8 ?% ]- ]7 L+ {6 J( V- F* W) Wvar marqueebgcolor="#FFFFFF"" b* Z6 l' L0 O8 a* C( W& t) `3 M
//是否能暂停 (0=no. 1=yes)?
, s( _* d7 Y0 evar pauseit=1
% q$ y- v. l( P9 z4 @
$ D0 P7 _9 R2 w7 v, N//修改显示内容3 F+ C: ]- Y9 n5 o6 r$ |+ R8 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( [2 b* |$ x* U% Q+ I+ C( g% Q4 o4 u

: \" K* i4 P* u" y- O6 ], a9 V! I6 u3 H$ [* ^
////下面不需改变////////////! {6 u5 a4 j) L/ l# N

, s: C* \; x( J. |$ z* f7 qvar copyspeed=marqueespeed
. M" X* T+ U: s/ v! kvar pausespeed=(pauseit==0)? copyspeed: 05 K. P1 v' J6 w
var iedom=document.all||document.getElementById
  K. r$ r' j' v0 r& L6 ]1 jif (iedom)
+ i+ m& B3 U% S! f2 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% P& F) h9 W9 V' L5 E8 X- F
var actualwidth=''
- ?1 j9 S5 b8 e' ?' J5 U' _( Gvar cross_marquee, ns_marquee6 L+ }* f/ T3 A+ ]7 |* x0 o/ n1 o: T
* W/ X$ O8 ~( [1 r5 @5 ~
function populate(){7 H- \& e+ \, h% Z& p6 b& w# r  `* }
if (iedom){
6 r$ G" G3 l. X: D1 V5 V! d# Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 W7 j4 i- F+ g# y+ i$ R6 H
cross_marquee.style.left=marqueewidth+8
* o# g7 G) {: B3 l: r" ccross_marquee.innerHTML=marqueecontent
( x5 Q9 T$ q6 u1 l) l, I2 S% @! \0 L" Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: J& }' ]; b. S" s}
% Y0 R+ X5 k: s2 X4 V5 selse if (document.layers){2 W: E4 B" ^* C  |: {3 A8 o* ?) V
ns_marquee=document.ns_marquee.document.ns_marquee2
* x3 p! {7 o$ P5 |7 K1 u* J" v) Hns_marquee.left=marqueewidth+8
# K6 U$ E2 b: f: }1 Ons_marquee.document.write(marqueecontent)
3 t: J; G' m) L# Dns_marquee.document.close()  ]! W2 F" W( `) s1 _) n
actualwidth=ns_marquee.document.width
: }; @0 M: a: H: x. c}
. m' k  y# l$ N' u/ Elefttime=setInterval("scrollmarquee()",20)1 s6 I, E  p8 ~, J. B2 l5 }# q7 Z
}
; P: c" \3 u5 ~5 _( ]( }, fwindow.onload=populate
6 i* ]+ B! |4 o# }9 H0 g- [2 U, Y% M7 `" \# Q
function scrollmarquee(){
1 o. _4 J" O0 b% b- y) xif (iedom){; g/ M' Q; Z3 O$ G* k% s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ H! Z8 g4 V6 t$ `8 ~/ y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# ?) b- d8 t6 ?# X$ @- Velse, Q6 z6 ^& b! g
cross_marquee.style.left=marqueewidth+8. g/ v4 u# @9 Q, z; M. }
$ x# C' p# d. m1 w1 d8 E. b
}! C4 ^3 [$ V% t, \
else if (document.layers){
  @4 ?( H; _- W1 Kif (ns_marquee.left>(actualwidth*(-1)+8))- K  T" `* m- T
ns_marquee.left-=copyspeed- @: |9 t8 r# n1 a6 Y6 W
else
$ {: d% Y7 p( T, X2 w* |ns_marquee.left=marqueewidth+8  R6 c0 A8 `$ s9 E7 n5 I
}
' l& n$ ^  E" m8 S' @4 }3 ]; O% t}7 \0 I3 A* D1 O; k

. {0 X: n2 _( j8 U/ Qif (iedom||document.layers){2 O4 C- Y' Z" ~5 l! O- l0 X
with (document){
$ t" i5 K6 Z  }; i( B; S5 D; wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 |, c/ U+ v) h3 i4 G0 Iif (iedom){
& E+ V) M2 e0 u7 Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- {. g3 K1 |" Y8 {0 A) U# Y7 a/ nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), L; b$ ^5 R- `. p$ w: N' x( t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ F1 l+ H7 O! J6 e; _4 N' R2 g1 pwrite('</div>')! n6 y, F8 r& ^7 J
}
4 ^: d4 R' n  k# ?4 b! O8 ~else if (document.layers){5 E+ m3 {$ I; t- O$ [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 ?& K' }4 z8 ]. R: ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ N3 O. W' F( A! M3 xwrite('</ilayer>')4 W; |# R8 j: q$ V4 V; Y( g+ e: h
}
7 w* G7 z- R, [1 Z% [document.write('</td></table>'). l$ C( K1 }2 v7 s
}; r! x7 a! M7 {* z' f
}$ A7 i8 J" L$ f9 a1 \) R( W
</script>

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