返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) N" _7 ^6 A  M4 t8 }var marqueewidth=300
6 W# |" l  a/ v! b  ?2 H3 H9 a//高度
: z7 w4 H' D# x3 z& [2 S2 `' q5 Vvar marqueeheight=255 Y% ]& D5 Y) W0 b9 m6 D: A
//速度(1-10)
+ k! ~$ S/ c  a% f) O5 `/ X0 y/ Rvar marqueespeed=3
1 `' @: g5 {/ U, ~8 J; g  {" W//背景颜色$ p3 u. f8 P9 S% w
var marqueebgcolor="#FFFFFF"* P  g- {9 T/ b. o' Y0 T' G' X
//是否能暂停 (0=no. 1=yes)?
$ A6 U3 q9 {  W$ ^" J) ?) I3 qvar pauseit=1
4 ]+ p9 A# E  V: A8 _% w( }% @* Z4 c/ e% O/ O+ C8 a+ x
//修改显示内容. k+ D$ P) t! c/ t) \, _2 r% p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ _9 ~2 O6 S! b( B0 e' q7 c6 a1 N, N

0 T9 Z. e' N4 D  P: T////下面不需改变////////////# f) z+ p6 u; H3 Q8 n
. d5 f6 z0 N" i5 j" C
var copyspeed=marqueespeed3 Z% t- K$ Z+ X6 z% l
var pausespeed=(pauseit==0)? copyspeed: 0* h. f! S5 s' M: b
var iedom=document.all||document.getElementById' v' n! y1 X, `' ?1 @' M( M
if (iedom)
9 Y3 \& i- ^7 m* ?3 C  _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ l, |) \$ c4 d9 N$ n0 bvar actualwidth=''- {3 Q7 d" u6 {$ y5 }* `1 g% q
var cross_marquee, ns_marquee* P9 V# W+ A% s2 D6 s& I
9 A; _; W. o6 j/ l- s8 o. b
function populate(){
  \: f# D; T% K1 gif (iedom){* N7 L5 [" T( x! x5 l& e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* V. }- c& H/ \7 v" qcross_marquee.style.left=marqueewidth+8) L" O4 o  q$ b' p& a9 K6 P
cross_marquee.innerHTML=marqueecontent) ]. ^* U* {8 t3 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! n8 ?: C9 F4 V# r) t- _1 J- T6 V
}) `, ]3 `3 r7 s6 m7 l
else if (document.layers){
- b2 L- Z) g5 v% b! U7 Kns_marquee=document.ns_marquee.document.ns_marquee24 ^$ V- O& }3 j4 q. u# M
ns_marquee.left=marqueewidth+8; F4 ^" ~% ^* X' m5 g; |
ns_marquee.document.write(marqueecontent)' D" Z. d+ T8 G8 |: g. M
ns_marquee.document.close()
+ Y1 |; u0 u/ a! L3 Jactualwidth=ns_marquee.document.width
, L. L+ W1 g/ y  }}2 b/ g: ?1 n* V/ t" f
lefttime=setInterval("scrollmarquee()",20)! F. P1 z4 @; |7 T2 D. V* W+ |+ b
}6 I+ E* k; v* m0 }3 J
window.onload=populate
& t; T" D* w, ^( |0 E, ]) O8 ~, G6 ?
1 r9 |6 E" D; _1 F3 m3 ?; \function scrollmarquee(){
3 p. l  k& |7 l6 m; b! [4 Yif (iedom){
( n0 o8 s, l4 E9 Y1 g8 I) Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; q; R3 h1 h& o# ^0 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' O" [) {! Q4 F; q+ Ielse
9 [% g1 o7 p" q7 z( B0 Lcross_marquee.style.left=marqueewidth+8
7 `& ~4 @" z) n) R8 p) l, R! G, n* Y6 O0 o+ ~
}/ d  H# ^4 q+ Y' h
else if (document.layers){
8 {4 A& T, s! T1 R2 qif (ns_marquee.left>(actualwidth*(-1)+8)); P- E, v4 B. S
ns_marquee.left-=copyspeed
. B( A# P7 `# @) j' h5 Xelse' W* Z  U; W. [; @- c& H+ U
ns_marquee.left=marqueewidth+81 r. t; b$ X* X$ ]8 S
}
; A% g4 s$ A1 o/ x5 s9 ~}
2 I6 J5 U" Z9 j2 t- u" S- {4 o
6 e0 `  O$ n. D+ vif (iedom||document.layers){
8 d# V) P* m/ C* @8 vwith (document){
  \( G+ z/ ?. y1 C6 {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 }8 l- F- T% _+ b- l' J8 W: G
if (iedom){7 ~4 E% }8 T$ ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 M  {. B. ]% {5 M* I( z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( I5 T1 {8 u; k/ b- C: z, h3 W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" e% q% j, x( x; H# Z" ~write('</div>')
4 \) z0 s. O! ?& U9 b% P; f  G}! R, {: i- q  n+ R: }: H4 N8 G7 I
else if (document.layers){: t. S- C( ?: B6 }5 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- n. J: ?9 t$ w# jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& R9 o7 m. k0 K% G0 p2 A3 T
write('</ilayer>')
: V3 S1 M5 z# J5 V; c: G+ G! N8 ^}# V- O( L& g3 e3 b8 A8 f
document.write('</td></table>')! P& c& [9 ]8 |0 I: ^
}
& `7 w, Q) c7 {* {7 K* \2 f3 F7 M}
9 j, b9 @5 C) k1 x</script>

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