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

|
网页之跑马灯文字特效
//修改宽度
/ ` f! l0 D2 @( k6 a* k) W3 G: _var marqueewidth=300
4 d- W' z/ X0 a* c( @8 U+ Y6 Y//高度
+ c e1 B F; Y# vvar marqueeheight=25
) Y: \* Y3 Y" }# z5 q//速度(1-10)3 q% P) |# L9 Q3 G5 h% d$ Z6 z8 w
var marqueespeed=3; `# [* r7 N, O+ |3 Z. u
//背景颜色/ P2 N0 D: b3 M6 F5 g6 [: H" T
var marqueebgcolor="#FFFFFF"6 `' p/ a/ u9 L+ C" ~
//是否能暂停 (0=no. 1=yes)?. q2 j4 H- {: u9 Z" W: O
var pauseit=1& V( F/ m7 s, v/ J9 k$ }
9 }8 R# N% z& N3 m$ ^( C1 M
//修改显示内容
5 R3 e1 m) a6 }: y5 q- ~& uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 H, g! E8 r1 `, v1 O
0 t2 Z0 c1 q. M. b, c& o" Y9 S, l& K A" \7 z! d- Z# G
////下面不需改变///////////// d3 i3 @. n, F: Y% z
f- }( B. M# t5 hvar copyspeed=marqueespeed
8 j2 [$ I$ {2 s+ zvar pausespeed=(pauseit==0)? copyspeed: 0( t4 v6 U" I3 R3 E- Y9 Y0 s
var iedom=document.all||document.getElementById
. l" S ^( x* o7 Xif (iedom)/ Z/ ]! z2 `" {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 Q0 m/ N9 o4 ^5 G) R) Fvar actualwidth=''- Y6 x) V2 |) _; i. F) S( _
var cross_marquee, ns_marquee
& f# O% W s9 c. j0 O7 F# \" f3 D( u. N9 G
function populate(){) t" h0 Q( [5 F8 U; B" |
if (iedom){
6 q- ?% e* x/ M* y( k" ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 l; E* t6 a @
cross_marquee.style.left=marqueewidth+8
p3 i7 q" {. ?% N- I; b+ e: q9 Qcross_marquee.innerHTML=marqueecontent% l: ~; ]7 f7 s+ j0 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 G% g( w' E- e4 r, m0 D}
4 p0 a! N& q1 p4 xelse if (document.layers){( X F0 A; l5 P3 ?' i' T
ns_marquee=document.ns_marquee.document.ns_marquee22 ~! n: I) A& _7 c V$ _& g7 S
ns_marquee.left=marqueewidth+8
: O3 N* m# u, `6 T/ S2 d: Cns_marquee.document.write(marqueecontent)
8 a4 J% G/ s X e: _5 p, Cns_marquee.document.close()
* u$ j# j5 ~3 t2 W8 b" q7 }/ eactualwidth=ns_marquee.document.width( p% m- u7 P9 v- L/ D% h- L7 w! C
}
! Z3 ~0 n7 K9 ^* ` {2 U: R3 Plefttime=setInterval("scrollmarquee()",20)7 \& \9 z% e: [- Z
}3 T: _* \* t o5 v' O+ ^
window.onload=populate
6 V+ y' t; e5 f: F+ [) e4 x$ c- m# a$ E. R6 G, P t1 f3 h
function scrollmarquee(){1 R2 e& u6 a% y. q, @ z2 l
if (iedom){: Q ]+ t Y8 V" s- Z9 T! N3 x7 j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! v4 q' q/ j9 d; ?9 J; `0 L3 B5 @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
u5 U8 I2 \4 {: i# relse
. i/ W9 D# L* B: o5 F, J% G6 u& N( P4 @cross_marquee.style.left=marqueewidth+8
& Y! x. f8 u* Y8 S7 i4 D0 M
! L( V R: A* ?3 L+ f/ }3 c8 J# r0 u}+ `( L+ A" q/ y+ b- C
else if (document.layers){# s( t" R2 b- A |& l
if (ns_marquee.left>(actualwidth*(-1)+8))/ n/ f, t6 A- X9 w( b* i
ns_marquee.left-=copyspeed) k2 e {9 u v5 T# B7 o
else
! n* u& M8 @7 L/ T0 d6 Jns_marquee.left=marqueewidth+8
: N8 L6 Y8 f! {: S8 v}7 v1 z/ E+ c. G- m& g
}. ?$ s7 |2 v3 c: {& N2 f
3 v7 j0 T- h9 ~8 B8 B8 Z1 q q
if (iedom||document.layers){% j! S. z1 {) S5 p
with (document){
' ~. l+ Z. j6 ?) |; ~3 K: Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* L0 C4 G p' X' r7 @' R
if (iedom){
/ a( d8 V/ C) l3 C2 z) A jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); s m8 w* f+ A- G. Z2 ^/ j& \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 ?' a/ R8 g3 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 i) F: y, \6 o. ]& T1 owrite('</div>')
# l' \& k" I) B. U}
& Z7 d* M; _& _0 Welse if (document.layers){; T6 a Y6 F5 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, ^# K, e$ q, R1 T* t8 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') _- B( Q! y: H
write('</ilayer>')
8 \9 J/ Z- c' i3 B}
* ^! Q7 W# U! @& ?# D+ x) kdocument.write('</td></table>')$ m* K: o3 C* a, J% z; A
}& T$ z/ Y; @4 S6 z6 Q' s
}
+ w! x* d) m" p. Z6 M" x J q1 p2 l" `</script> |
|