返回列表 发帖

网页之跑马灯文字特效

//修改宽度. Z6 X& [; u0 }/ i! U$ q
var marqueewidth=300
* M# V8 L  H% d7 G3 @& H; T//高度
% S6 M- a" B* n$ @: N0 V1 Jvar marqueeheight=25
7 E: u7 x9 u4 q( t+ x9 ~//速度(1-10)! T- A$ ]. i  F) h- `2 |& e' O3 s3 }
var marqueespeed=3/ H: f/ G, G; D$ y
//背景颜色
% v! a' ?5 R6 j( z& g) j$ bvar marqueebgcolor="#FFFFFF". ^; o. {" n7 g) c* m6 T, h4 D* K
//是否能暂停 (0=no. 1=yes)?- d* I/ O7 P4 q( l7 @
var pauseit=1) R6 c" Q0 O% J2 M) o' M9 F( j0 n
! Y( b* i) k* b# ]) ^, i  L
//修改显示内容% I0 s4 V8 {# @9 I' C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 W5 E) m9 k, z( o. g" F7 H
# I1 Q4 x8 R/ m2 U6 z

# _) [; U6 i% @6 @////下面不需改变////////////
- w; B% h. ~, t( y- y
* v7 H5 @$ a- q) ?& tvar copyspeed=marqueespeed
. V+ S* C2 w' k3 Q; J8 B( E- @7 ovar pausespeed=(pauseit==0)? copyspeed: 09 ^+ Z8 A: a. N' d! M: I! K
var iedom=document.all||document.getElementById) ~2 N0 c: N: X
if (iedom)
' q5 N5 f4 H# v. z) c7 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, S4 ~" a8 S, ovar actualwidth=''& g) L0 |/ ?& @
var cross_marquee, ns_marquee
) b1 H2 \$ I; z( @9 b4 S) L6 v" H* z2 I
function populate(){
7 V1 ?4 ]+ g, |6 Mif (iedom){
  B. g( N! ~) A  r5 a/ v# o' ^& z" Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% c1 _6 ?3 C) N7 v; ^; M* `
cross_marquee.style.left=marqueewidth+8& U: E* R& W% j  `" w! C& x
cross_marquee.innerHTML=marqueecontent$ B% L3 b- Z9 h' u+ R! k. r- ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" K' n' A  q5 c/ R( x& p# T}
. q. I5 Q" Q/ G( p. S7 j& a3 J, M: W/ ^else if (document.layers){
7 T3 \4 E0 f3 \& |ns_marquee=document.ns_marquee.document.ns_marquee2
( [" P- r5 @% g' S  Ins_marquee.left=marqueewidth+8/ q7 m3 R& j# X5 w+ z
ns_marquee.document.write(marqueecontent)
7 Y( H2 f2 |9 yns_marquee.document.close()
' U  E( v- Y, Bactualwidth=ns_marquee.document.width8 J/ w8 z! e% X$ E
}
: l* B$ |+ e* k4 s  x) Z  n. ylefttime=setInterval("scrollmarquee()",20): z9 `# O0 ?: q! H: f1 A
}$ f4 c8 W( e- J3 h2 A( y# i  w  {% {! b
window.onload=populate
: B- S& \' F! [! \
5 Y  P- W% i' @7 f2 d6 Lfunction scrollmarquee(){
8 \. I' t: }1 [2 g! Z: F. R: x( gif (iedom){
" q! h7 ?; ~* c1 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( ^  i, Q+ u% L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 Y3 w- v2 a2 A* h
else
; P8 `, j, W1 mcross_marquee.style.left=marqueewidth+8- t" p4 D9 h& c8 x( W' _8 ]0 _7 A

/ w' u# O8 ~5 x5 Y}8 T( C  l5 D' G% o* n# L
else if (document.layers){, n/ x% ^8 G, A: _% {
if (ns_marquee.left>(actualwidth*(-1)+8))2 Q! \6 k" N' M8 U/ u
ns_marquee.left-=copyspeed
* y3 a4 H* u' Oelse
& A' n: u0 I1 i/ E# nns_marquee.left=marqueewidth+8
; c8 y4 G4 N' u) y}7 S  b* F' E! L# ?6 K6 l" Z7 D
}7 T6 v2 ?9 f' A) D+ T3 h8 l8 N9 Y

$ t* K( n' \7 u4 g% l# O! pif (iedom||document.layers){1 X% I) y% o$ c% I9 ?( D' G6 F- ~
with (document){
1 Y" O. g; D/ _3 I/ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- [* F, F$ E' G* ?if (iedom){5 ^, ^2 f2 b( ~' q% d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 ~! r( w: p  W) n) Q1 I+ wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& X; M9 u8 M( v1 @8 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 e( J! C, @" N% B) W+ kwrite('</div>')
% A( C: B% t. X4 d! [5 V9 Q) W}* c& h( p) H6 H5 d! h
else if (document.layers){
4 p6 W( {# [) A: O2 D7 L4 lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ P& A8 W" ?  x3 R7 Z2 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 Q4 b. x9 i$ F- W. s. O, |! i1 Twrite('</ilayer>')
5 |( [. c* D3 t, t& P5 y}; b$ A+ {, B0 G: Y+ m! H& X; G
document.write('</td></table>')
0 M# }( ?. @9 V, [! m}1 `' h' E: c; X
}7 I# s. z* X: `
</script>

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