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

网页之跑马灯文字特效

//修改宽度7 }3 R2 H; y" ]: e: D
var marqueewidth=3002 P6 N$ s& A# C' Q% [
//高度4 B) {' d+ {* n; u/ ~
var marqueeheight=25: F7 c! a+ d9 w0 S2 J/ V
//速度(1-10)
. L8 X: X* A" {: t& K' Z7 Cvar marqueespeed=3
. P4 K  }  \: a2 q//背景颜色
6 B( j& O; W$ }% G! d( k( zvar marqueebgcolor="#FFFFFF"3 @( ~. P+ X7 u" @$ A% U/ n& N
//是否能暂停 (0=no. 1=yes)?! X' ^5 l* h; j: h  x
var pauseit=17 u8 g$ U% _2 s2 J

0 }. K2 c! C% @  r! z//修改显示内容- D) ~# U" m1 O  q. B( [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ N8 z8 S! I, J$ K0 J+ W/ z
% e: u" h3 T9 B" j# ?' G3 D! F6 M3 \- ^: a
////下面不需改变////////////) H5 K3 N" I3 Y" o# F. a% v
0 z% P7 u! V& m) e6 _  O) l' o
var copyspeed=marqueespeed
. d$ b& k; d" mvar pausespeed=(pauseit==0)? copyspeed: 0
( K2 n% u9 ^2 B7 t7 fvar iedom=document.all||document.getElementById
0 U) L  ^1 w/ _. l3 L2 K& vif (iedom)
2 i  M% M2 l9 G! y7 X% Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 K5 m( h0 s1 v8 m
var actualwidth=''
: `2 ^6 h0 G- _8 H+ k9 o- {var cross_marquee, ns_marquee( W; q) M. ~5 x# d  E) O! z

9 W* r$ ~) I/ Z. r; z% l5 Bfunction populate(){
9 L1 J8 B, n% \if (iedom){2 }# J# C- c8 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 u" ]& F/ d1 Ucross_marquee.style.left=marqueewidth+89 b. i$ b2 X: R4 S/ p, J
cross_marquee.innerHTML=marqueecontent' c0 S  D; X  Y% e9 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- U! ~& [' s% b0 T! J$ j
}
7 e! k6 d5 \" F+ b( W" c  Uelse if (document.layers){
/ [5 W9 b. Q9 Mns_marquee=document.ns_marquee.document.ns_marquee2
- B, m7 G  k& \ns_marquee.left=marqueewidth+8# R. e* l/ |& b" C2 k
ns_marquee.document.write(marqueecontent): F" e2 \$ q/ \/ t6 O9 k' r
ns_marquee.document.close()
6 r6 o% v$ [6 I5 c7 Nactualwidth=ns_marquee.document.width9 ?& b! |9 ]/ x6 H* s& B) G, _8 J
}# s! ]& J' E5 B. R
lefttime=setInterval("scrollmarquee()",20)
, P5 Y4 k# z# b7 A* r, B) u3 l9 V}# M) M- i9 w+ r$ @
window.onload=populate6 w! E+ _, s/ [

! p* O3 Y6 D& M9 J- qfunction scrollmarquee(){
& c+ C' R9 `- J/ eif (iedom){4 A8 h( S# v& i8 D; N) m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' ]3 H4 B7 Y. E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" c5 d& F4 I' ]- Velse
* S, B8 N1 u. b$ s. V4 u! }cross_marquee.style.left=marqueewidth+8
) Y8 r, _9 f. E3 m1 L& s6 c) \4 T. o" J& Z9 x& x& R9 G
}
4 h5 c+ C1 f. Y: _% Z9 belse if (document.layers){
% b2 ?6 t4 T7 P" W( @0 O4 n% aif (ns_marquee.left>(actualwidth*(-1)+8))
6 T3 s( F5 x8 k3 ~" p. R7 j  n% q# xns_marquee.left-=copyspeed+ L6 u; y6 [0 q) f( W
else' V' U$ F3 A2 g5 E. W8 @
ns_marquee.left=marqueewidth+8
9 a9 E2 w& H# i* y, Z. k}8 d9 Y; ]8 k  Q3 x8 K" I) a
}
8 X$ \6 _3 |& F( a) z
  ^, }$ g  E' p' W2 t3 Cif (iedom||document.layers){6 q" b; l8 I1 a& O+ E
with (document){
& N; K9 E9 @- Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- R5 V) t1 F/ n+ e4 P3 s
if (iedom){
* R* B+ D% O( G/ V1 d+ Q5 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 R( G0 g' z8 |7 L2 e& L! G- Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 S% f: b; |' |6 y; a: o8 @$ q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* i# h4 i' ^& L8 e' Zwrite('</div>')
- ~7 w7 L4 D: p}
- @& L9 @9 Z6 Delse if (document.layers){
  r6 H1 F& C1 R( {6 o0 Y. ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); i: l% Q' K5 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& x8 o% S! r. ~write('</ilayer>')) B% P4 w" G7 \+ x$ f
}
7 r) D2 p/ L5 D% P8 |document.write('</td></table>')
' Q7 V7 S; A  N2 c. U9 `}, C$ o; P* ?1 O2 V- X
}
8 \! U7 Y; X( Z) G0 f9 S! g</script>

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