获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度- m4 J! b( Q+ s$ o
var marqueewidth=300
+ ?$ c" m+ A; o0 p//高度6 B( G  J/ S5 `9 W
var marqueeheight=25
; ^; o( C, g5 K4 ?//速度(1-10)
0 ~. m. d. g; T2 a7 v; }4 n9 Xvar marqueespeed=3
% a: }  d# n& y, Q) {" B# }  ?! T//背景颜色( h+ E8 k% E5 [& y0 B/ m
var marqueebgcolor="#FFFFFF"
" Z1 C2 |$ h+ J//是否能暂停 (0=no. 1=yes)?0 S% s0 M$ u" l' @- O
var pauseit=1
2 {* Q3 ^- j1 d5 X, o/ u. @. K6 C/ x! d9 D5 l
//修改显示内容, K( L; {1 P; D+ a0 {' i  Q3 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 ]2 T7 O! i" D/ T/ T4 A9 X
: T5 |' \, f; u( f& c+ V9 v3 |1 X. e7 \, V) I4 B
////下面不需改变////////////
1 ^3 A1 y' P! v, d' |  c8 A' f) }, @+ Q/ b' d
var copyspeed=marqueespeed
( z$ P4 E% w, n: ovar pausespeed=(pauseit==0)? copyspeed: 0
6 I2 M1 z' I4 T8 cvar iedom=document.all||document.getElementById
) w9 N! Y$ L) C2 W6 g( uif (iedom)  E" V4 A% C$ O- C* B4 z# L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* C  D4 M# @! m0 T( }3 k; e8 \var actualwidth=''
/ m& C2 k8 g" O% ovar cross_marquee, ns_marquee
/ L7 k' c& b" q  R0 [: Y" A. S3 m. D" ~2 g) `8 O* ^7 }& G+ ^" c' c( S5 O
function populate(){
2 L- t1 `6 s0 ]' M1 k0 L; c$ aif (iedom){7 _' Q& H' Z: w4 w, Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 t9 W0 C, P* hcross_marquee.style.left=marqueewidth+8
1 s/ v* k: c& \+ o8 j2 O& ocross_marquee.innerHTML=marqueecontent1 I. m2 C  x% P7 d5 b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; D# z+ t- `9 J4 l5 J: F! D
}. V% f2 r  s5 t
else if (document.layers){
+ d+ X% ^# z) s! S) Dns_marquee=document.ns_marquee.document.ns_marquee23 g) }, L) I1 y0 q, _4 j
ns_marquee.left=marqueewidth+8
2 e% z" r4 H9 F  o. I9 \/ yns_marquee.document.write(marqueecontent)
9 @" U$ ~9 ~' t" v2 Dns_marquee.document.close()
- b4 p: c4 j8 ^" E6 k# m3 }actualwidth=ns_marquee.document.width/ M: g3 V. G/ s( _8 I7 C# R
}. T7 V$ T* _. n3 \0 f
lefttime=setInterval("scrollmarquee()",20)$ F0 T: [7 H4 D) }- E- E
}" `  l  i9 w$ E9 n% g2 ?7 S
window.onload=populate
1 _2 ^  X) J1 G6 @4 I1 V. D4 ?
" O2 s8 \% d, m4 Cfunction scrollmarquee(){4 \; n$ g0 V- _4 B3 @. v0 G
if (iedom){4 G7 J" c: o& v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( ?  k. y0 B, H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' B6 `" B# w- y6 N& X3 S; D
else0 O, P3 {3 h. }  R' A
cross_marquee.style.left=marqueewidth+8
! w" U$ x& e2 y; f, N) A0 u8 R8 }. k% B: s2 p5 c
}  o5 e* ~5 U9 N# o; s, m# }9 g- Z
else if (document.layers){4 l: B% w/ e& C0 w1 z1 z
if (ns_marquee.left>(actualwidth*(-1)+8))
( S4 |+ C  t8 Z5 O; O& z# |ns_marquee.left-=copyspeed$ T% L$ j. b0 {3 t/ o3 q8 g
else
9 q4 U2 u. G7 t$ c/ H: w1 [ns_marquee.left=marqueewidth+82 r: M4 z7 H2 c- F
}0 G& d5 n; p2 ~; e) w
}$ b$ _% F" r/ u9 O3 b

) k3 h. u) Z( V4 o. Qif (iedom||document.layers){! O! A) e. L! V0 k* }$ z2 w
with (document){
4 ]# n" W+ q, a6 H) Z: odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# K5 h( K0 J8 q' n' B" v
if (iedom){  I+ `- y1 h: \$ |- l$ f& d/ Q0 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 _$ k9 o: C* n5 ~! w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" S5 a  L7 a, w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); j. K$ k' A0 d- B3 t
write('</div>')
, t& {4 w6 l, k7 Q2 D. P1 [: N}) r2 C, ^$ e' r, x6 w8 o
else if (document.layers){
9 r, w/ T$ O6 X9 X1 O" r; Q1 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- r* D% {# v4 @: Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 V9 n9 _; U% o7 q/ qwrite('</ilayer>')
. i7 ]  O8 c) f8 h* H}
# S; O3 P0 `' c8 \/ n# jdocument.write('</td></table>')( w9 j% [3 m" d% q& H2 y
}
: c2 ?1 O% u9 H( H}
" f+ H( T2 X/ U" ^, l</script>

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