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

|
网页之跑马灯文字特效
//修改宽度+ X5 w1 d3 C0 F4 b( N
var marqueewidth=300
) C# Q0 ]5 u: T. B, ?//高度/ E; I4 v o* O2 ~+ K% ?! P
var marqueeheight=25
+ L; t( z2 y2 L. |2 W0 N//速度(1-10)$ t* _* j% Y7 g+ p- N' [
var marqueespeed=3
. Q# x6 G; ~7 }! q5 l8 P) [+ e9 }0 E//背景颜色
Q) s: n6 k U6 @0 O& cvar marqueebgcolor="#FFFFFF" C1 B8 Y& P) }
//是否能暂停 (0=no. 1=yes)?
% i& O* q1 ?1 Fvar pauseit=1: Q+ G# V- S1 u0 f! ~0 h
+ N* }% P3 D; [3 F2 b1 N6 b ^. c//修改显示内容* ?; y* u$ m8 K! Q% j' b$ r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- u s8 W1 p; G) x ^; a7 w( {. B/ ]# d9 v6 h
' o' i- R7 t, g0 T6 A2 C
////下面不需改变////////////0 S9 }0 l# [: x
2 U# E7 ~0 Y# N* U! |- x% T, _
var copyspeed=marqueespeed
- a9 n! Y9 ?2 n- `7 G6 f' \+ Xvar pausespeed=(pauseit==0)? copyspeed: 0, l, n' S" D: j# x. i! g5 ?
var iedom=document.all||document.getElementById- r" @! s" V% W7 d" u+ F6 {# J
if (iedom)/ {) C) g* z; ^- B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 \8 Q: u2 n* N' h5 s2 uvar actualwidth=''# g' `9 C, K! V2 P z& F m& I
var cross_marquee, ns_marquee
' Z2 \# C7 u7 ~# _ O' s" W2 L. _
- H& l8 Y4 M4 i o* zfunction populate(){
1 G5 |+ V4 a f: G% l/ ]8 Eif (iedom){# T/ v% K6 k& d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ [# u& H# `4 v' K
cross_marquee.style.left=marqueewidth+8' v* S5 z) Z& \# q2 J
cross_marquee.innerHTML=marqueecontent5 E4 H' o6 e% j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, b& E$ O p' }. f
}
7 h# s' D+ b1 d+ S8 Melse if (document.layers){
& ]1 `. B* G, ?$ q6 }8 C9 Nns_marquee=document.ns_marquee.document.ns_marquee2, t. `# u# E! R' t9 `% Z
ns_marquee.left=marqueewidth+8
& J. i$ n. \) n& W) W) @3 yns_marquee.document.write(marqueecontent)
+ `0 h- K* ]7 ~ A4 yns_marquee.document.close()
8 d9 p9 g* U {7 x7 T& L `actualwidth=ns_marquee.document.width( K# N5 M3 q1 N4 b9 d, J! z2 q
}8 `+ E: c& K& ^. S- q' m" k
lefttime=setInterval("scrollmarquee()",20)
! o3 l0 K( w' {. O6 p}
8 m3 ~2 W# x! V3 j- Uwindow.onload=populate+ j3 B' [, g: ?. s. i6 X
$ N. v3 A0 W. \function scrollmarquee(){/ W, g7 M* n% r, ~
if (iedom){
) Q/ G& S* P1 j* Y9 ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) R; ]7 j/ C0 F. Z6 I5 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! J" L: ~8 d0 S8 W+ f @# n; Q) Kelse
' i! W0 d6 A* a" U/ [cross_marquee.style.left=marqueewidth+8
' g& H* i6 D0 H
: J+ k- w, m/ G0 [5 A9 s3 I}! ?- P( D* y3 N2 ?; j7 u/ m
else if (document.layers){
: h. h4 G$ [8 c( b2 g, zif (ns_marquee.left>(actualwidth*(-1)+8))
, e: d* {5 J! j. f2 g" s" }ns_marquee.left-=copyspeed, K* l- l% _( H8 [
else! @% J6 f1 V/ D V! \
ns_marquee.left=marqueewidth+8
) L! U' }2 y; t5 q* `7 V4 T. n}# z2 K7 }2 M8 I; K7 i
}
y: j4 I) e% i2 }: Z' b' n0 f) L& q6 m* u& A7 _) }
if (iedom||document.layers){
% b7 j# Y6 V8 S$ t5 q; k. swith (document){
" I7 k' p' O; v/ V7 \, Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') J* k, c, M6 y+ U) R
if (iedom){: U& T( q u |. \" }+ o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 b4 B; n" l/ D: e U$ Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# J: C" U2 z3 E* E: ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- s! \7 O5 I4 H2 J8 {write('</div>')
6 N) G2 d- `4 @) _% y) F3 e}
( b y U$ e5 N9 P. Lelse if (document.layers){
) `8 s0 x P* w% |; a2 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" ]& ?2 m2 M l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ n! U2 \1 A6 f7 s Nwrite('</ilayer>')3 u8 m/ W3 U9 c, m9 u# Z
}- F" S$ q# T, c$ l% p$ I
document.write('</td></table>')
( g% D0 i( Z. G' y( L6 ~5 {}
9 G5 n; n/ z2 q( k! j& @}# Y0 Y6 U- ]' ]9 I3 e
</script> |
|