返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% t( I( v8 d5 L) g  u( B% _var marqueewidth=300
  H- N6 q: ^# m# S  H# k* b) _//高度
6 D: v5 _2 a8 ?var marqueeheight=25( ?6 A( x# m: s8 M4 D& z1 J
//速度(1-10)# ~  y: C3 c7 j, U9 i* @5 T. F
var marqueespeed=3
4 q5 u4 g5 ^) D) `" u9 X1 U//背景颜色7 ^' i2 d2 |- W+ v
var marqueebgcolor="#FFFFFF"9 C( f1 ~( Y8 l) G5 I
//是否能暂停 (0=no. 1=yes)?
& g- p2 ~4 L+ V. c+ Pvar pauseit=1/ C/ ^) }8 o( }. g3 Q' c$ ?3 i- Q
9 W/ L* T8 c% D+ `9 U
//修改显示内容
6 b/ `6 Z+ m/ g. xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 w2 P+ r& f. ^+ X* p+ q& m
- L" s: r/ c$ C8 e) o, V& m% `

% t# }) P) a& p3 B////下面不需改变////////////! s2 j* _; r& T: E

* [8 a& b* T/ O% S  jvar copyspeed=marqueespeed
, B, |9 S: w9 cvar pausespeed=(pauseit==0)? copyspeed: 05 w' y4 X6 {( @( V" Z* [1 v6 S
var iedom=document.all||document.getElementById( w. R( }, c. t  g+ q2 {
if (iedom)! `- X2 W* A$ P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" a' f; `( X0 o) A. h% Z+ G
var actualwidth=''3 N8 P# w9 n  G3 i$ y6 r, e
var cross_marquee, ns_marquee4 ?3 c8 E% S0 n! v8 n
+ e. t1 S2 V" l0 i1 L* N+ G1 [
function populate(){
3 n2 |# l  x7 C  P% yif (iedom){
* A# s- Y6 y' Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ @, K4 z, ?9 F$ r+ Ccross_marquee.style.left=marqueewidth+8
: ^; X9 i8 \( d6 s! A- [; {/ F- ycross_marquee.innerHTML=marqueecontent7 w/ \2 F' w3 s) W, _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ z; U# ?; e' y9 o
}
, I+ U* A; d0 h. M7 c0 welse if (document.layers){* ^0 Q! \$ ~0 u( f+ B% Y4 [
ns_marquee=document.ns_marquee.document.ns_marquee2
! y( J& C- C/ ]6 X, V9 g4 Gns_marquee.left=marqueewidth+87 A1 j( a$ Z) c  B: O
ns_marquee.document.write(marqueecontent)
# ~; T# u" F# ]ns_marquee.document.close()
9 V) A7 M5 O: K$ G; p9 Aactualwidth=ns_marquee.document.width
0 ^4 F8 T1 A( U3 }# h* X# I}
6 G: I0 o7 [& T8 m9 g& Vlefttime=setInterval("scrollmarquee()",20). o4 ?7 m! A$ P& E2 F
}
8 k9 V/ g$ r: u/ w5 vwindow.onload=populate: u$ K, K0 u  L6 |5 G1 b" r

9 {7 `& d2 q, U1 ufunction scrollmarquee(){1 c- g: B9 ^. [% \! q, ~2 v' v  N
if (iedom){
, g: x: r# r" k$ a* `3 Z3 l. ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ~4 U6 P3 j6 Z& F% b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) C: ]- {, D5 zelse* b* K" X4 O/ `' ~2 N6 i+ E
cross_marquee.style.left=marqueewidth+8. M6 r2 j$ Z' a
# I; S9 k2 }& K, y" r. k
}0 d; G; S9 U& k) y6 n; e% I+ ]  X
else if (document.layers){" R' }8 D1 D* b5 p" d
if (ns_marquee.left>(actualwidth*(-1)+8))
5 d9 ~2 h( A) W  j6 M8 Cns_marquee.left-=copyspeed
) ~& T9 K" h: _1 Belse3 [7 n& I, d( a. u( O
ns_marquee.left=marqueewidth+8
/ |1 ~& Q5 H# \! q( ^}
% w/ x6 X! _  u}5 \4 `" M( e: n5 G
* f  g7 p- ^" i# r4 P3 r. A, x
if (iedom||document.layers){& d- {$ J% J) s# p. G% o1 J9 j
with (document){) }- s) n3 E- `& {* f8 n; q7 v/ l' X% |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 x7 s7 a) l( j$ S! Qif (iedom){( _3 I& s3 {7 ]' W2 j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, L6 }; c* p- X& w9 |" q" @# ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* A/ t8 L6 d2 W, |+ @; Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). o4 Z3 q1 q5 D! _$ {& E. _. |4 L
write('</div>')$ o5 F, w, b0 x; u% o; r# S
}8 N$ I9 B1 X: Q* D; [% y! u% ]! T, Z
else if (document.layers){
' F: M: Y( S$ u! U0 \- Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 a" M2 {: G* w% }3 g* m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 o+ K1 @" Z/ m+ T
write('</ilayer>')& i% i  d& g; a7 x1 C& S( G" c: q
}
4 K% f5 H9 H; i' C% Y8 |document.write('</td></table>')/ C+ r' j6 f9 @: N" a
}' r9 N" S3 |  J! O
}
3 M9 d: w, n% C/ [+ k7 E</script>

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