|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
6 J1 t: U) n6 l: B/ o" s1 Q0 R; ?3 @var marqueewidth=300; W0 n, ^ \% Y- n; s, M* m
//高度
7 D3 Z9 ^' m" Zvar marqueeheight=25
+ [! O' y6 C, D2 N3 c5 r$ h) D//速度(1-10)
" m, z @) C! }; X+ F" W2 Zvar marqueespeed=3
' l* N3 e2 e8 N7 B1 i//背景颜色3 |' g# _5 w( h+ U. j% C- p* s) d6 o
var marqueebgcolor="#FFFFFF"
* y) M; D. E1 }- v" W//是否能暂停 (0=no. 1=yes)?: t6 R" g1 Z) A; E: a
var pauseit=1: o; D4 [" O% P# L. c$ s5 a
( O S+ h- _; H2 a+ ~4 S//修改显示内容* z- \( c& T% z, S6 s, o2 E- L4 ~! q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" @% O9 g+ n3 p, O8 Q# i, Q8 {
* n7 g4 x5 d( ^6 K# [
% M' b- Q; l/ V8 `
////下面不需改变////////////
: v# G @, f& ^, g! Y3 s4 a' f& V3 O# R4 R2 f7 X+ ^' z& H. {5 q4 ~
var copyspeed=marqueespeed- i! N" z1 O& m5 x
var pausespeed=(pauseit==0)? copyspeed: 0
0 ~9 O, p+ ?; h0 Ovar iedom=document.all||document.getElementById
1 X8 Z8 y/ X0 [' X [+ G& eif (iedom)
% _6 r9 `5 S1 x9 ~! vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" n: x L* C/ ]% ~var actualwidth='': J1 K$ T7 e6 ^4 t
var cross_marquee, ns_marquee" B' |' \7 A3 m6 V: y( A7 K
K9 W1 H) V' p+ {' Sfunction populate(){& P2 _9 I7 Y. G5 C7 P$ p! C4 r
if (iedom){
9 W; C- c, s5 K0 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. C9 d$ ^/ }5 B( k/ v# }0 mcross_marquee.style.left=marqueewidth+8% }; x$ X1 A/ h# u' _+ U
cross_marquee.innerHTML=marqueecontent
y/ i4 Y" B" Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' B: H# f7 j9 d. |: h% y1 i& {}
1 g! v- [5 e* q& N4 Z9 l) qelse if (document.layers){
, b" I$ C8 ^% y; t4 e& _; Rns_marquee=document.ns_marquee.document.ns_marquee27 {3 [' b$ t, P( N# e7 h) j
ns_marquee.left=marqueewidth+8
$ Q9 T1 l Y+ Bns_marquee.document.write(marqueecontent)4 w; Q8 `$ R" d) Y+ u6 E
ns_marquee.document.close()2 O: }, l3 s( y: e
actualwidth=ns_marquee.document.width0 S% {- V4 ^) e) [' |" b' V1 `
}
) ^. E! t) H. @" u+ |lefttime=setInterval("scrollmarquee()",20). o" R# z; n" ~8 k8 c! I
}
! [9 l4 |: S; f3 y- Z+ g. w/ |window.onload=populate# X. m$ w9 B( }% C5 m3 W
5 f' j6 c4 I& Gfunction scrollmarquee(){
' D% B& {' g3 J0 W- p' o# k1 N- F) q5 lif (iedom){
9 H! Z+ H7 K; I5 x7 ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ _9 N4 H/ f& {3 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. u7 \. W5 _9 welse
3 j, S% g6 \# Y: g* ]# q" |; }cross_marquee.style.left=marqueewidth+8
1 N4 [% P- J7 |; K- Z- K0 w9 i) ?' y5 v& P l
}: ^* G8 }0 I x/ A2 M6 }, N
else if (document.layers){9 k# K2 \. O- B) v
if (ns_marquee.left>(actualwidth*(-1)+8))3 ?" N4 v( |; p# C+ b3 n- a+ w
ns_marquee.left-=copyspeed9 @3 ?; M- N; k( i
else
* J4 O6 v+ K& ^ns_marquee.left=marqueewidth+8
5 r/ V$ R7 M# P}
* B5 k, K4 M9 W) m}2 r( d2 g- {0 W% M' A$ [
3 b2 K+ f0 X8 a* Y: \0 d2 Iif (iedom||document.layers){8 h! `9 E' Y9 x' C" O
with (document){
6 G; h) Y' f2 L# P& Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 j. J. e4 V6 C
if (iedom){ R% ]( Y: g4 k* k. O+ F8 K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 Q# S6 E4 `# b! l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 H1 L+ | n' T; b4 Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" c' r% A; P7 B1 _write('</div>')3 M6 j0 |8 s: L, {9 y' G" P# x
}
1 ^& J2 d" ]* O; s- Relse if (document.layers){
J( s I! M. d3 ^. b% ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 O. k& ~+ c4 m3 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 t; M0 l7 ~/ E/ ewrite('</ilayer>')2 X5 P! ^8 Y# c) l6 o6 ^
}
& E# c8 S, r: h( O! Mdocument.write('</td></table>')
1 V' M" o2 S& }1 I, h# n}
" h! t) R6 ?! Q% V) N" j}
: J; ?5 ~$ |" K</script> |
|