返回列表 发帖

网页之跑马灯文字特效

//修改宽度* x/ f4 P$ b- S. K4 x" j
var marqueewidth=300
) b5 g9 x: z% @+ C' N4 V//高度
& f1 V4 B& k3 z$ b* r) avar marqueeheight=25
% {( H, X! d7 E" [8 ]! G//速度(1-10)
& p: @9 F2 x- n$ ]var marqueespeed=3. l/ L% ?2 k3 ~1 G. i; K: d+ t
//背景颜色5 J: e6 B7 E+ x% s( Y: s
var marqueebgcolor="#FFFFFF"
8 C& x$ l8 z* k# c% J" N//是否能暂停 (0=no. 1=yes)?
4 I% H. V2 m2 Ivar pauseit=1
- }2 @- X- T" d5 R" z! O4 B8 N3 z; M! Q; q* s& Y
//修改显示内容
5 |1 p& o2 a( q/ o& U5 z7 [" u" cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 j2 s, ], J1 |6 ~( p
9 _% a0 [0 Q# s: Q0 S& r

4 H0 N. F7 H. `+ U$ F: W5 w////下面不需改变////////////
* i: A0 @5 I- q/ X( p+ a/ @: w' {* C/ M. l; F: F
var copyspeed=marqueespeed
  s9 v, }2 ]: c) U+ B( `var pausespeed=(pauseit==0)? copyspeed: 0
. W! }. \9 z+ Y: m' l" rvar iedom=document.all||document.getElementById1 o8 F/ ]4 R" A) d/ f
if (iedom)
; S. q& @* u1 G3 W! @, D; ?1 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! ?1 {: s1 {; {, c4 m* l  _, }! |
var actualwidth=''
) y' z1 B. C" G. \; N/ i+ l) ]- ^2 ovar cross_marquee, ns_marquee
, {- t5 O5 y  l" a/ Q/ _4 o% b0 }* |# X5 J7 V4 @% ?9 \6 |* r* e
function populate(){9 x& a- k4 r- a; z
if (iedom){
$ i3 k7 w" F4 y/ Y" O3 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% t  [- E! i+ T* r9 u/ l* z
cross_marquee.style.left=marqueewidth+8  S& Q; Q+ k: H& _- g  K
cross_marquee.innerHTML=marqueecontent# W9 S  `: v; ?8 I8 l2 x+ e. [5 T. f# i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; `9 w$ U! Z& ~}
3 L; V' n# H6 f2 F0 u, o8 [& E1 A; Delse if (document.layers){  x2 [8 O3 t% o9 _0 t2 i8 B$ |
ns_marquee=document.ns_marquee.document.ns_marquee2
# E8 Z% v3 L  ~8 _6 `% B1 Cns_marquee.left=marqueewidth+8
: S" K! l' A0 H+ p$ `2 Kns_marquee.document.write(marqueecontent)& o0 ?! d8 G; @6 {# b8 H0 E
ns_marquee.document.close()
0 F+ G! W4 x! U6 P0 w- j0 qactualwidth=ns_marquee.document.width
2 s; K: a& ~# u& W" W" i+ C}/ Q1 e+ B  `6 _, G8 j
lefttime=setInterval("scrollmarquee()",20)
' e! ^! N/ Z& h8 ]3 p}
3 A, t. [1 U6 |2 |- b" pwindow.onload=populate
' f" ]! l! g, R  @) [) H, H7 c+ I
function scrollmarquee(){* D% e/ ?: _/ _3 o
if (iedom){$ Y, R# V4 Q- k( ?9 }4 w0 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ^5 i( P5 P& h" T% @$ r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  _' E, C) e3 H, V
else5 g; f' f* u# H- M
cross_marquee.style.left=marqueewidth+8
+ l9 t: y+ ~& x5 d. |8 i  F1 b& s* S( A5 _: _7 @: d
}
; ?% ]# ?; U# O3 h4 W/ T0 }/ velse if (document.layers){
* }/ W, c( B7 J1 E) x) G0 zif (ns_marquee.left>(actualwidth*(-1)+8))/ j8 I  Q! a1 H# q# W, i
ns_marquee.left-=copyspeed
: J2 x6 Z' x+ ]else1 U9 x' M# X4 X( E3 y
ns_marquee.left=marqueewidth+8& A8 G' Q9 U+ z3 V
}+ H, p0 X1 ]' }8 E, M
}2 a& Z% f9 i5 U6 K' Y
8 C! }. v: Q7 C9 z& b5 E0 f  Y
if (iedom||document.layers){
' c4 K* k4 C: x( @  Z3 iwith (document){
7 e4 d; d* p: odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  b$ K' V( o) i3 i4 ?: z: H1 m
if (iedom){: x" s: a% l$ N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 E4 L& w! h/ A. V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- I; T$ @4 E- p2 R# G: u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 J7 g- }# d) F* z, Twrite('</div>')
9 Z; M8 ^  X1 A  p; z# R}
6 x. d6 s, d4 e3 |else if (document.layers){
% C" {% G0 b: ~- I2 i# U. h. Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! |3 v$ ]' L! i9 M$ X' B, M  J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 [; [1 m+ q  b8 o8 S
write('</ilayer>')+ t# M; I4 N; Q5 H# B3 T* g
}! ~3 X+ ^. o1 o# K9 Q) {$ N# R
document.write('</td></table>')
" m7 p7 O1 |) L}
- {5 T2 E1 c6 t' m$ k}
: T  j. x9 H- t" J( C( F</script>

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