返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 `! g. B& D1 x
var marqueewidth=300
7 E# v; M# f* {, B3 m5 U//高度% G6 H) }; g* f
var marqueeheight=25
5 L) h% h# v! F  {8 b8 ?+ c//速度(1-10)6 b$ x8 k, h2 c9 }
var marqueespeed=30 X$ w; [9 N$ j; U" `
//背景颜色
6 @' h: l% q" N! Qvar marqueebgcolor="#FFFFFF"! l/ e, y# I* |& L
//是否能暂停 (0=no. 1=yes)?
# h& W' @0 ]+ A4 P& U2 z2 Vvar pauseit=1/ x9 k+ W4 G+ c

0 P5 ^# E& Z& E( Y+ b//修改显示内容
: x( W8 L  O% z$ Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 P2 K1 C5 u1 g2 h
( S5 y: i3 X2 k' Y$ u4 g: V/ s

# c6 g0 B5 `6 Y8 j) d; c////下面不需改变////////////: [. u* s1 F: u) c7 I, S

7 k3 u" y) D6 p/ s" G5 z/ xvar copyspeed=marqueespeed
! B7 q  ]3 d* @var pausespeed=(pauseit==0)? copyspeed: 0
6 ^* P! Q% c6 d$ }var iedom=document.all||document.getElementById
- G$ t  S& M- m' N% V' d( M4 Pif (iedom)
5 `  z0 a. x1 x$ r, }4 |1 e. Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  \( C& r1 e! \; J1 [7 gvar actualwidth=''
% p8 J2 y' m0 z) k5 Ivar cross_marquee, ns_marquee
; Y. N1 \1 i7 i7 r. @4 L4 I6 i
6 r7 z, e# l3 D; t/ _function populate(){
0 v, [" p9 z) s7 z) j( W9 sif (iedom){6 D9 ^6 r! G8 [/ e" z! ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& [% u9 N& n( w! gcross_marquee.style.left=marqueewidth+81 ]# b3 b$ o7 K1 B5 H, U% X
cross_marquee.innerHTML=marqueecontent: K' z5 T* A; \" t' T) U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 c1 Q2 P4 @6 M/ l. O* s
}' c5 x7 i9 E) e! H6 W& s, i& l
else if (document.layers){5 W# d1 u5 J' P  ^
ns_marquee=document.ns_marquee.document.ns_marquee2
) X# t: K: h5 [& f6 Zns_marquee.left=marqueewidth+8
/ r0 `+ X3 T1 ens_marquee.document.write(marqueecontent)
0 R1 q+ S! @; m9 z  R- nns_marquee.document.close()3 g7 H6 m& O# V3 r7 h7 h
actualwidth=ns_marquee.document.width5 d% G. v5 g% L# J2 d8 _
}
6 I! _  y" ?2 V0 \lefttime=setInterval("scrollmarquee()",20)
- |, \! N/ P) `' @}) G3 B9 L0 I9 g. T& J
window.onload=populate
  g" @7 e0 r  G- y6 ?6 g) o  F: E1 P' s, P2 a
function scrollmarquee(){
: A0 p2 @0 `0 g% W) F2 Nif (iedom){
! w$ c6 M$ G4 @# pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( P; L6 \, I- s4 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 K2 I) Y8 a7 p& Z& T; M( U/ T
else  Y* r* h8 k  }0 Y- _1 e  U
cross_marquee.style.left=marqueewidth+81 L7 v( q+ J" r+ \5 `# {

- Y+ X0 \$ d7 N! I9 }( U}
) d0 k1 s5 ]( j& aelse if (document.layers){
. r9 _" O3 o5 Zif (ns_marquee.left>(actualwidth*(-1)+8))( s* M. n# }$ s2 X2 [
ns_marquee.left-=copyspeed; [4 q% w; {. U0 w
else& p* \8 g, B9 q) o6 b/ F/ H
ns_marquee.left=marqueewidth+8
2 V! F9 g: `6 x$ ?/ [}9 s/ c; e# i3 c) K6 |: l: ]* D
}6 [# Q& Y* _* Q' F0 L5 c

* \8 R8 h/ W8 m0 V5 z* zif (iedom||document.layers){
, i8 _. x0 d  M( Ewith (document){
  B6 M* c, m* _! Q% }/ [: X( zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- \! |4 n- l9 T4 p6 j, _if (iedom){
" E" T: j/ @6 }2 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! s3 P9 w7 ?/ \/ ]+ ?6 _- A) bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) L1 O7 g2 ?5 b8 v- c5 u! ?8 }% O# jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( g& z4 c7 a2 O3 t+ |5 @
write('</div>')
- y% K: l$ A* `) i8 j% K}7 |( N6 r7 s  o, f( l3 I  H
else if (document.layers){
  K) M- v0 @; V' j1 ?0 W. Q2 o0 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ F5 y0 i. b' T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 g, }- f5 y- Z  ?, E4 d7 n% u9 p
write('</ilayer>')
( _; Q" y& b7 u# D3 V; F}" b( k! {) A: w0 f) e0 b. Y
document.write('</td></table>')
! _0 @' H3 ~6 A0 N( w/ L: ?}  _% c$ O, q% p4 E2 u) D
}
2 f4 {: G  d0 \# N& N. z</script>

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