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

|
网页之跑马灯文字特效
//修改宽度
4 y" j$ h; ?9 Xvar marqueewidth=3009 j% Z ~7 R4 @4 \
//高度
$ t1 O: h: ^0 C# J7 zvar marqueeheight=251 M- B! @. a$ g& D0 f
//速度(1-10)& `8 g% _8 Z+ h+ ~" z9 m
var marqueespeed=3
- F2 i4 i( o) E/ R2 w% z/ H- Z: |//背景颜色# ^3 e. v1 N' _7 @ y: g
var marqueebgcolor="#FFFFFF"
; X% ~7 c. j5 g2 ~//是否能暂停 (0=no. 1=yes)?
. Z3 u* a6 \4 m& q% c! Evar pauseit=1
+ P/ Y5 g9 I& e0 ?+ h; F" ~# {: r' C8 d0 m) J8 Q# |- q1 v3 A3 S
//修改显示内容
3 U. x Y w" r; B' T' J& mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 y4 _! u0 d+ {! @/ [& y. O) i9 k, A, S
* f$ X7 u% u( \7 h/ B, @/ w( T; Z
////下面不需改变////////////# H' b; U8 Y6 r5 w. p G& K
O( W! V* L) V2 Vvar copyspeed=marqueespeed* ?. n! Y C! f4 \
var pausespeed=(pauseit==0)? copyspeed: 0
* o; U) y% x3 _$ gvar iedom=document.all||document.getElementById
. H! T+ A3 P2 X, b7 j9 gif (iedom)
6 F( r# n9 Y" N0 q8 Q! P. n3 Q# ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' V1 o+ c* I% ]# k, B' |) ^$ c& [
var actualwidth=''
7 K% [" D) L, Mvar cross_marquee, ns_marquee
; h7 c- w# r( U% M4 C
/ s9 a ]* f1 p8 dfunction populate(){+ g, G/ ~' d$ a0 L% a
if (iedom){; l; b$ X: \% _! c7 t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 D% V6 e! i' w6 i1 X4 s
cross_marquee.style.left=marqueewidth+80 T0 a# L6 H# @2 X+ x3 E, r
cross_marquee.innerHTML=marqueecontent
0 y( [! r& u# Y, D, Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& ^( F# W( g8 k; o9 U9 t
}* Z7 p4 J$ M/ ?' q3 |
else if (document.layers){
5 P+ `4 L+ T% h6 \% h0 ~( ]; u3 lns_marquee=document.ns_marquee.document.ns_marquee2$ T* ~: z& W h$ P/ ]
ns_marquee.left=marqueewidth+8! y7 X8 ^. w( Q6 t
ns_marquee.document.write(marqueecontent)' ]9 P" |5 A( Q( b# b7 y( Y( m
ns_marquee.document.close()
1 N+ j7 [9 V# p9 C; y5 T3 R' Uactualwidth=ns_marquee.document.width# }3 N$ h3 ~/ f* m' o; L' }
}) v1 j" r0 T! Q- e; G% H
lefttime=setInterval("scrollmarquee()",20)
6 Q$ ^( c6 N4 W. q* `$ t}
. N: v5 V: s2 fwindow.onload=populate. G* l. ~1 S5 G2 B9 f
3 `$ E( a, W/ R1 a2 j: T
function scrollmarquee(){
# v4 g5 W0 D( R. e3 V! eif (iedom){
5 X7 H+ W! i& _9 Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ S8 l7 r/ V5 D# k) Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- N( ~# J1 u) v4 x- s
else) ^0 k- s" z$ J! \0 s6 I
cross_marquee.style.left=marqueewidth+8# ^& D4 o! e$ ?2 V- H
) B8 E- \0 M5 N/ I% X* D}
6 G& F1 t+ \9 U; ]; r; |else if (document.layers){
! M( j, M0 b& e. t }- Y/ u' gif (ns_marquee.left>(actualwidth*(-1)+8))
2 |4 y6 i% @# A4 c, Nns_marquee.left-=copyspeed
" _. p4 V4 L9 H, y" `else1 w+ J9 x) s) M5 y; n
ns_marquee.left=marqueewidth+8
1 K3 I- b; v1 L/ a* Q}- E: ~# P* n" z: r3 ]
}
/ A0 _) K# L3 W$ C
# x0 [. R* S$ L9 i7 |2 I4 ?if (iedom||document.layers){% f8 p5 X0 {( l4 v& H! R& Y" V3 V
with (document){
3 }1 ~, e! u p4 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 K( [" w% k# p
if (iedom){! s1 \. j3 v0 b9 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 H1 O& p% y) J2 e6 |0 o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 f! z$ A/ T+ t/ \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 z v' R8 \6 G/ O
write('</div>')3 o) ~$ s/ H! l: L& A' j }
}
# u! t9 J/ T6 o; [7 {- A eelse if (document.layers){4 S- x' j. P) A+ q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 s% h3 V$ p: O4 v: U# k6 i$ b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, i" e) I/ w N: T& o( rwrite('</ilayer>')
& Q. `/ E) ?% L7 y' f}
7 C/ \" g' P7 s8 s- N Vdocument.write('</td></table>')
4 U: a d5 v3 R}
" o5 s# |8 l' A. j: t}6 A4 q$ Y& y, {/ [( m! f: _7 t) d- ]
</script> |
|