返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 D7 T0 I8 k# a. W# D! Wvar marqueewidth=300/ R$ s* s  U, M  {( Y
//高度7 J1 w6 w1 {1 H6 T  S7 i
var marqueeheight=25' y' }/ b0 F5 N1 y% B
//速度(1-10), [" `% _* e& i/ m: {2 N$ X& N0 ~
var marqueespeed=3- l/ N0 f4 u, q+ K6 q3 ]% z" y& I
//背景颜色  J3 u' L  x) l9 _1 v
var marqueebgcolor="#FFFFFF"% [. A- _7 ~9 o$ S0 N
//是否能暂停 (0=no. 1=yes)?
* a5 Y4 ]$ R8 gvar pauseit=1
/ @" ~  J1 M7 B  ?1 D( d3 a- Z9 u
4 j: d" F0 J0 x" N$ X//修改显示内容
% q0 r  P: Q" R  E  cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( J( h% O# O! s, k. F# [7 Q' f; i' h+ I
" g5 M( f/ p0 Y! N% I
////下面不需改变////////////
, B1 V8 n- n9 ^4 `! v" u0 D( e0 {2 R0 h: _  B: Z9 x
var copyspeed=marqueespeed
( u- v% z  g  B/ Xvar pausespeed=(pauseit==0)? copyspeed: 0: S+ z9 a, l! H: }0 a
var iedom=document.all||document.getElementById
( i( q. e4 P# w% D% _6 Y9 Z0 eif (iedom)# B* i" I) @& o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! ^% r5 D& J/ K" w& D" T
var actualwidth=''4 c6 b# b2 w7 ?, K) V/ y2 Z
var cross_marquee, ns_marquee
! P. U4 Q+ h0 Y
; ~$ n8 T. |3 vfunction populate(){
! g4 K$ ^' w5 l, oif (iedom){
8 D1 ?1 Z: r. R4 Z2 r" p4 _! h! Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ a" B; H  p* A3 c, Hcross_marquee.style.left=marqueewidth+8
) G4 g# h1 w' fcross_marquee.innerHTML=marqueecontent! E5 v5 I) r% R" P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  l3 `5 T! V! w  S) W
}6 Z, R7 d- Q, |+ {5 P
else if (document.layers){
/ z8 {% k9 J6 u- @. B7 gns_marquee=document.ns_marquee.document.ns_marquee2" a; T4 [# d  u% M8 H8 s
ns_marquee.left=marqueewidth+8
6 J  D9 g+ m0 @! tns_marquee.document.write(marqueecontent)6 [2 ~: Q- l0 E4 J
ns_marquee.document.close()
: I6 d: z) S( K# K5 F7 `$ a. Y/ Pactualwidth=ns_marquee.document.width
6 W1 {0 T/ K- `& A- d}
+ `+ A3 {% d# H. A: t8 |/ H1 Blefttime=setInterval("scrollmarquee()",20)# ~- e& H3 Q$ O8 [* X5 }2 \
}
6 ^+ A- M7 ]0 U) _/ C8 iwindow.onload=populate/ f2 M+ O: c/ Q- k- j) _7 W

+ N6 N  e" N# y& }  p3 z0 W" e5 zfunction scrollmarquee(){
7 J2 g& {  u5 Oif (iedom){
' q3 j$ L5 c+ H0 L, Q/ o) N5 M5 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( `/ f. S, t; X# E) F! P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ B# T* @! y& G0 {else
" u* Z' n# n0 W, I0 ecross_marquee.style.left=marqueewidth+8
+ R) Y, Z% l$ h9 S& U, }' R# Y
$ z$ t* w3 Z# k7 C8 c}7 a/ T, ^7 p' q( \$ z# Z5 M1 r
else if (document.layers){; F) D) p4 R7 u. E! K; ?- Z9 A. E, N
if (ns_marquee.left>(actualwidth*(-1)+8))+ }* U  ~1 E( L/ c5 `$ C" d) a
ns_marquee.left-=copyspeed3 C$ p/ z' P: N+ E0 o3 S
else
) U& Y/ M& \! ?ns_marquee.left=marqueewidth+8
& W$ |& f$ P* l" k3 t}) Y" h2 k* T" d7 m) o
}
) \2 P; r- o% C; V1 E& l1 u4 r1 V+ |: f9 @' ]$ I
if (iedom||document.layers){, G5 ?& G; A. h1 n2 g5 D# A
with (document){  U) I8 C) M1 U( s9 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) A0 |8 h, l' S7 Q; W8 @. {4 n# R) K- ?if (iedom){
, Y, [& n: ~- Z* g3 ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 |+ @0 N9 t: b8 |+ ?* s) Z# bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ~  j3 q6 ]& c/ x5 X% Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 s0 F9 r( ]/ |+ A6 W
write('</div>')
) y6 o4 |+ B' a$ U- ?3 T}
: B1 G. M2 s4 H4 I. ], W  o+ Helse if (document.layers){
5 B2 O/ \7 l5 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# g1 T7 ?+ E) X) s, e0 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) Y$ M' G# T* \/ }0 i4 p9 R' n6 \; kwrite('</ilayer>')
) @6 T$ n" F5 e}
5 q1 u5 O  M( L  f! mdocument.write('</td></table>')) f9 E% Y; V1 H/ M+ O0 ^
}1 }; a" V/ H& \% r0 |+ _) b) f
}5 K0 p7 x" q7 m( T0 C8 E5 c
</script>

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