返回列表 发帖

网页之跑马灯文字特效

//修改宽度& t/ L9 p) X+ X0 U
var marqueewidth=300
- G% j0 \; O6 A' {5 F# ~//高度
( _# E+ T' l. kvar marqueeheight=257 d8 a) {, i1 Y) v: L- s5 ]3 y2 c- u& A
//速度(1-10)  V% s8 A, L/ B; M" E2 l; r: w
var marqueespeed=3- N( E0 g4 L$ n8 d7 B3 S. m
//背景颜色) ]8 N$ U. Z: h6 I( v9 M
var marqueebgcolor="#FFFFFF"; P' G  p- D9 u) r) O
//是否能暂停 (0=no. 1=yes)?
: G' }" P7 W* h, d- N( C- mvar pauseit=1
1 T8 k# M8 n$ l  g/ M( e$ s' C' \, z
//修改显示内容9 {7 h/ \4 b, [' d) ~0 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ m; |- [. B. Q8 Y' V: g
3 p$ k  D! {4 a) l* \  q
, B9 s1 P1 c7 f! w+ }////下面不需改变////////////  q( V1 W2 H; o% T( X

, }& _8 e* T5 y1 y( \4 V0 Nvar copyspeed=marqueespeed" W! Q6 q4 r- O: G8 z9 ^
var pausespeed=(pauseit==0)? copyspeed: 07 H' r, {' I+ W
var iedom=document.all||document.getElementById
5 N( Y* }6 I: ]+ f! C1 [if (iedom)
9 |. ?; Z" Q& [! hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' U8 G- q5 i$ J. qvar actualwidth=''& ~6 g! N& Z; b+ @0 g; k
var cross_marquee, ns_marquee7 d$ o9 B6 n% S) C0 ?( q* E3 c
) ^" n' j3 R' `) k. T$ O3 d) V
function populate(){1 x" V, x) c0 P1 N8 ?, T9 a% `1 I
if (iedom){
# x7 o& c4 J, D9 Y% dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& w! L# e2 Q" pcross_marquee.style.left=marqueewidth+8+ Q; n0 _) p/ o8 c
cross_marquee.innerHTML=marqueecontent$ Z: B! ^5 ~6 k/ A9 M, }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) ^# p7 @& ?( z3 R! d( O2 i  i
}
/ I  e* m0 z8 k3 jelse if (document.layers){; p  T  _3 {% [! Z5 C6 G' t  T
ns_marquee=document.ns_marquee.document.ns_marquee2- n. o% G) X7 l% `. l
ns_marquee.left=marqueewidth+85 |; T( G8 H! D! V4 Q
ns_marquee.document.write(marqueecontent)6 d, c0 N9 b( o5 m2 |
ns_marquee.document.close()+ e: Q& ?2 Q5 ^* |
actualwidth=ns_marquee.document.width
+ ]$ N, e. Q: F) ?, I; W% m}7 C- R2 ~: e4 H& M5 c. w  z
lefttime=setInterval("scrollmarquee()",20)
) b( U/ v9 x5 F. c# M* a, D1 {; }$ ~}
. B; O' d# _. W# j( h2 {$ iwindow.onload=populate' h% I9 z) M" I, i3 C

  O9 s% n6 x) V4 D, a5 n0 E+ I! Ifunction scrollmarquee(){5 ?# W) X3 _4 Q. E. y
if (iedom){: \; a* R, G# I1 V) D6 ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 z4 i* ]) w, x! \+ z4 t1 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; w$ E; ~8 d2 p7 ~# K0 z: n! Jelse8 M3 @, p. }5 I5 p) j3 J
cross_marquee.style.left=marqueewidth+8
  I+ q) k3 }5 {1 h- U; F- D6 K! R" n- j: Q" H
}2 y2 V' K# z# o0 O" Y2 F; p
else if (document.layers){2 {; E" d% L/ z0 z, G: M
if (ns_marquee.left>(actualwidth*(-1)+8))
8 J4 s  L7 k: K% \$ O% Cns_marquee.left-=copyspeed
: k: {) S% M8 y; ~' Z2 Relse/ y" ]0 z7 u3 t) o- M; q' D. [
ns_marquee.left=marqueewidth+8
% x! {! L" v& O( j}+ u8 }: C/ d' l. ?
}
( \# T0 u9 r" P0 \8 `% L4 v5 h& @5 o. d
if (iedom||document.layers){
/ K9 ^8 M0 F3 K0 T" Rwith (document){$ _+ q  `- Q4 ]9 w. i7 |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); L2 t9 b/ ?) r
if (iedom){
% `; g; z) }* [$ R0 d  \. h7 g9 K9 Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' a# w* d9 l- L* xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ o/ t' P) l$ k0 j8 J% r6 K! u  _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 `4 M/ m5 w* F& }, l
write('</div>')4 t9 n, M) \5 Z
}: o2 l# j8 ~+ D& l( M
else if (document.layers){
4 t1 @3 K) L+ {- Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 u! w4 [, ~" K# O0 H! B1 d& ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 v( ~5 g3 I1 x- t
write('</ilayer>')
' r. i2 Z( P# [* G7 _- s& j}( W" D5 U: `$ Q& B2 d0 J# h
document.write('</td></table>')* K- X$ h8 z( p/ Q
}2 J/ q4 ~/ h9 C8 V+ v, {; e  h8 P6 M
}
, n- f% h0 y* Y</script>

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