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

|
网页之跑马灯文字特效
//修改宽度' d+ G0 _% l8 w5 B% B* A: @
var marqueewidth=300
3 A9 S0 D& x$ C1 T( ^4 \; x4 I4 g//高度3 j: W- R3 ^( a. ~/ j" l! S/ a
var marqueeheight=25
% o8 i& ~5 G i//速度(1-10)
% b! c- A) }& O- z% m) c5 _var marqueespeed=3& h. P0 B, M4 Q4 u4 P* [3 | L" z
//背景颜色
3 b5 I% ]: }/ Tvar marqueebgcolor="#FFFFFF"
0 N+ q$ Y8 c! x' M//是否能暂停 (0=no. 1=yes)? } y+ I A1 _$ u
var pauseit=1 b# I# _+ @4 r# ~
( Y# E, k1 k% x$ D4 z# Y//修改显示内容
1 Z( n; [7 [& A/ P- H- F3 L' n1 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. @$ E: D( Q+ ~3 O a; b# h; H. X& }4 B' @
& t# e8 J: W4 w////下面不需改变////////////5 q S! v# Y \/ R
. b9 E# i# ^9 R/ tvar copyspeed=marqueespeed; s* q) h( j4 j# r# u1 I/ |% G- o
var pausespeed=(pauseit==0)? copyspeed: 0
8 R2 Y. W; j* c5 z6 Ovar iedom=document.all||document.getElementById
# N8 G9 }) d* C* ~" I; p; I# Gif (iedom)
5 ]4 `2 j; _: `. d! bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): v. ^' l7 t! a( V) x0 s, s9 |
var actualwidth=''2 J" I% ^6 y: f4 G* s
var cross_marquee, ns_marquee+ C2 E2 F# \. j: A( [; b( e- g
% |; l6 b5 s! K1 Afunction populate(){
2 p) X3 h5 T( a0 U7 p: }8 j9 Hif (iedom){3 E! F: k0 n3 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) l( c! \4 w4 R& vcross_marquee.style.left=marqueewidth+8
/ ~1 \4 P/ d3 r _cross_marquee.innerHTML=marqueecontent
4 g, L0 e; G" S, P, d3 a4 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! C# T6 c2 _$ a: Z6 |4 C& h$ q
}
N( r0 n8 s( G; _else if (document.layers){
3 ?2 G0 Y. M+ [+ [ns_marquee=document.ns_marquee.document.ns_marquee2
6 [* s. q" e$ H" X& Fns_marquee.left=marqueewidth+83 R1 S+ S5 |8 e4 N; _1 _+ N0 `
ns_marquee.document.write(marqueecontent)- r8 ~- `" x' F) ?* T
ns_marquee.document.close()1 f6 A; b/ }$ D8 T( `
actualwidth=ns_marquee.document.width
6 u. V! f p) @0 S6 \( z$ X" X, s}
8 D) O9 K% W. N+ |lefttime=setInterval("scrollmarquee()",20)
0 z$ c9 K& @0 q8 q/ D% u0 D( M}
4 m( r5 f C8 J7 C9 \ owindow.onload=populate
9 \: Y% S2 ]+ A- b7 o1 G6 d! I
& N/ d0 g! N, _$ A0 Z/ Ffunction scrollmarquee(){# Y, Y& c$ u) {: H, p8 ]# ~
if (iedom){
& p5 a9 p2 o1 N9 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
X8 K$ J) e! K- X `' mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' F) g+ L& K5 velse
) |6 J% F+ z8 w( s3 _) h; E9 ncross_marquee.style.left=marqueewidth+8
* v5 l; K. a3 h+ i$ \, ~& _3 E6 ]0 C
}/ J ]* O6 j7 H0 |4 Y w2 q) t% q2 ?
else if (document.layers){
C( B8 Q, z- m ]+ w. Lif (ns_marquee.left>(actualwidth*(-1)+8))% S3 B0 j0 g) F1 Y# ?
ns_marquee.left-=copyspeed
1 E# V% B5 [6 p% Z1 Q4 nelse+ ]6 K. n+ ]) E" p. a
ns_marquee.left=marqueewidth+8$ j. `4 p) ], y
}- n# v) f3 m$ [' U% [/ {7 ?
}
$ w0 Y- f T R+ I& [( d& ` V
; x) @% S8 Z6 }" |if (iedom||document.layers){
! g. X# w% |1 }; b p2 r0 mwith (document){6 j8 |5 k& W) @" M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" A6 C5 O7 }7 q3 Aif (iedom){
7 x& d8 l/ ^* I+ |# Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( @* X: G; Q2 a' ]8 w m1 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( {* ?' j( l, E% d9 j6 Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 P2 w5 Z9 L4 X9 f& @/ T) Bwrite('</div>')' e9 S. S. n5 ^; s5 T
}7 y C, Z3 h. z
else if (document.layers){
2 p( W& o' K" n3 I) ~9 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) w4 N5 ]( h* p, o7 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: ?6 e- Y7 i5 X5 G# p N' nwrite('</ilayer>')# [: h$ B3 _" `: q, n
}
4 G) \0 ?5 K3 [% I% Jdocument.write('</td></table>')
' d# m4 D3 r* V9 a+ _2 R! j+ X4 Z; V}
, w& K5 d- r! ], R5 Q9 u}: F+ z G' f( c/ A2 W8 z2 O* z8 @" C) i
</script> |
|