返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" v* Z3 z% F8 p5 R- m  d2 z5 svar marqueewidth=300& a1 b5 i' h. s8 V3 C5 E2 C
//高度  ~3 q7 ^% p8 H; i, V7 N
var marqueeheight=25
+ ]7 ?. }/ D2 K/ O8 z% h//速度(1-10)8 C2 a4 |. F- v0 t. ]
var marqueespeed=3
7 N# x; f5 z* @6 _# `4 w//背景颜色* }! u5 r) l# s) O
var marqueebgcolor="#FFFFFF"
& v8 e' D1 j" d9 m' s  A//是否能暂停 (0=no. 1=yes)?% e) b0 [" ?: r" }6 n0 O6 g
var pauseit=1; V, F* j( g) f3 u; e) f

0 k4 j- |9 R* c4 h/ }. w& A3 }//修改显示内容- x1 j& v+ r  b9 y5 R+ h4 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', \  _# J( \! r+ g

. g5 i* h+ b% ]- y2 e! ^
1 d9 w+ d$ t  j7 a////下面不需改变////////////
& L4 r1 @* F$ {8 L* E* u( M+ r% g; f$ p8 s1 g
var copyspeed=marqueespeed( Y1 N* C* H# W4 G5 n" S( X
var pausespeed=(pauseit==0)? copyspeed: 0: ?; ~" X5 I. z! D: V3 ~: b  T
var iedom=document.all||document.getElementById7 J* L7 X3 e/ z' R7 J, b8 n; k2 x
if (iedom)2 ^' f% s/ x$ Q- |; p' t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ B  c* G) T& B/ I2 {( |: Nvar actualwidth=''
2 ~  b4 m3 @! u( w3 V5 V4 ?var cross_marquee, ns_marquee9 y" ~  a" q2 r2 z& `( e; k7 U& d. k1 x
# D9 {! v: s) Y! j
function populate(){3 f, C" J+ T& E) F; `( T$ b
if (iedom){( A' b8 H! J9 g. A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( S- M  N  S6 d( @( E
cross_marquee.style.left=marqueewidth+87 ^$ R! G; H& A
cross_marquee.innerHTML=marqueecontent
( ~* W. _" {" u4 Q1 _/ R+ q1 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# o4 T$ ]7 }" ]3 _9 f  e% F9 u5 t}7 W9 P2 L4 W" Q; `
else if (document.layers){
# |4 n4 m8 g. Y! ~ns_marquee=document.ns_marquee.document.ns_marquee2
; k$ ~1 T4 r+ ]' Cns_marquee.left=marqueewidth+8
1 O+ r7 V! [+ k' c8 Ens_marquee.document.write(marqueecontent)2 H. ?+ l. x1 b. X" e, T
ns_marquee.document.close()3 i$ U8 \2 `# V8 X2 s! ~" [+ a
actualwidth=ns_marquee.document.width0 e, C5 e9 e1 `# @: k% X
}4 ]8 {: \9 Z% B0 Q6 p) b# F$ Q
lefttime=setInterval("scrollmarquee()",20)" @3 w4 x$ h. H5 }
}
3 R8 O7 {- w4 ^' p+ ]- ]window.onload=populate- ~4 Y. T2 f% I% _8 w) h) {; Z
4 _3 K1 l2 S: P, M1 O
function scrollmarquee(){
2 F* m# n6 V1 w5 f1 n# w1 ?  fif (iedom){
  r  Q& R+ Y( M5 f3 N% hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  _& e; Y+ @: ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! r6 w' j1 }, y
else
* {7 o, u( ~% H; t3 dcross_marquee.style.left=marqueewidth+8
6 _4 s: I# j+ r! f) H" S+ p* G+ e: f, Q
}
7 B: L2 N2 t9 y9 }7 |& W5 o2 }7 Celse if (document.layers){
; V% j9 ~$ Z+ v" r. X! O5 g' X$ |. Uif (ns_marquee.left>(actualwidth*(-1)+8))
4 A6 [1 b% F6 N3 Z4 hns_marquee.left-=copyspeed  b( P8 N/ Z" Q* x7 n3 x0 `9 [, a$ j
else
2 b2 S  z, L+ b* x7 p% l7 N6 ]ns_marquee.left=marqueewidth+8
1 O. Q4 p0 [3 M5 g: q5 M}5 @. |, r: h6 Y/ d( A6 w( j* w: o' W
}1 |: m- T! z: e9 i

* P; U) e) ]; G: Fif (iedom||document.layers){+ e, O( n5 o: ^0 f
with (document){8 f$ V7 |9 W) ^0 b) S! |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 [! I' d1 J/ @# I2 X% Qif (iedom){# V( M3 V& T" S, \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 n( o1 c$ v5 h; c, c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' l: L* F9 u. D- Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 K& w1 M! X- E4 b2 H3 b  S, s! M
write('</div>'). D; c7 z" q! r
}1 t6 q  c. \" U  g( T7 I
else if (document.layers){
2 Z7 n! [& ?# Y& Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); b( i5 N# j2 K2 y6 m( m3 @7 z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 k# _* ?3 t2 P/ I: q0 ?write('</ilayer>'). a5 k2 O7 X) E
}
& B9 C$ `* m" xdocument.write('</td></table>')
8 t! }  r, }2 \  K8 c6 R0 ]  L. Z}
* C% X) S, u' _4 F( x$ M}
, Q3 o6 I; p( ]5 X* e4 l- l% h</script>

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