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

|
网页之跑马灯文字特效
//修改宽度; f, @2 |$ @) w6 m# \5 l
var marqueewidth=300. k0 h) r) i8 r N% U; S3 s2 k
//高度
- t0 J; f9 \$ |+ e; A, q+ Hvar marqueeheight=259 G! |+ y4 \7 r6 Q
//速度(1-10)4 L! x" H2 K. p2 C* s. t' c* Z
var marqueespeed=3' v- Q3 m) ^) t3 y5 {4 I" o
//背景颜色+ R5 C3 I) h( Y s/ J$ d. j
var marqueebgcolor="#FFFFFF"
, N( M- Z) A$ K e//是否能暂停 (0=no. 1=yes)?
( s' [7 i0 X4 F. ]$ w k9 pvar pauseit=1
( h/ v" e/ y; X9 f! f7 m. Z3 \
//修改显示内容
& I {# y# J+ R1 ~# a% Y: Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ B3 d! G7 c7 G9 B/ s
9 P6 Z, ?/ \ v3 E! l0 `0 X3 s8 T5 K% q* O. E
////下面不需改变////////////
* G& W! R* w, H. z7 y5 V l
) {, t8 l! s( x" Z5 evar copyspeed=marqueespeed
# {1 y2 K E4 ivar pausespeed=(pauseit==0)? copyspeed: 0
F8 ~$ x0 f" G Cvar iedom=document.all||document.getElementById
. T& ^2 J2 {" A% y# G9 Nif (iedom): t' c7 T: i2 v7 _2 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 c8 ?# }# Y* n2 c' F8 c3 C3 X
var actualwidth=''+ Z7 \8 u) Y" ^- N+ ?
var cross_marquee, ns_marquee0 h# I3 m* _* ~& m8 P: ]& X
/ U) o1 E0 w3 @" _" `- z
function populate(){8 n$ S' O+ y6 L0 S
if (iedom){
a r& M8 ~6 {) Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 A6 L; S5 N3 M
cross_marquee.style.left=marqueewidth+8
9 w. q) m/ k Z2 h; @6 |- fcross_marquee.innerHTML=marqueecontent4 \; B, Z7 E! a3 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# x( v' k4 w5 {$ u B( Q5 j}
& Q1 [0 j4 ]. `( \" D+ \else if (document.layers){
) K' h/ F6 _2 l: S/ nns_marquee=document.ns_marquee.document.ns_marquee2
4 ` v1 [$ U6 d+ C) Q% O- @; I7 [ns_marquee.left=marqueewidth+8
( q% [5 f a) W5 A* N6 Mns_marquee.document.write(marqueecontent)+ E5 R/ i2 R* G
ns_marquee.document.close()' h; B/ H+ }" C% X% S V
actualwidth=ns_marquee.document.width; r7 ~8 u e- J9 O1 h0 L4 m1 Z% o
}! {( T8 ~* y" t
lefttime=setInterval("scrollmarquee()",20)
) n; G( d9 ~" \. q3 X: e( T}! m C. l8 K8 Q& A5 ]9 r$ {* d
window.onload=populate! v! {7 b! }$ J, Q. X% @
7 ?3 g1 k d, _" c3 c# i& Q
function scrollmarquee(){5 }$ h+ A& ]; h! ?4 A
if (iedom){
& ~; V* a2 R# h( D7 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! O$ o7 F# L$ ^( P5 D" X h) O3 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 S7 q" a* C. M9 L2 k5 p% T2 l( Belse! q N% y% N V# J U
cross_marquee.style.left=marqueewidth+89 \6 x' Y* A& V* R" r3 t0 r' t
; z5 d; A" p2 ^8 X( F. |
}7 }) V- {4 \! r" v# E
else if (document.layers){
! V3 H( a( y v4 F7 s' [ Rif (ns_marquee.left>(actualwidth*(-1)+8))
5 D3 {, `5 M4 V0 _ns_marquee.left-=copyspeed6 T0 q9 P8 b+ P" ?6 q7 d. r
else4 ?; f5 z2 {% ` r& V" B, f
ns_marquee.left=marqueewidth+8
+ Q3 S0 i1 R! ?- I5 j}( t5 T- Q1 ]7 ]# u3 `& v+ y
}
6 S! p @6 ]4 T8 n2 [* T, P" o# T. n. N/ G
if (iedom||document.layers){6 {. b, h. h( ~! N/ ]* a `
with (document){% |& b3 ^" [/ `7 }& x; T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ R- y# {+ {; n0 N
if (iedom){
4 y, m% h% L* o3 H$ Y: d4 G# Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 c) j: g- |* V) j- ]) owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& q1 j: T( M$ `6 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" ^# Q) W6 r# B# Wwrite('</div>')
B. U& i/ {5 j9 P: n+ `7 F}
1 z; m" o* p! g' m+ N+ \) ~9 u/ Celse if (document.layers){4 l4 t7 V$ h' I0 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 Z3 j& c# x1 m0 x1 c/ {# Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 Y& y( A" M1 \4 ]
write('</ilayer>')) w8 S8 O4 g0 G$ Z
}
# X/ Q: G9 q" jdocument.write('</td></table>')1 n1 Y, `, ]! D0 o9 H+ ^
}$ D7 X& L1 |) r7 c' Y
}5 m4 k5 n* i. b6 L
</script> |
|