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

|
网页之跑马灯文字特效
//修改宽度5 W1 V6 ~1 x; ]4 Y/ p" y0 j
var marqueewidth=3005 W( A2 u+ I3 X% Z" X$ H
//高度# J* w# @0 d2 R3 n% f1 Q/ v: i, ?
var marqueeheight=25! Z e) H! \! b
//速度(1-10)1 G) w M8 L2 u1 K* x- \1 `
var marqueespeed=3
{7 M |2 A/ y& U- t4 q//背景颜色
% g3 ]3 s" p* z0 }var marqueebgcolor="#FFFFFF"
: E. s! Z: `, r" Y//是否能暂停 (0=no. 1=yes)?
! ]% H* M6 {7 q( a7 O+ c; ivar pauseit=12 s3 p* x; ?. L6 k4 R5 y
8 [) i# p% Y2 _0 r! o4 w8 M _8 V
//修改显示内容
9 D! N, ?0 S' |, S. y# G" d' ]' Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- j8 J- M6 R; F+ d; q, F M
- G5 w* g/ `' l& b1 W* i
" [7 A9 ]- b' S" r3 ^- {
////下面不需改变////////////
" k2 m8 K! e4 U# E
, @& H7 C, P" r7 Z/ v6 svar copyspeed=marqueespeed; _$ d+ N( {6 T4 S
var pausespeed=(pauseit==0)? copyspeed: 0% P |- D* h0 q# I2 o r
var iedom=document.all||document.getElementById
, W1 F F0 T% i$ Eif (iedom)( ^( X# ~4 t, l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" C! x& d- I' N% ~9 ]7 nvar actualwidth=''
- A' }( |# J" O0 ~- `* p3 X( Dvar cross_marquee, ns_marquee% G* u# }3 l* z( V2 O
7 D/ M' s* R% }! }) w! l' O& r( G+ l* bfunction populate(){
7 g9 }; [# V$ ^8 [) Dif (iedom){" y4 S5 ?0 X# ~& Y3 [# v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: `- j$ }! r( Q6 ccross_marquee.style.left=marqueewidth+8
8 u8 L, Q5 g: O+ c+ C6 Ocross_marquee.innerHTML=marqueecontent% q- w/ u) `7 b1 X! U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( r" ~% h( ^% v) H}
2 f; G. m* ^3 R b$ o# Felse if (document.layers){0 A8 m- F9 { p
ns_marquee=document.ns_marquee.document.ns_marquee2; o4 a) @( H5 y" U' q3 e: c
ns_marquee.left=marqueewidth+8; D- v8 |; L4 x
ns_marquee.document.write(marqueecontent); ]& ^- e2 \+ r# G$ V
ns_marquee.document.close()! ]1 R E# n9 j- B
actualwidth=ns_marquee.document.width
2 q. V) a K2 F3 x! W, @}) j; T3 t n- b0 `% f
lefttime=setInterval("scrollmarquee()",20)
: h8 _1 S1 K$ y3 b}
' r9 x o! d, A" ^2 Gwindow.onload=populate* _- N N# s' V! r
. T. o/ W( H$ r! B) O" ^) v
function scrollmarquee(){ r! x; _& A4 f8 }+ a. ^# ^/ Q @
if (iedom){+ t4 V R+ n( I$ l) g& B7 \, d! C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% b, S' E( v' @* ^ ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ R5 @, L P; v( P; I) C9 Belse; e6 t( s; e8 D. z. U) i
cross_marquee.style.left=marqueewidth+8
1 t+ J) G6 C1 J( X: N1 Y4 A
5 B1 A4 a- }$ T3 O}
' V& q3 m" Z* lelse if (document.layers){! u- t/ P9 d" J8 _
if (ns_marquee.left>(actualwidth*(-1)+8))
% w, H8 w7 Y8 M* F, |) ~0 E' Dns_marquee.left-=copyspeed9 c4 Y! u( |0 b, T0 c+ c
else
. F2 ^' r7 P$ h3 G6 @8 N5 Q# ans_marquee.left=marqueewidth+8
, ^6 ]; P0 c9 \+ q; d}% b9 o: J# Y4 M" e. d) l% ^
}
3 F$ d; n- J) F( I5 M/ `" Q) n. Z9 ~: v8 m) ]
if (iedom||document.layers){
+ K6 H3 B5 f9 ~with (document){; m) u$ P, L- {! z3 d3 g. ?/ O3 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* f+ _" o. J' k8 q2 Bif (iedom){
: d& s4 n3 N2 Y# g9 B7 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
c& P% ~) B0 A6 o2 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 V: g, u% P8 |7 @6 W6 L) M5 m- uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 {3 S! h. Z* K# Twrite('</div>')
* l; h! \+ b' `( \. @; J5 ]& {}. D* I: i) J9 a. X! P6 M' x* }
else if (document.layers){* R+ e, j# [3 A5 ^; w1 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" P& f5 `% Q: ~: V6 d" }9 F8 g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 Y- X% Z3 k. W" K/ [ c. G
write('</ilayer>')9 ^7 }' }, A0 U+ P+ v8 q
}
H3 X, |' z$ v5 ddocument.write('</td></table>')
3 C% s. F+ i) f* ^9 e}
0 I: K T" C/ ?4 [1 G}
+ X% _7 d3 U' k( U2 Z; T</script> |
|