返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& l% S  ~9 V5 {$ G7 n% j6 ]var marqueewidth=300; S+ g8 Z% U* s- d0 H, R
//高度
+ ~/ g  |* i/ P) V; T; Y) ~3 avar marqueeheight=25, Y0 M) C: X9 |% C
//速度(1-10)! j8 z! B6 n! i  r! ?/ B
var marqueespeed=3
% x5 @$ p+ J1 c4 ?! W//背景颜色+ Q& {9 s9 S8 Y( `; _$ {
var marqueebgcolor="#FFFFFF"
0 @. i& c' S# _3 ]" T- m0 G//是否能暂停 (0=no. 1=yes)?
9 }5 M3 E% v0 w6 \! N  x- ?var pauseit=1
8 q2 J* [0 t. l% m/ C% A, M( s' Y5 ?6 T% t: U9 ]
//修改显示内容9 c' y0 y# v2 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; v4 y2 X# X+ U
, I' e) a2 e8 e# f  e

# Z' P( f- q- |. r- J. s# t  z////下面不需改变////////////
! v2 t$ [) ]/ g3 q$ J8 a  m
) G3 C* X2 @; _( kvar copyspeed=marqueespeed
' r+ T$ [- j. e+ [) ^, ^var pausespeed=(pauseit==0)? copyspeed: 07 ^' b* @" \# c& r$ ?0 a" v
var iedom=document.all||document.getElementById; S* k9 F: E) h1 S0 x1 T
if (iedom)" U7 R9 A  M& r$ h' ]6 ]: O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) ?7 N* Y5 y+ e: Q2 E
var actualwidth=''6 i7 x1 @9 e& G" C0 D3 U1 H! N- x7 M
var cross_marquee, ns_marquee
2 Q% q9 O3 Y% N0 X5 H6 T& {. ~0 k/ J& a7 y: H. h, z
function populate(){" P. u# K* v0 C, p
if (iedom){
+ b; `, h7 s" p7 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 D: \+ D/ R8 K8 v! ?cross_marquee.style.left=marqueewidth+8
0 Q+ g  _( Q! c9 O" y% \! ^1 h$ g( I8 kcross_marquee.innerHTML=marqueecontent
7 N8 g! g0 R  Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  A: a! }. U8 c2 S}8 W. U9 [) L( S  w! T! f  Y, S2 Z8 Y
else if (document.layers){
$ p. y! u, j$ E5 y8 C, v0 |5 Pns_marquee=document.ns_marquee.document.ns_marquee2
: q# e% B" J. g0 Xns_marquee.left=marqueewidth+8
2 [+ ~: ?8 x: s" C  F/ kns_marquee.document.write(marqueecontent)' U: s3 b7 l4 P0 I
ns_marquee.document.close()
  G' Q& j# a" h9 l! ^! f1 ]0 Mactualwidth=ns_marquee.document.width
$ r' M" X( o! d. [}. I( \8 C0 q+ G6 E4 X" M
lefttime=setInterval("scrollmarquee()",20)
* E% V+ g7 x. G+ f+ a9 u}  g4 L4 A1 ^- y2 H7 G) D6 u) C5 t! |
window.onload=populate. {* b1 {" \8 B  L7 E  K
' w" i$ Z: ~4 W! _6 @
function scrollmarquee(){6 t0 R4 i: a  P  N
if (iedom){
" ~8 R0 b! i4 ]+ tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ G: w- R: \; Z0 @2 B! {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! h; ^% I2 s" J4 A# ~8 selse- |  P8 N2 {# v9 {6 o
cross_marquee.style.left=marqueewidth+8( J" s* T  z/ o8 f% Q; M; Q" s2 i- C

  I4 r: C" W5 Y# ~" l! Z) [}
! `. z$ \2 w! X3 ^& w1 |else if (document.layers){
7 V( h) _. A. h; }, Z* _& a& ^5 _if (ns_marquee.left>(actualwidth*(-1)+8))9 F7 H  X; N% U5 o- T
ns_marquee.left-=copyspeed
1 x0 ~$ U- b% Q  q: Jelse5 C6 M( W6 k, h/ I! D
ns_marquee.left=marqueewidth+8
! c9 n4 C: ?4 d" s; L2 X  x}# S. y/ c8 u  h8 i8 v
}
+ K2 E) A+ w- v# L- L" F
1 U: H- Z. @/ v5 Gif (iedom||document.layers){
  {; F# X2 {  s7 ewith (document){
  p7 \; T; f. t: p5 u' |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); w: X4 n6 O* C* J
if (iedom){! Q( h( ?  j$ O9 X& h- p0 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); h4 a6 E+ N& a4 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 `- Y3 T- C* p$ `2 T0 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 X4 U% b& a6 u( K
write('</div>')
- ]( B/ D' _! B5 T( u3 }}+ Y, H% p) M' o2 h  W' s% w% q
else if (document.layers){( d9 ?5 H% J: `4 B( b, H6 O  a$ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' f7 \$ c0 R! |, s$ k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ n/ c2 K4 b4 G' Y! q0 Z
write('</ilayer>')/ L. a+ J5 F0 C) o8 E8 P, [9 |
}
2 n. a: k6 ^: f/ d; xdocument.write('</td></table>')3 @6 X( B; t  n+ x6 Z" Z- K
}( U( [. z+ z5 A' G- g) j
}8 Y5 V: @9 i" j3 m, s, N& V7 Y
</script>

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