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

|
网页之跑马灯文字特效
//修改宽度8 ? }6 u( b5 Q5 j6 d
var marqueewidth=3000 h- t& C0 `: z7 V+ V
//高度
, i* K$ j J* Uvar marqueeheight=25
' N# q% K8 D$ ^9 n//速度(1-10), m, v# e4 q* T8 ?9 V$ P
var marqueespeed=3! {. Z! _# X. C4 m5 ^% {+ a _
//背景颜色
* W; V& ?, W% A6 w9 T6 a( Wvar marqueebgcolor="#FFFFFF"5 D# g0 \' P( ~8 B }+ N' z
//是否能暂停 (0=no. 1=yes)?
6 H$ g7 v6 P8 zvar pauseit=1# o5 e- Y3 P; h2 L& w
7 X m. s a' X! E0 T3 s8 V5 A" E7 ~//修改显示内容& V) V+ [. F9 V* k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) j S7 S' o' z# \! K8 X
. j5 r1 q3 z% L: L, C9 M/ W- M/ v: S8 \# O- ~0 I( ?
////下面不需改变////////////2 A! { C [ W$ z: r; F+ s
4 a8 t# y; Z6 _5 k$ K
var copyspeed=marqueespeed ^/ q5 ]7 o) Q
var pausespeed=(pauseit==0)? copyspeed: 08 A; |+ |& _4 x' M" s
var iedom=document.all||document.getElementById0 u" w$ W6 P2 V+ \
if (iedom)3 Y/ v4 D5 R( y% @ I P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 A* `2 V& H& K& E+ f
var actualwidth=''
) ]+ Y1 \6 K2 i8 B, l: j- a- {var cross_marquee, ns_marquee% a: ?. @* i2 N0 C& T i* _, G* v
; a5 _' o/ m5 ~# |function populate(){
! @& t' w7 N' n% oif (iedom){" s7 D: G$ Z+ B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ S- }4 X; L8 ]# h1 w9 A' _
cross_marquee.style.left=marqueewidth+88 _+ |5 @5 E6 \' [& {
cross_marquee.innerHTML=marqueecontent
2 {) Y4 `0 A3 q$ pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; w+ Q* P# \ V* W5 i3 A
}/ \& c* I. C% n3 A# Q! d
else if (document.layers){& w* v" U4 k" g) e" o8 _) Z* j
ns_marquee=document.ns_marquee.document.ns_marquee2
& s% o+ v/ j, C. `& x+ dns_marquee.left=marqueewidth+8+ u( s8 D1 H/ N3 U5 y
ns_marquee.document.write(marqueecontent)$ j) \& x, @, s& N, p
ns_marquee.document.close()
/ h) p# [) x7 m" S' tactualwidth=ns_marquee.document.width$ v- b/ U3 d. v$ K/ Z, w% j$ L3 i2 Q) I
}9 }: [) ?$ i/ H6 W' g3 v; v
lefttime=setInterval("scrollmarquee()",20)
% |4 Q8 G/ W! ?7 p( y. ]}
6 N n0 ?+ v X e# @) uwindow.onload=populate# m9 J: D" u3 |
6 u- E2 i# ~& ]
function scrollmarquee(){$ R- I0 z9 G$ x" e5 b4 S
if (iedom){2 ]# k C. Z$ J4 ^9 } P/ U0 H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 h9 Z* x. J9 `" H2 a$ D/ l2 {7 ?! R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' f$ i. W/ A) @: m8 ]9 i) ]else
3 R: E- I2 V2 Xcross_marquee.style.left=marqueewidth+8
: s5 m4 z1 @' y0 H q% V# A
- m P1 j0 c2 v/ C}
0 V% {6 A" e8 D# o" S( J. }else if (document.layers){+ L, }2 a; I7 R0 k3 n6 u
if (ns_marquee.left>(actualwidth*(-1)+8))2 p+ }1 S+ u, ]5 j$ N
ns_marquee.left-=copyspeed* P8 y3 y0 [$ q" `* l* H n
else
/ R- L4 W. q; ] a: ins_marquee.left=marqueewidth+8
9 V- Y4 i2 r6 m; Q% p" f1 ?# ?$ e6 o}
0 b' K- K H7 p( ^. Y4 R}
1 y+ S$ Y% F% d2 J4 U) a1 f; e. Z) R+ u6 H+ P
if (iedom||document.layers){# d" o% f# a) R- r* _- l; ~& I
with (document){$ `1 Y' J* O6 ?, V+ L1 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 C* |4 b) y( ] M3 p' l; t* xif (iedom){
4 ]% E. [; C9 u0 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& O# p+ F5 v" r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ t% Z* h$ U0 N& l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 n S z% O% qwrite('</div>')
6 J4 b- i. {: | o |) i2 k6 i}% x8 \+ N/ R' N8 M% V k
else if (document.layers){
) t( I2 }5 F9 u( ^7 gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% D0 \! C: d& n3 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 t* v. v3 I6 M, B: p. [
write('</ilayer>')" H" O3 [( o1 x. l
}7 z1 J# i* }0 @7 t; u
document.write('</td></table>')& M0 V- Z2 C: ^% `
}5 ]( I3 |# e2 i! e1 R9 Q) M
}+ L" l. A5 l6 c( C& q! A
</script> |
|