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

|
网页之跑马灯文字特效
//修改宽度
# G$ p. L" X4 g/ W4 R7 k4 yvar marqueewidth=3009 V2 c+ ]6 b! j1 a6 Q2 A. `: I% b. `! P
//高度- U! _1 U2 R: @! U
var marqueeheight=25
: @& q# ], t- y' ]9 z//速度(1-10)
$ z- d% f5 E( |3 O. z; L- lvar marqueespeed=3
, b; _+ ^. E# u/ P B V5 F//背景颜色$ L. h; k9 ]" |" X
var marqueebgcolor="#FFFFFF"
+ ?1 O4 H/ R7 f/ f" i( |, s//是否能暂停 (0=no. 1=yes)?
5 |# x2 m! T" \2 T! m7 Z2 vvar pauseit=1
( q4 _* s) w/ `8 p! [+ z0 i. o+ \
//修改显示内容
; f: D1 _. j( j w$ V5 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' t* ]. R: N- t$ k6 O/ B) h, N5 z" }" x& _
! A5 B; ?- M4 p////下面不需改变////////////3 _( i B) m$ C5 E' n1 z
5 I! [: \' j' vvar copyspeed=marqueespeed
* X; u! Q1 P9 svar pausespeed=(pauseit==0)? copyspeed: 0% h- t. x% }9 D6 ~6 M! L
var iedom=document.all||document.getElementById0 o/ W) L" z; w2 |* u
if (iedom)
7 X. x' ~7 A, O, tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* d! X# [$ u, Q6 ~
var actualwidth=''0 A4 |+ e# i8 ?0 K( M$ Z& T3 F
var cross_marquee, ns_marquee
^9 O' ^4 \8 p/ x2 P- i, `
; _8 i! T7 i: E) ^function populate(){/ w' ?+ Y( f; J3 K# J2 y7 b4 w; O: I
if (iedom){- \* b. [" j& ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; Z# D2 y' b7 [. wcross_marquee.style.left=marqueewidth+8
: F5 I* |0 {; |# u9 A/ L% O8 Qcross_marquee.innerHTML=marqueecontent
9 X& _* t1 J6 ?+ ?$ Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
x. N4 @3 W4 n M1 P- W% H}
1 n8 R9 V6 u9 _1 telse if (document.layers){
" x- \, K$ V w/ }; h1 ]ns_marquee=document.ns_marquee.document.ns_marquee2+ c9 f* q6 [( x% ?5 [1 t2 o* ^5 R, d
ns_marquee.left=marqueewidth+8
C Z) _9 h3 Pns_marquee.document.write(marqueecontent)2 Y H s, N# Y3 ]% ?4 J
ns_marquee.document.close(): U, d+ P2 P: H5 ~5 t3 z1 k
actualwidth=ns_marquee.document.width0 M! i0 Q$ x" ^! M6 B C- Z
}5 X% P/ S' }& B) I# T# x
lefttime=setInterval("scrollmarquee()",20)$ s6 l& z5 D; \* {
}8 @7 z8 o* Z/ i& Z; r4 a
window.onload=populate5 q2 X5 a4 M" `5 B
3 X9 R* Y# p9 R k. H$ R' `
function scrollmarquee(){
; [2 `: X7 L2 @2 A- Wif (iedom){, _# y, [; C" p, h0 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 j/ j4 D! v, Y% h! v7 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; y, ^6 }% T8 V) `7 ?7 T; h
else8 g, H7 `( t, c2 m
cross_marquee.style.left=marqueewidth+8
, }) T# O7 W* A3 k' p6 C& U: [& `+ @7 f, E
}
. c! k5 L! `2 T0 C0 Gelse if (document.layers){
4 F0 [2 [" G1 W' J. ?if (ns_marquee.left>(actualwidth*(-1)+8))" V- d& ~2 j9 {3 W
ns_marquee.left-=copyspeed
* t+ Y! V' J/ melse
8 _/ t3 \: ]5 y, Tns_marquee.left=marqueewidth+8
7 k+ Y# K* v- N- o, c2 n}6 g' t; @7 n% j2 C! ]& A5 u, N9 c
}
5 \$ n$ w6 U K5 n" @/ ?% K1 d3 `
' ?& x: ?3 I8 m* L ^if (iedom||document.layers){
' v4 Q9 G- N* v* j6 Z4 zwith (document){
/ X% T& i' b7 ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! T( `% j+ q& _3 o. \if (iedom){
3 c/ B4 P7 q* r/ `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ M% ]5 }0 \: r/ N0 z v; t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): H$ ?$ e$ Y$ b% E" o5 j4 r. r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& f# y8 h! e* q* {4 A) `2 s" P/ ]write('</div>')
% L6 ?0 Z3 t* ]) F N; U: z) d}
. j; V; j H4 Y9 M. B- Jelse if (document.layers){
) l# _* H! A# |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# r; F6 D* a- _' r8 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! H& i! A S4 ~$ L( T& W5 x
write('</ilayer>')
3 w' G' H# K2 C; K5 v$ J9 l}
8 O# j" h, x) ]" A0 `document.write('</td></table>')
6 g S" h+ ]4 [3 L}
, ]4 e+ F0 a) r1 i6 ]& i}
# m2 a" M8 B/ \( p N2 F4 [</script> |
|