|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
9 D8 a, W7 Q2 b+ M# _9 z; v# A6 {var marqueewidth=300
~/ o n- T0 z: F+ P: V" }//高度
7 q1 M. E/ A: \% j6 ~! ~var marqueeheight=25
3 `9 e+ l3 j3 Y; c7 N) ]//速度(1-10)+ Q5 e" y* p' H3 k! Z6 w
var marqueespeed=38 v X7 h( E6 [3 i
//背景颜色
5 x9 [" I& f9 z" i) l+ ^) Y+ jvar marqueebgcolor="#FFFFFF"* K3 E e2 r6 M" e+ D0 K( g
//是否能暂停 (0=no. 1=yes)?; `' d: X7 B$ E( ~* F1 s) Q
var pauseit=1
" O# x# P) N. |: o) c) r
6 E3 I" q) I. H: Z, H7 L- j//修改显示内容
8 @; T4 y4 H/ mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( j( H+ `1 R) Y, |4 r# T7 B% J3 w
# q1 m8 a/ Z/ ]% `) E
$ N5 i7 ]* U( w- Y////下面不需改变////////////5 \9 o) u5 N D' j9 N
: p) f! X( S4 {- ]) i {
var copyspeed=marqueespeed0 l% v8 [! F0 @2 M$ T0 y' p
var pausespeed=(pauseit==0)? copyspeed: 0
% O% s8 a$ M2 w" Rvar iedom=document.all||document.getElementById
7 U+ T, p E9 O. q3 Vif (iedom)6 X* ^1 |3 B$ p# L) X# o# Q6 K: N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' Q5 o) ^( U5 l: y% u1 W6 Xvar actualwidth=''2 ` S( F; ?. g5 A* U+ g, n
var cross_marquee, ns_marquee$ A) J1 [4 q1 {% e
! ^* Z0 ^4 \4 s' t
function populate(){
- G! A' r! D0 ]0 m) tif (iedom){+ Q/ `4 e& z! q7 J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 h4 J! N7 [$ R7 g( Ccross_marquee.style.left=marqueewidth+8 z: o4 W- D8 ]9 o
cross_marquee.innerHTML=marqueecontent R7 G T) @/ D) \1 W) t r
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 l7 r) w) d% V; L' P& \
}
: ^% k5 [" p/ belse if (document.layers){7 B# q1 f2 k6 v1 k2 ~ ?8 r
ns_marquee=document.ns_marquee.document.ns_marquee2
5 ?7 e$ ~8 j; m2 G0 E* Ens_marquee.left=marqueewidth+89 U5 s5 l( m$ h, P! n- P* u; L
ns_marquee.document.write(marqueecontent)
; r/ Y; s, b& E/ |, H3 b6 R: O$ lns_marquee.document.close()
3 }% g, Q: P3 ?2 l5 ]! x/ k; pactualwidth=ns_marquee.document.width
( \7 A; s0 w0 T% T6 p) W k w}" z# J) K! m- L1 N
lefttime=setInterval("scrollmarquee()",20)
* ], T) S/ t9 C s5 T( W}
/ n q# d) B0 E5 u: o1 ?* qwindow.onload=populate
+ P) o% T/ Q- `$ x: \
. t0 h6 N" l2 g8 W# @! vfunction scrollmarquee(){7 X M+ N S( k7 u4 \" }# f
if (iedom){/ d- }4 P% n+ `4 S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). |2 o( Z6 P) X9 Q, m4 R3 o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' R: p: N- X) ~, \# zelse
8 o ?8 z9 P) M/ mcross_marquee.style.left=marqueewidth+8( M; U' b5 O0 f( a
0 q& b/ y/ N( X! U2 ~
}
5 i! n) y- m- y; x. delse if (document.layers){
" K+ o/ Q H' a( Rif (ns_marquee.left>(actualwidth*(-1)+8))
" y, M) b- b& R kns_marquee.left-=copyspeed
: S, t" x9 V! celse3 p: x- S$ d* U o3 k! I
ns_marquee.left=marqueewidth+80 s( k* W1 U' H& q) c
}0 I+ [& E% g! w3 d l- b; c
}
, f) m3 R% a) K! t+ \, V G s! q: c
if (iedom||document.layers){
3 A" b: S: Z& w: Nwith (document){* T' x# ?+ K. P8 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 z' R5 w" \3 S/ Gif (iedom){% Z8 ]; g2 @: Y( q9 I& N/ Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# o) M3 B2 b2 {! \+ V! k- E0 S5 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ` v% T; R% y/ d: N2 }' B9 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' F: Q$ S8 ]0 V
write('</div>')
7 V8 W6 `% Z9 S3 M5 n9 i}
3 m3 `( [6 l9 F1 lelse if (document.layers){3 l, R) d9 f9 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% D* G2 a+ j" J5 U# a: P# h4 Z. \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 b" V8 h# a/ z$ a! ]3 ~8 ?0 c- ]
write('</ilayer>')2 t3 W% ~$ o! k# H1 h6 C+ k
}
6 X7 y. R$ q4 W3 m/ Ndocument.write('</td></table>')
6 q8 n( F' o; B& V: j}
: Z. K/ M3 d) `' l% S}
, s# n0 E3 c4 R</script> |
|