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

网页之跑马灯文字特效

//修改宽度
# _# N" `& _8 u9 D* ~var marqueewidth=300
8 h6 b9 ^+ l! v) v* X/ [//高度: N+ F; d1 |: X# R3 G$ R- k: k
var marqueeheight=25
* l1 O& ^3 v! t0 Z$ P- D) U//速度(1-10); t. Z2 D: k" Q( i/ d" i2 f
var marqueespeed=3
2 R! t5 d' T7 L( I//背景颜色& _5 _0 A8 m0 B/ g/ c; u/ j( P
var marqueebgcolor="#FFFFFF"
4 K& d/ U! {: R2 |+ X//是否能暂停 (0=no. 1=yes)?! d) N; e6 \( w  y) p! u" y
var pauseit=14 p+ d  C- z8 n; |/ T+ V! N
1 ]% }- f4 h' L. A
//修改显示内容
! Y6 }- F( k" Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ b! \; n( f) Q

5 ~* K; i* M& r" v; C1 q- G) e% ?' n/ r0 O" ?/ a
////下面不需改变////////////2 Y0 P9 U: V3 x& \
  E& y- y3 }9 d1 U0 R8 t
var copyspeed=marqueespeed
. {1 X' D& V. K& fvar pausespeed=(pauseit==0)? copyspeed: 06 v) B5 Y5 e& A9 K: t$ y8 o
var iedom=document.all||document.getElementById6 U% o3 ?, J( M! J& c% `
if (iedom)
! `" a2 z: U3 Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): p9 B& L9 V3 G1 @/ k; q) y
var actualwidth=''+ _5 S0 b$ b# c) k& E; e7 d- p
var cross_marquee, ns_marquee+ b; u; A) X% I( a, M& @
! G+ J: p" W; }: t$ _
function populate(){  M. {: {) ~7 X  z6 U
if (iedom){
+ V+ d% ^6 f0 Q3 `6 D+ |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 w1 R+ @) K. p) r9 E4 }/ Hcross_marquee.style.left=marqueewidth+8
* T+ L1 y0 J/ t) t6 I  E1 ]4 `cross_marquee.innerHTML=marqueecontent
4 j, V3 }0 ]6 p6 ]) xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 @' q5 D$ h+ W2 Z}
- n* v( l. Z. Oelse if (document.layers){
; N. i% c7 \: A$ j) g& ons_marquee=document.ns_marquee.document.ns_marquee2
5 c+ d- l+ C' S- M* W% \5 vns_marquee.left=marqueewidth+88 x5 w: P/ e; Q% d0 u0 r( \
ns_marquee.document.write(marqueecontent)7 O+ W/ \; P4 o& D
ns_marquee.document.close()
1 l7 v- N3 l+ Eactualwidth=ns_marquee.document.width
; Z2 p4 T$ K" p# H}
% g8 `, \! c+ k4 e/ Rlefttime=setInterval("scrollmarquee()",20)9 P4 Q* ]% {, K
}
1 }# S, D5 ?; J7 H$ Q/ J2 m9 @window.onload=populate9 R/ [3 y& F4 u2 |" K

% f! t4 B6 y  {function scrollmarquee(){
( ^0 `- S0 R, X; G5 d. `4 cif (iedom){% y8 O# `/ O7 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): H# g6 {: y7 `5 U/ e/ i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ E  ~' y  ~8 b" u" z5 l$ [. `, Z
else
# h2 N# P$ Q6 A, {; p5 D& Vcross_marquee.style.left=marqueewidth+8
7 g7 C- c. z1 u9 @( A' |0 @3 p. S+ @/ T8 X% R
}9 W' c1 n; Q  q$ ?
else if (document.layers){9 S, I: I7 K/ j" Y$ P3 s( q( u! ]" c
if (ns_marquee.left>(actualwidth*(-1)+8))
1 U8 _- L. |" x  S& kns_marquee.left-=copyspeed
7 M. N; k0 x# G4 C5 f& B" Yelse
0 }1 H" F+ j# |5 K& u; `7 V1 B/ jns_marquee.left=marqueewidth+85 a8 \- {* T7 n, G
}
: J! a9 ^" g. c: K* n}' k5 y. ~1 [0 V2 _* ]+ ]
% n9 c% b) {: W+ E
if (iedom||document.layers){, ~" o( Z: `( M$ s! {; c
with (document){1 W1 `- g! s' V  N' r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); K; E8 I" Z+ I# j+ ^
if (iedom){
& U, F) z" S4 |) w2 swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# Z% H. `8 y0 D* k' }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" \5 ?9 b# G2 @* W% H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: |5 A0 R6 C! X! q, W% Z9 bwrite('</div>')
& G  \% L* d( }) g}
; a8 ~& w" r7 z, xelse if (document.layers){. |. D3 |1 z( z- |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ i- `8 A4 [+ G3 o$ f% z0 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 J$ O+ T4 c$ d& I) k5 a, L3 Rwrite('</ilayer>')
5 ]' _4 d9 I3 |5 j% I}
% F  y+ O9 Z! `) p/ ^0 g4 C: d2 Tdocument.write('</td></table>')
' X  M" ]$ f: {) G) c- X1 y+ K}
/ d  L, p; E" r% a, Y1 J}; f# d/ X1 A8 p6 K6 z5 z5 z* e) q( I& o
</script>

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