Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度' c; ^6 g8 o& O( a, V1 m, A2 b
var marqueewidth=300
) e& H8 p8 z) u  z//高度
" l1 j% x- d/ p& s* V7 Ivar marqueeheight=25! M' J8 C& [# d
//速度(1-10)
' M6 o' @: _' L! H, \) Xvar marqueespeed=3! N# k/ R( ]$ w1 Q
//背景颜色( O9 D5 o8 j, U" s% E8 A
var marqueebgcolor="#FFFFFF"
+ M' I7 n( S4 T7 v- M: ?* ~( B//是否能暂停 (0=no. 1=yes)?; K' c8 c# |( t$ g. N, R; {5 Z
var pauseit=1. I: K, ?' R! N/ Q! m+ h' L  i

3 b" D  z- \% d//修改显示内容$ D: w, d  e$ }! B" @1 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" Y0 N& B. N! R0 H5 T8 A" m9 U: s1 S2 u) c/ K/ X* o' a6 L( O

+ h1 W3 ^( |  I/ _  {5 n////下面不需改变////////////' e/ E: R& h" ]9 p. F( l9 U
2 Z* E7 o, Q. M9 C
var copyspeed=marqueespeed2 M. P! x4 H; [& A: l; I
var pausespeed=(pauseit==0)? copyspeed: 0
4 N  i; w, C( u& b- I! ?' Q# A8 I  E, {var iedom=document.all||document.getElementById; u& }. y# w- C
if (iedom)
0 y+ u$ M# o9 S: S5 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 Q1 Y- N' I( p: Hvar actualwidth=''
/ w; V+ s4 q) r' _$ |var cross_marquee, ns_marquee
# c9 z+ m& A9 x& c+ {& m
: G! b5 z  R& P% G" ffunction populate(){& k, @3 A! B; m. u: r) T. d
if (iedom){3 z3 M& Q7 @' y, k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" m6 b* m  r2 s$ @, r- p
cross_marquee.style.left=marqueewidth+87 F0 v9 a- c. Y' ~8 J  H( q
cross_marquee.innerHTML=marqueecontent! b" q" e" m3 ]* a5 T+ t5 g% q# I1 w. v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ b$ D+ ^1 b# t, u  e% Z}
: q: n, B2 D- U( ~0 Z3 i: _* nelse if (document.layers){$ w0 F  c6 `5 J; i- K  G8 ?( o7 f3 ]% Z
ns_marquee=document.ns_marquee.document.ns_marquee2/ M0 p" G$ I" V" G. B5 n
ns_marquee.left=marqueewidth+8
' G. m9 _( A: \3 Yns_marquee.document.write(marqueecontent)" g8 s7 K* W% z3 Z" t/ B
ns_marquee.document.close()
7 y- K* |0 f9 s1 Q! q5 iactualwidth=ns_marquee.document.width
. F' n5 f* `8 [3 h# Z}
7 ^7 T8 E1 o% o. {& k4 u2 x5 \lefttime=setInterval("scrollmarquee()",20)& {. m6 n- e/ _% y
}
" ]% t$ B0 W. y5 |window.onload=populate
1 B5 W6 C+ _5 F  `% _# n0 r8 L8 h+ h9 T' I9 \" b
function scrollmarquee(){
2 l: n% n& c4 n5 cif (iedom){
! s* U( W8 h5 `% L$ U5 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# U& w: |  j3 S5 t% {& @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 [; d3 @' G9 u; b; X' aelse3 u) I9 |3 Q7 I6 Z
cross_marquee.style.left=marqueewidth+8
5 s) U, m# P7 D# {; y( D3 H8 N& N0 t& K/ f/ O! y
}8 Q; a; T) j# A3 w) A& s4 j& S1 ^5 e
else if (document.layers){' N/ o  G0 W& H( |
if (ns_marquee.left>(actualwidth*(-1)+8))
2 t" s+ U" Z+ [$ b: Cns_marquee.left-=copyspeed1 s; ~9 F, Q0 }- }$ f/ j
else; o  h* ~# ^! K3 K; o5 \" b
ns_marquee.left=marqueewidth+8% U0 A) G# F! I3 z8 K3 _7 L+ R8 S
}
$ b7 c1 d6 Y3 V- p}
" i4 w3 U+ o" i8 i+ x' _
! F5 Y2 `6 k$ R: d  fif (iedom||document.layers){4 E: O" E% z- p! T6 c; Z
with (document){% S. Q1 S0 }' p) Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 Z4 y6 b" I5 F: H, {1 u1 T
if (iedom){
8 x% }1 ?- n; [7 C8 [# t  Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# n0 P! }& y' L3 v' t8 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 P( Q4 a) y! t0 a: y# K1 P% L: c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. z+ o% W: b! V5 ?2 v2 R2 F: Dwrite('</div>')3 ^1 w6 ~" l' h3 g* L' ]# e
}0 }( E. m/ G7 @( v9 I
else if (document.layers){: Q  N+ s: J3 e( r2 U- L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 i$ [5 n9 x) t% _4 e7 W6 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): Z7 M$ |' M" \
write('</ilayer>')
, Z4 q% m% P* T2 U2 w) a- W; }* S9 J! \}
9 p. g; t. m; X- b: Adocument.write('</td></table>')
% I6 ~; b  K- O' K+ \/ @}2 u+ o* M1 ^" J; k' o, x
}
" S  i9 T# m9 w+ O3 |4 l% V: l</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2