返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 w, K" K2 }; B" ~6 kvar marqueewidth=300
. ]6 ?' ]# Y; V6 Z" w+ i9 ?+ |" }& W//高度
7 {/ `2 V. w' }7 P9 M) ?var marqueeheight=25: @# P' j* ?/ Z
//速度(1-10)& O& t8 y* a+ |  [
var marqueespeed=3
5 p' X; O: v- s; G) X//背景颜色+ N, u# j7 V" z' S8 {
var marqueebgcolor="#FFFFFF"
  E7 ?0 o+ T7 T. s" X0 d" M//是否能暂停 (0=no. 1=yes)?6 D% ]+ ]$ c! r, H* B. y
var pauseit=11 B$ Z' P; \! X# E+ ]* _

5 S4 O, r3 p; n0 ]  Y- O//修改显示内容$ K6 j- y7 {. X: h( J, f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ c; Q& {& v0 H
/ x, u! A) l8 q5 K) [5 @7 Z1 Q+ m3 G- q" d- F7 z
////下面不需改变////////////+ O. r0 M, K* i

5 G; U7 W/ x% B1 Rvar copyspeed=marqueespeed
( _0 E6 t7 b( e% _var pausespeed=(pauseit==0)? copyspeed: 0% F$ p7 f, {0 w! F9 d9 u1 @  l
var iedom=document.all||document.getElementById" n6 S& }, T0 L0 s/ ^* Z
if (iedom)
% z3 q, I5 O' `# a2 l; ~( `. z: edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# j8 v, L7 }1 k; I% J  `, }var actualwidth=''
' z0 @8 U. T7 a9 b$ ^var cross_marquee, ns_marquee' f0 C  P: l/ i( N" m. X% T

# Q3 y- K# M" ^. P' u5 E: ~" ^( jfunction populate(){- @4 C) U  n6 g; h3 f8 G
if (iedom){. q1 S- F$ I# h7 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 x7 d  N2 N  q$ S: B
cross_marquee.style.left=marqueewidth+8/ T# ?. z0 Q0 r) Q- |: Y
cross_marquee.innerHTML=marqueecontent4 n. o& c( g  Y' i. m' l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  {; B. u' Z1 {1 H
}
" d* n$ x6 c1 B. Zelse if (document.layers){" h0 x: C( o+ Q8 u
ns_marquee=document.ns_marquee.document.ns_marquee2
( J2 ?) p' u: {* x" yns_marquee.left=marqueewidth+8. i) C) K# ]  F
ns_marquee.document.write(marqueecontent)
% [* }  N# l* P; R3 H4 u# D  Z" Fns_marquee.document.close()
1 F* h; d' O8 F8 |1 q! [& Q5 Ractualwidth=ns_marquee.document.width
! g7 A0 d; C& q8 E1 f6 z4 X; ^}
. N9 {$ C4 D3 z3 Nlefttime=setInterval("scrollmarquee()",20)* ]1 @, O  r+ l1 {( I( z
}
& n) t3 Q! O1 K2 u" swindow.onload=populate" n5 c" E: G8 g+ T/ ~. @+ C
& |+ W7 M8 O2 @+ {5 k7 C' m# v
function scrollmarquee(){
  T* j5 U" \& w# ^% ~* ~/ Nif (iedom){
+ d7 a' C! Y& I  Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# `9 b0 s3 }9 q9 u  k4 ?- H) a1 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& _1 U! M+ u) b# i6 V+ \7 ]else6 i# @4 ~3 b5 u; Z" Q4 P# O
cross_marquee.style.left=marqueewidth+8
8 W8 E5 ^! n* G: D8 W* }
/ t9 d6 E7 G5 \) h}' v: c  r$ u1 A2 n$ P( G0 }" y( X) T
else if (document.layers){) p* h# }5 H1 ~( ^( |  g/ E
if (ns_marquee.left>(actualwidth*(-1)+8))
/ v/ L5 ?' p+ s! h- ]3 uns_marquee.left-=copyspeed
; j6 g; x) b7 ]. l! `% v- ]( N! _else
5 Z; O" [2 l  M+ x# o+ i. ]5 S; Fns_marquee.left=marqueewidth+8
0 A. B" x7 H/ C+ _  Z; T8 f}. Y# e! D8 Y" c% b4 K
}
& ^; y0 E5 M9 r$ t, ]0 J9 b0 B, q. g2 A
if (iedom||document.layers){
5 v: f6 M! Y9 x( q: g$ ywith (document){
# J! t4 P8 m4 ~/ i. adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  j. O5 B; R+ M/ H" |if (iedom){; u9 e) z' b1 }; l* g4 J# D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 [+ F5 \% j- Q. V# k+ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: q& t0 X; Q& z5 H) Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- F' J8 M- Z  {4 u7 e. k3 V9 {write('</div>')+ V8 N& k4 K& N& K& t) S( |
}
4 [5 g  h9 J8 o+ B8 ]3 Aelse if (document.layers){
" e; _# J* p6 U" z( gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): c5 h% P" B' \! I9 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 ^! E0 X" o. k& C
write('</ilayer>')) l% X+ d$ g! V; z1 ?, P6 q
}
) H/ E: ]0 ^8 R  @: Q+ |4 R1 ~0 rdocument.write('</td></table>'); d! {0 ~1 f  y3 k- v- E
}
% O9 B9 Z' F, Y}7 s6 d: o& w! W# a& u1 P, t" T
</script>

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