返回列表 发帖

网页之跑马灯文字特效

//修改宽度. X% E$ R. G$ z2 q5 ^. J$ o' T
var marqueewidth=300
2 @0 ?( Y- f  m- n//高度+ S# b$ n' q, T5 s
var marqueeheight=254 P' Q5 V* Y; f8 Z
//速度(1-10)" V8 o9 O5 v8 I1 x! s
var marqueespeed=3
% Y  z6 x, N  f- k! I; D//背景颜色
9 M5 }! h& F: Z5 m. mvar marqueebgcolor="#FFFFFF"
$ M5 f. }7 {7 Z: W//是否能暂停 (0=no. 1=yes)?2 m+ F, D+ g2 W  B
var pauseit=1
6 T# Y# ?9 G) ^, P8 Z2 J
! \) Q' C# O7 B' _7 Q. F0 `, d- a//修改显示内容& {& N7 L, M2 ~, o( J8 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 I2 W0 V; Y5 }) A1 X( _; q

6 x" ~0 L; b* s) [- A% ~4 ?  \# K3 o5 f+ m
////下面不需改变////////////
! `: I9 m+ [% Z4 Z- v/ t6 c% l6 m& |' A: e
var copyspeed=marqueespeed
% T" k1 d0 u- F$ p. J! t: lvar pausespeed=(pauseit==0)? copyspeed: 0
1 u% p2 {2 ]: c0 Q* Mvar iedom=document.all||document.getElementById
7 `9 a: F$ J* v; U8 Jif (iedom)
) ~4 T% L* r8 g; C( ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 d. g8 r2 _, X& c! q/ c
var actualwidth=''9 v6 g" p7 k; }* l$ l" d
var cross_marquee, ns_marquee. F9 [* D9 l- }

% l" W. c( ?" y% f% j# z# P% afunction populate(){, m: M+ h4 {) W
if (iedom){) X' l$ N( R1 t2 S8 O" m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 G; u) F7 s$ ?' X. l
cross_marquee.style.left=marqueewidth+8
: I7 _0 v8 }8 l# P! c+ |cross_marquee.innerHTML=marqueecontent7 E# H4 I2 R$ h* @; D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' I( |) r$ g; o
}
6 \' a! ]6 ~( @9 A0 Z- P5 N/ m! Welse if (document.layers){1 B' y* n1 d% z$ K, o
ns_marquee=document.ns_marquee.document.ns_marquee2
; g! V3 D2 S# Mns_marquee.left=marqueewidth+8
0 K8 b+ I" o- k- L' Kns_marquee.document.write(marqueecontent)
( ~- W( b( m& p9 k+ c$ Yns_marquee.document.close()
; M7 ?9 F3 e4 T/ cactualwidth=ns_marquee.document.width
5 W" V+ K# }! V" ^3 V- o1 ^}) b) {& W( ?9 @% ^* h- y
lefttime=setInterval("scrollmarquee()",20)
% i, l! u! B+ B}
1 f! H: I  b- h5 Q4 Dwindow.onload=populate% t( B2 [& s) O% f2 F8 x
/ G! Q% f- u8 q% d
function scrollmarquee(){7 A  Z8 r' X! r4 h/ s( z8 T
if (iedom){
5 g7 F  s8 P% m1 \5 ]5 ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 V, o  N, h; D3 `  Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ `* k* Q6 `4 M! [, U  Kelse
+ J# |9 N; U2 hcross_marquee.style.left=marqueewidth+8% N. |) ^, i/ T& [
: [# \: `! z/ c0 A
}
/ f6 L% x( S$ t. B1 \! q% o& ?else if (document.layers){
& F6 {# Y  N' Eif (ns_marquee.left>(actualwidth*(-1)+8))
7 \9 B7 v+ V2 H+ \  c7 Dns_marquee.left-=copyspeed
, k0 _8 O# N% b  T* v& }$ delse
% N+ M$ Q. X# G/ s5 ^ns_marquee.left=marqueewidth+8
0 K8 Q) ]; e: D  S; r+ L) Y; I; j}
! n5 Z( q* j' E% V5 @1 `& u}
' g% [. Y+ X7 Q( L
1 V3 `9 t0 R8 u$ i( Qif (iedom||document.layers){$ b$ _1 M7 P/ e' i1 _: J
with (document){% o1 Z9 P/ s7 ~2 f9 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" G3 G/ o5 R; ~+ F9 b' J& s6 ^if (iedom){
. S* ^! v0 ^: O6 p+ D6 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% d7 ?- S1 g- F) c% D: j& ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. `* Z' ]$ a) n3 M6 y/ s# v! Y& awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 }) R: T2 `& j- S# p% Iwrite('</div>'): L' I$ Y/ g$ H
}
0 v# m; m; l0 E3 T* y0 delse if (document.layers){
4 O" h0 K( z# R% r5 M1 W. h! owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: A, ^5 p  ^4 k+ A) s1 |* a; L/ U7 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); e% d0 l) ^+ K' N7 C! W% K
write('</ilayer>')
+ e( y9 O7 f% O8 f: a}4 Z9 k* H& t+ @" a
document.write('</td></table>')1 S; ~( j; E! K1 G/ H2 i
}! C3 `( S3 j- m- o, p& Y5 n9 h
}  _% m& x* n! ~! g6 m
</script>

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