返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 n! @7 N1 l+ w' h1 O6 ]  ^
var marqueewidth=300; S. o5 U6 ]' C5 t; @8 Z
//高度. r* S5 U6 N% ?4 ]8 x
var marqueeheight=251 Q9 k/ t6 o# T* M9 }% L3 v
//速度(1-10)
2 A9 E. c9 M; E7 c. _1 @2 Zvar marqueespeed=3
4 Q" F% I* T$ l4 d& G//背景颜色
8 y6 L9 q4 z+ Z4 J4 ]var marqueebgcolor="#FFFFFF"
  V% ]# w0 C4 J  H$ J//是否能暂停 (0=no. 1=yes)?6 q) ]3 f' r/ L, c; b: |
var pauseit=10 s. M: t3 W, \/ ~- j* K: k
: i. n% f/ ]9 b6 ~' ~+ R
//修改显示内容- _: I( u& f$ x+ G* T/ L: J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 x) v+ y- j  W% ]- ?0 U
7 e8 V3 E; e  b4 C6 ^
- ]3 Y: t; j% s2 g; r: M
////下面不需改变////////////
8 g7 j9 L6 I, W. B8 Q; V" G- h6 y
$ H$ E4 K( |, M  l2 E* E" K8 _% Gvar copyspeed=marqueespeed
- [6 r' H8 W( p0 t3 I7 jvar pausespeed=(pauseit==0)? copyspeed: 0
  J. Z4 U; t8 ^* p9 j2 Wvar iedom=document.all||document.getElementById& I+ }8 ?2 ^$ r7 h1 l4 ~" x# Q
if (iedom)
' z# u+ a5 z$ D; sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 m; s" C! c* z/ w! w6 o( c& A8 s( `9 k- avar actualwidth=''
( [9 Q+ _9 G/ f& C1 P+ Gvar cross_marquee, ns_marquee
8 ]  S/ Z4 k4 V% o% b( V9 n) |4 X9 j! |
function populate(){" E+ J3 b( C" E* V1 P3 F; s" U
if (iedom){
; u" u, {0 T, t. r! Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 b( h, |7 Z7 {' G3 q2 Rcross_marquee.style.left=marqueewidth+8% ?' w5 J- z% s/ @3 t* B' Z
cross_marquee.innerHTML=marqueecontent
8 U$ }9 W) D! W5 qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 g; X; U$ m! F3 v}
% m" K  j3 N+ U# t1 b4 O- Jelse if (document.layers){9 i  e8 i7 m8 m$ z( s3 T/ r
ns_marquee=document.ns_marquee.document.ns_marquee2
+ c3 ~$ L" u) C  N: g5 a  Zns_marquee.left=marqueewidth+8. I" g/ N/ V6 |5 h! v0 V/ e
ns_marquee.document.write(marqueecontent)' Y" Y: i9 j5 W; j/ A3 H' p
ns_marquee.document.close()
8 l2 V. ?8 {; m. T& H$ nactualwidth=ns_marquee.document.width
' Q  L: \0 ]* t7 `4 r3 R/ a}( [0 @: |" w& y- U
lefttime=setInterval("scrollmarquee()",20)
/ s1 V" Y  v: y, o) A}# l9 ]- O; _2 c$ a
window.onload=populate1 Z) T( _  L1 d# m+ y, l

" n. _& W: e) @+ Ufunction scrollmarquee(){
, |! s7 D  J, R7 q7 sif (iedom){' O: j+ ^( ~5 P" X2 P( w; C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 e. J$ B/ ^4 c3 O3 f( _& }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 c- `* o: r# k7 y8 f( A/ w) N
else
1 U9 Y9 T0 m  c% across_marquee.style.left=marqueewidth+89 d/ e% i- t0 ~2 i2 P

' }- N7 y0 S- y. n+ p/ E, {}
+ d8 u2 g6 K0 Z: Z9 ^else if (document.layers){
! Y9 r$ W. L# eif (ns_marquee.left>(actualwidth*(-1)+8))
$ u# {  ]& g2 I4 M8 `, Bns_marquee.left-=copyspeed
# U) Y! T* [* U7 D" R5 S" welse
& N! F; s/ c. P; a# K# x. Jns_marquee.left=marqueewidth+87 l% Z: q- w' z0 r: N
}* H, z- N! G# V) m. f& \
}
; Z+ L/ D$ Q! a( {, p$ W' F1 |% l; \: c
if (iedom||document.layers){8 j: l1 W. l( _* a* K6 W2 ^
with (document){( y% P; A5 W2 h! ]+ G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 ]! @+ k# E! k
if (iedom){. X- p8 o! n7 q9 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& {7 Y9 ]/ j8 T( wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ^! I) a" I  S- |7 Z% C  O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ p, J6 t$ z2 Zwrite('</div>'). U( o' j  H% ~0 _9 q$ l! Q7 |
}
, J; y/ F0 f7 D/ F: Z1 k, S" ~else if (document.layers){
% Y- _# r0 r1 k0 R6 m+ Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% m: u  u4 t! ^; i( O6 ]3 v  Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 Q$ w: P/ v6 @0 t9 X) e/ b! X
write('</ilayer>')
9 c& P% d% J! m7 A) S( i: X3 [}2 Z: w0 |0 ^3 e# |( R1 O. y
document.write('</td></table>')
6 B* x8 u: y% F- W7 a2 {" b}: @2 C8 C  H8 y( F
}
! M4 y: _  M8 ~</script>

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