返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- T& |+ ^* p( [8 o! g5 u, nvar marqueewidth=300
) T3 v7 O8 D+ N1 n5 b9 e4 ~//高度
% y& l; \' ]/ A* [+ P: T0 i! c& mvar marqueeheight=25
' v- e- \4 k. z5 E" d0 w//速度(1-10)# C& U& D5 y8 A) v! Z, P
var marqueespeed=31 p% Q3 o4 u) H* X9 w, U
//背景颜色9 g' q3 [; U7 S5 h- ~
var marqueebgcolor="#FFFFFF"
- @# ?- y5 S" V( \3 u9 a//是否能暂停 (0=no. 1=yes)?4 C+ O+ s' X5 r0 D+ @% m
var pauseit=1" ]+ s* U# S6 P. u- s; O8 v

  Q$ m! o$ Q* R% V4 g! H. [//修改显示内容" }5 H4 _9 }8 Q( e$ e5 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- h- I+ N7 U) h2 N3 E8 {6 ?
/ T: p5 |% v0 q% D3 A

0 X& s1 o1 f+ _0 E" a$ P3 R////下面不需改变////////////. g1 ?! j3 D0 a" H4 k. j  j
0 k6 o5 ^; M0 ]4 D& T
var copyspeed=marqueespeed2 h/ b: K+ X: `* n
var pausespeed=(pauseit==0)? copyspeed: 0
0 _  |. n4 p: S" nvar iedom=document.all||document.getElementById
2 ]4 a- T  _# fif (iedom): k4 d' W8 K' x4 n. W/ S# w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 X7 a7 C8 F: t( o$ x; S( Fvar actualwidth=''
' e2 F6 g9 U) z; Dvar cross_marquee, ns_marquee
9 s; Z2 t% [# \! l9 s$ X- w! @+ E# q( C4 U: d
function populate(){
6 \; k3 N# f- O3 Jif (iedom){! c# ]8 y0 ?; n( h! `& e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 y1 o7 {$ M. W# p
cross_marquee.style.left=marqueewidth+81 o. K. z1 c/ \8 \9 U4 C
cross_marquee.innerHTML=marqueecontent
; ^/ f" W( n) T3 b/ x* Y0 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; ^1 Z# M2 S+ g3 i/ `' D
}% @+ b5 ?. l. x4 {: a' O
else if (document.layers){
" @$ o" M  j- @2 U5 V( m) ^; sns_marquee=document.ns_marquee.document.ns_marquee2
( v0 d: ^0 a9 V- i+ U( Y# k; ?ns_marquee.left=marqueewidth+8
+ W, X+ o( q( r$ V) c0 |! g2 ens_marquee.document.write(marqueecontent)  s% ^4 L9 g- G
ns_marquee.document.close()
4 _$ v6 U& _% K4 N4 P; cactualwidth=ns_marquee.document.width! f" o+ a  G! E: R) f
}8 g, p8 `2 ~# f  r- j
lefttime=setInterval("scrollmarquee()",20)
  R; V% u: _" N}- X) @8 k* m  _( q7 e" r
window.onload=populate
/ b! [. V' f8 O8 j! r! V1 \1 @. @) u/ y) ]
function scrollmarquee(){2 ~7 O$ u( H% a4 t$ \9 W
if (iedom){' p3 W- [. e& S' l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): A1 J3 |$ ^0 @5 x1 B9 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: o" \8 `8 `, x* D% a* g6 P
else' M; k1 a6 p, v2 F" R
cross_marquee.style.left=marqueewidth+8
# R0 b) ~3 ^# \/ E) N
8 d3 a1 K# B* U$ V- w}& |6 G9 K/ X; R- G; [  B
else if (document.layers){
9 Q6 K, e- H% o3 J& Sif (ns_marquee.left>(actualwidth*(-1)+8))
9 x7 V6 v2 U1 c  s( Uns_marquee.left-=copyspeed7 z3 p" O( m, u; S4 \' K
else
, c% P5 F/ P* `- i9 i, |% Pns_marquee.left=marqueewidth+8
+ R6 T7 L& |3 r- v" \: ~/ B}
6 [# n5 e8 C" d7 I  v) V}
# X; i( J7 k% A8 C! i* I" t( Z7 H. `5 _2 A% Y8 e$ I
if (iedom||document.layers){
8 E7 ?* M: r4 ~6 |- H* X) iwith (document){* U; b7 g! l" E9 ^/ h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ n; A, |) d; E2 k( vif (iedom){
, {' v2 Z5 I+ I) T& O; q7 }* awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' ~$ L' `5 I, R: Z. ?" \" c7 b. hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), p, l% s" p/ U/ H6 i3 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" a6 L/ \& B1 b& O+ H: Z
write('</div>')8 S6 |2 J1 b4 o: l+ f9 k  z
}
  `7 L8 g* D& Q: O( r% aelse if (document.layers){' n2 A9 }$ A2 g6 b8 P) m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 a7 C6 L7 p: D% i! x& {. I! P( P, ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 V, ?& i- ?% N
write('</ilayer>')
* X) I$ ~! n* \3 L4 y) q}
' G- d- o' I% X! I- H1 udocument.write('</td></table>')% x+ J1 K( }9 o; `( l
}
$ Z1 o0 G& {# L5 h}
+ y, }0 B+ p2 m) j. \3 c8 a( F</script>

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