返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 @( D3 Y2 ~$ J% F9 _
var marqueewidth=300( j9 k+ i( K$ }( l
//高度
; N( p* T8 x) C* Qvar marqueeheight=25% k2 G8 ?8 Z, W5 s* s
//速度(1-10)# g& n3 f- }8 n. u  G
var marqueespeed=3. T& y9 t4 q/ Z6 @
//背景颜色  F$ j0 l( a; E8 N  M* K5 \4 D
var marqueebgcolor="#FFFFFF"
6 y9 H# Z. Y# c  b9 g//是否能暂停 (0=no. 1=yes)?
, F7 i7 c- m9 X  ]2 E0 M1 Gvar pauseit=1# I  ^# U/ n. Y" s- X
1 n! m* b! K9 x( A
//修改显示内容! z# Q- z8 W0 P1 C: Q/ W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 H& q  `  X, R& ?9 [
' ?* t5 i: {6 g2 \2 Z* X

) l8 l& ]/ ?8 B9 i9 d. w1 c5 _" x////下面不需改变////////////" E$ a) ^! h4 U+ J* E: g$ V! P
! [, p9 r5 y/ m0 Y  W
var copyspeed=marqueespeed
, X/ d) \4 E5 vvar pausespeed=(pauseit==0)? copyspeed: 0
0 M$ Q( ^* K; O; {; {var iedom=document.all||document.getElementById
5 o3 U) Y; H0 u5 V9 Zif (iedom)6 `' N* Y$ ]2 C  K- c; ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), K3 j# |2 X: x% k* c# ^  j
var actualwidth=''
  P/ \! G) \7 |% ?var cross_marquee, ns_marquee$ K" m. b; ?( x- U* n

( _6 l  F" A3 D' o# Zfunction populate(){/ B9 }; l, D# _6 @7 z0 q+ t- j
if (iedom){( C& l' a, O2 c; }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( f3 H5 O: i5 H5 ^/ e3 X
cross_marquee.style.left=marqueewidth+85 {, T% u- z4 p% k: c$ G$ N
cross_marquee.innerHTML=marqueecontent' l0 H: T  U; v9 u4 L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, a1 ]- N! p& Y6 ~
}
! l: ^, M4 m/ G" Z; }7 M  p8 Oelse if (document.layers){
9 f$ p% m$ p) Hns_marquee=document.ns_marquee.document.ns_marquee2
. j$ a, g& z# P' s; b2 z+ [; A7 ans_marquee.left=marqueewidth+8
2 i$ [' ]3 R4 @! t' e+ [* Pns_marquee.document.write(marqueecontent)
( r: r3 j; C6 C8 i" ~ns_marquee.document.close()
2 R6 z) {. l; i7 J" Y$ Factualwidth=ns_marquee.document.width
# y% g+ V. }) W* h' h1 n8 ~}
7 i* I4 O: b3 q# y7 ^7 }lefttime=setInterval("scrollmarquee()",20)9 a1 j6 J- O: L; Z! ~
}  ~" Y3 V( O& o' r; l/ O
window.onload=populate$ g2 G5 `4 W! n! }' r

$ p! k7 A- B& O" N5 v8 w3 f3 ^function scrollmarquee(){  ?9 a, S! r( O- n
if (iedom){
* p# _# x% P! Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* m+ P2 N9 t, X/ x3 \% G9 o. y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# d! ~( \0 g- R7 c
else
# y2 o& @7 c/ Z1 W0 ycross_marquee.style.left=marqueewidth+8- N- u7 `; L* n6 L, O3 f
( ]9 Y: A5 C: S8 \% m
}+ F3 _" ?9 M  R, K0 h
else if (document.layers){
9 T" \7 K: y, L) G5 B" S9 Oif (ns_marquee.left>(actualwidth*(-1)+8))
, M0 i& D) \+ c1 z6 R: R. {. p* l  zns_marquee.left-=copyspeed% j- W; |! ^/ \7 T: l* F
else
. h! v$ p! L# T( q+ f- Jns_marquee.left=marqueewidth+8
% h* @$ w" |* v) K}
0 w' L* z& @) N9 `/ x( E" j6 K! s}
6 o) \- ?2 [( s# B( \! Y
" V7 I' o  I( Z1 H" d' jif (iedom||document.layers){
. ?2 b0 r5 K; K# Swith (document){
# B4 I6 C3 E( f% m/ o0 {( Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 p) U8 c" C* d0 x1 eif (iedom){
/ R7 A2 N) ~, n! u2 R0 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 k* N4 z. g2 }4 S/ h9 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  f: G. L) [6 p, s. s2 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. s" E4 a2 E  T3 X) \write('</div>')
1 K8 y8 f+ M* S4 q}
/ c8 T2 u7 J% ?7 I8 a( J4 F1 Celse if (document.layers){
. {7 J' N+ M, ^/ }0 w: owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& ?, Y* X% a& z. D8 C# V$ Q# e4 d; y9 vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ Z* o3 J2 W2 n5 t+ x1 I3 a1 O. vwrite('</ilayer>')+ D, B4 W: |; e, ^: C
}# l# t. t' z+ ?% S+ ~: m: Z
document.write('</td></table>')8 e! ^& _4 m! K5 {- B
}) Q# U, B+ T; h% P2 J* W
}
6 f) K+ `8 I* z) R</script>

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