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

|
网页之跑马灯文字特效
//修改宽度% N# C# g& T O- ^# n
var marqueewidth=300
. E1 r3 Q( T0 N//高度
! t( |* K9 _. D& cvar marqueeheight=25
- i' a+ E3 N: O3 M9 O" Q/ y Z/ k//速度(1-10)
0 l4 I8 `" r7 a# Y O& j9 Yvar marqueespeed=3% w" Y, g( p h( N, S* J; T
//背景颜色
% t9 y' g/ W3 _/ s- Ovar marqueebgcolor="#FFFFFF" z: P$ \! j$ i' k& a; S
//是否能暂停 (0=no. 1=yes)?
) @; y' T- k% F4 n5 ^& j8 Hvar pauseit=1% T8 N6 W) d; @* W$ m4 h! L3 _
, b2 E8 }' `0 |- b8 U2 L0 ?
//修改显示内容, j( ]) b6 l& ?" @3 q `! Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' i6 K9 j$ s# l' \4 l
2 G1 n: s' `0 ^- G, y
( S, j1 |; l6 `2 e! ]- Z8 o7 |
////下面不需改变////////////3 c2 Q6 ?0 h7 z# E- ]' G
0 x1 r% F2 p$ O( c8 Bvar copyspeed=marqueespeed" K- C0 ?, \. W: G. B% u# I
var pausespeed=(pauseit==0)? copyspeed: 0
, j0 n. s. E2 z3 g' b4 Dvar iedom=document.all||document.getElementById' T2 z: c% X' J' C
if (iedom)
9 r8 V. B; E2 j8 {. Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% k4 d& y! I7 {+ Kvar actualwidth=''2 _' x, {/ c, V4 P7 z& r
var cross_marquee, ns_marquee, N6 f! O# `0 k
+ P6 U5 I9 ~7 c; z
function populate(){* T( E9 d2 }: N& k9 a
if (iedom){6 n) c( E8 }4 W! v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: q2 d( F7 I) z4 p9 ?1 p. mcross_marquee.style.left=marqueewidth+8
# F4 y% ?! `3 {4 A% A8 j( k, `7 xcross_marquee.innerHTML=marqueecontent% N3 ~) g2 ~6 \' h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) U& {: G- T! }( w: b4 K2 l1 P0 p- i3 O}
: M; w* \4 T, d9 J4 Y# telse if (document.layers){
8 f* b9 O( I; t2 Y2 l- j, ens_marquee=document.ns_marquee.document.ns_marquee23 Y. y9 D ~7 V
ns_marquee.left=marqueewidth+8# y6 f$ [) S+ S$ D5 u! H- C$ |6 }* ^
ns_marquee.document.write(marqueecontent)6 w' a, P4 b _: E4 c
ns_marquee.document.close(). W% A6 g' `, Z
actualwidth=ns_marquee.document.width5 o( E' B/ a. v' a) ^, y2 H
}
k) d @ `/ `7 A, ]5 O7 {lefttime=setInterval("scrollmarquee()",20)
) K( z% W& Q" R q# S8 @3 n) u}) T$ I4 Q5 I3 J8 _1 @
window.onload=populate
~* i& a7 E6 T9 A$ M; t7 c! A2 b* w7 g% Q, v
function scrollmarquee(){
6 l/ U) J) \7 \5 jif (iedom){
7 a4 J5 ^& I- \ N& h+ j9 xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ o3 `/ F6 ?7 x* {, ~4 N9 z# wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ y& _& P" l7 Z) r& qelse# }% f/ t0 e1 q: e$ T: M# U
cross_marquee.style.left=marqueewidth+83 W( X7 r A: N9 {1 D4 {
9 v7 E/ z1 |+ O0 e! j* }}1 z7 o: f* u4 R- s6 W" P% H
else if (document.layers){
. h0 X4 `0 o1 b7 O& e- Yif (ns_marquee.left>(actualwidth*(-1)+8))* o; I |+ z- Q. w2 M3 C% O4 @
ns_marquee.left-=copyspeed' c5 o9 L. H: A
else
& p, k `+ i2 s1 _" Nns_marquee.left=marqueewidth+8
& M0 F. d) N7 E9 j! P" b}' I0 ~$ T1 x: _5 [+ {
}9 |, S+ I3 E- i! w/ U+ d! r
: n# G. }% ^; y x" ^0 U4 x
if (iedom||document.layers){
1 }' h. l7 s3 k _with (document){* D6 ]- ~5 a$ Q: G v) c. m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ b3 g I5 V7 V# ~0 B: c. ^# G
if (iedom){, i7 L; a0 X6 {2 K& S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 V) i, f2 F4 c' Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ d9 N3 C4 _, l0 \: _6 A, q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 i/ E: N4 z1 ?" X
write('</div>')/ H) t2 l6 [, b8 M/ s% b M3 b7 {
}% a9 T; u7 l+ n( K3 o' f6 V, ?
else if (document.layers){
7 C& n) E" o$ \1 ^) z2 Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) |$ J0 k, u' v# C. X9 j$ Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ Y' d) t, K7 A/ Q9 Nwrite('</ilayer>'). `, s5 q% p3 A: j* ^/ H
}
' F# u4 }# K. L7 E2 N; zdocument.write('</td></table>')& X0 g9 z0 C6 w, _. T, W
}
2 L& c \3 K) n: Y}
9 O0 \3 G. M* v</script> |
|