返回列表 发帖

网页之跑马灯文字特效

//修改宽度- p' v! D: [, x# s* n( |
var marqueewidth=300$ U  F. c! B5 A& P. s2 I
//高度; i# x# _6 p& x/ W
var marqueeheight=25# ^1 }5 G" m! j+ Q" H! j4 L0 o9 G
//速度(1-10)
" m; S, Z% t  Q7 }4 {var marqueespeed=3
' M' M! r0 _: [. t) v( g//背景颜色2 t4 i! l3 h- j% n. b+ I1 A, }
var marqueebgcolor="#FFFFFF"
9 t8 D  X  ]( u& q4 @//是否能暂停 (0=no. 1=yes)?
1 I. Y7 `3 g" Z/ ~( C& j& evar pauseit=1, S5 H7 O1 I. q8 ^  V, J

. ~' K8 t( d8 o$ V) G7 x$ s//修改显示内容
; ?1 N9 k" `8 Z! F7 E3 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 M& c" l# h0 j9 H$ e0 m, Q+ E- f' u8 _! h1 {/ |$ S

: S' E9 p" x; p0 Q1 }- w  \4 n4 _////下面不需改变////////////5 N$ m" O+ x" W$ g5 N

; B' ]) s% |9 ]8 [5 Svar copyspeed=marqueespeed6 t. f. r* Z0 @+ J1 K* A  ?0 h
var pausespeed=(pauseit==0)? copyspeed: 0$ j* `8 y. r. L; p* f7 J5 T. l. ~+ \6 v
var iedom=document.all||document.getElementById  P* m/ i8 ]$ ]% O$ ^4 G
if (iedom)
/ O1 L; z$ t* N) Y8 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* h4 {% A1 s' W1 ~0 ovar actualwidth=''7 z6 q0 u* \* l& j9 y; P9 D+ H
var cross_marquee, ns_marquee
$ G- S0 y7 m' a/ z; I
% [3 P" r8 B! L7 Ffunction populate(){
; H/ l6 ?" _$ p2 hif (iedom){: p+ @+ c% q7 I0 ~; [$ P6 _5 Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( A7 r2 \+ K; W: a! }cross_marquee.style.left=marqueewidth+8" i/ {1 r( W7 b
cross_marquee.innerHTML=marqueecontent& [1 q0 O, d& h- a8 \$ _% f  N& v' Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) V. X, x; M8 m- e. a
}8 @$ [9 }1 D9 q, p5 z' m
else if (document.layers){1 u( n; p* |+ ~6 L8 S9 l! z* |
ns_marquee=document.ns_marquee.document.ns_marquee2
( [4 t3 s* l$ C) ?% f% g7 lns_marquee.left=marqueewidth+8
: j. q6 t9 a, e; p8 L  A7 s2 Nns_marquee.document.write(marqueecontent)+ u1 R/ h$ o4 J$ i
ns_marquee.document.close()
; \( B) @. k7 ^' }5 ]0 j4 ~actualwidth=ns_marquee.document.width
. C1 H) C" E* ]; P# m}9 L6 j4 G. N4 ~" v/ n' t$ k# Q. L# \
lefttime=setInterval("scrollmarquee()",20)
' R6 @9 f7 g7 [}
5 ~% U* |9 a' j0 Fwindow.onload=populate& K* v% a2 d. `4 X3 V5 a0 l
4 i; c; o4 O# Q( J' v3 k- i
function scrollmarquee(){
- E! i, B8 F: j0 j0 u+ {* Tif (iedom){/ P" a# [5 F- K& N! Z, e0 Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  g& \/ }/ x3 c, ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ B/ x" d- o7 a& ?. t% E/ e! C
else# a+ |& I" {9 _+ M; G' ^1 x
cross_marquee.style.left=marqueewidth+8
9 c5 n$ h' ?" K) M/ Y* K! @: R* r  N, }2 n7 i5 l& X' {
}" C2 d9 V- {( B. E, E( F; P
else if (document.layers){+ M6 i  k6 p, d/ u! c
if (ns_marquee.left>(actualwidth*(-1)+8))
' z3 E' V0 h' G' v% bns_marquee.left-=copyspeed% }( M7 {8 N$ X6 ?1 q2 M* o( b
else
" f+ F, ^* ?! f, ]1 Uns_marquee.left=marqueewidth+84 I1 E9 y: O0 W: q- m5 W# H9 P/ B, m2 f; M
}, a& f% I4 D4 l7 g. s. _' u
}. Z+ u  R2 S2 p. L* y

* M- s# M' |3 o& d) H  ~& Lif (iedom||document.layers){
/ {8 r) D- g: E4 w; N, Swith (document){  y6 @9 e9 I5 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 t& d. ^  J6 ]. a2 M! y0 w% @7 _
if (iedom){
+ o. O; [+ f3 W' n4 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) e! ]1 \6 k2 |9 |' p, G; nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 d) l% j$ \% U9 j9 s4 G! k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 y; B% `2 ^+ }2 k; ~
write('</div>')
' m  \8 Z4 z  R! u}
% H/ H/ d$ _6 J. v! I  Celse if (document.layers){
1 M$ R! ^7 }5 m' K7 p7 P% gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): I4 T3 ~# p; C( \6 r% t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' D% ?' @" i8 Z+ j& |# \write('</ilayer>')
  I" r. g3 M* N9 c}
% V% u3 v& y4 ?2 g+ Q$ r- t* f+ gdocument.write('</td></table>')8 M  l' ~) k- T
}
0 V6 k' z3 e( d! Z4 M}
5 @( q, d5 W, _$ T' ?</script>

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