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

|
网页之跑马灯文字特效
//修改宽度
: x& N }9 F5 qvar marqueewidth=3009 D( V4 [8 `, N6 ]
//高度5 V8 s! D( |1 i! Y% [
var marqueeheight=25
" x( r' p2 y! B//速度(1-10)9 [" _1 p7 \4 }" H1 z: t
var marqueespeed=3
3 I4 W; |+ ^6 [2 a0 F1 l1 P//背景颜色
* l1 g8 c5 @( p7 V, ^* e/ H. d: V7 R- ?var marqueebgcolor="#FFFFFF"
! \- P+ D) f7 V+ x9 N//是否能暂停 (0=no. 1=yes)?
3 S- r1 n6 R7 n/ i$ J. {7 Q- Bvar pauseit=1* H% k) g5 f, Y) z2 [3 E/ }4 p
4 W- [& p9 }# {8 {' R. \//修改显示内容; A: l8 A# t: b2 w2 x P1 C8 Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 W! V6 [; F5 e; b, ?' ] g; O" c0 v7 y' s
) K( W+ b" \% ~- w. t- q. v////下面不需改变////////////2 A- |/ ^( \: }( a
+ N& i; c$ B$ D. M6 p4 f/ y
var copyspeed=marqueespeed
- b4 W1 S8 `& X; Gvar pausespeed=(pauseit==0)? copyspeed: 0" R; t) H/ Y1 k4 C6 G
var iedom=document.all||document.getElementById( x# h8 }: M& s" C( Z
if (iedom)* {# E, O3 g0 J4 s% `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. c6 V8 v4 |" d; [$ c( z/ Rvar actualwidth=''* [+ S7 f1 w6 }' I
var cross_marquee, ns_marquee G a1 R2 P2 T
8 W+ o$ j; c* n$ k5 S/ J- |function populate(){& T: ]3 q( p' P6 U4 `( J0 v4 V( r
if (iedom){; T5 z( z7 ?. t; k" V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- |5 Q0 H7 W X- O
cross_marquee.style.left=marqueewidth+8, s" M( A8 p% ?# S$ K3 l1 \, ?
cross_marquee.innerHTML=marqueecontent
% \4 L8 {3 i: d1 Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 `2 T/ D' V# l$ b1 s7 ]}
- r/ k6 z4 m# b8 k* Zelse if (document.layers){. }8 w( L) g# B) ~& U
ns_marquee=document.ns_marquee.document.ns_marquee26 \7 Q0 p1 s T: a& Q- n& V
ns_marquee.left=marqueewidth+82 G' x3 y# \) \( G) A
ns_marquee.document.write(marqueecontent)
1 {/ o- I0 \6 T6 b9 tns_marquee.document.close()
6 _" D/ z1 x& {, [actualwidth=ns_marquee.document.width& J4 u4 A; E& G5 E* d
}. \8 N8 U' v. s- d' [! O
lefttime=setInterval("scrollmarquee()",20)
7 o; d& [ K! t% X- H; C' R}. s1 N7 [& _$ U) C
window.onload=populate
' c4 D2 d. H( r3 r' a
( ?5 Q7 Y' J: X' o' ~function scrollmarquee(){
$ \/ U8 j7 _% iif (iedom){
2 k9 v4 N4 r9 |8 Q- @# Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 x3 T* {8 B: J e! p. dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% \. t" ]6 G2 q8 K1 s
else6 R. v* n- s! z8 Q% |
cross_marquee.style.left=marqueewidth+89 u3 w: K8 |7 c6 u, b- Z4 T E
: I& s4 q) }) L* t}
5 z! |- @# g* celse if (document.layers){+ l8 H* |) q% S% k
if (ns_marquee.left>(actualwidth*(-1)+8))
4 [/ [7 `4 o/ P# l% E$ uns_marquee.left-=copyspeed
; L$ f" T9 \6 |% i0 \else5 L k5 a$ \# ?# R6 l
ns_marquee.left=marqueewidth+8& U! e% {6 K# D- l# E" U9 l
}
8 w: a. z5 q) R z& K8 ^) b}
- i9 o1 f3 i y6 V3 v5 u2 b) u! b; V. ]
if (iedom||document.layers){8 `0 `) ~% C8 Q( K) c
with (document){8 o! W4 z/ ?: \, ]8 C8 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) l6 P! D9 {9 ?' R; `if (iedom){! Y; W% M2 l. F" a' y+ ]& X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 O4 F3 [ `4 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ R3 V! T9 B+ ^% twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; g, W3 C0 ~" G' ^% M( Z9 [; O, fwrite('</div>')
' n! T# m R5 V* h. f( ^: U* K3 E}+ c2 l6 }+ k& d/ }! L6 T8 b9 q
else if (document.layers){
6 a7 U" j% g5 N8 @! Y, Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 R4 }! q9 C D" I) ^* [; _. R* A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- D8 R' Y3 z; Y/ ^, V9 g6 Jwrite('</ilayer>')
0 `# E; ^1 |- H: y0 h9 \}0 z- u( g6 C# E
document.write('</td></table>')
( B* D6 h9 C) M9 `! d9 {' z}
4 A7 {( T( ]# f k}+ x$ P4 b' W+ ^: }/ [
</script> |
|