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

|
网页之跑马灯文字特效
//修改宽度
/ L. x4 u# s( C( }2 T) ^+ P9 Tvar marqueewidth=300" m( f L+ }8 e; c V1 g
//高度
+ y* e# J8 F8 [3 @! Ovar marqueeheight=25. C4 j& F4 P, K4 \
//速度(1-10)0 w4 P7 t0 Q- I5 }( H
var marqueespeed=3
. ?4 u/ |. V) K% C//背景颜色
( t% G1 ~" K4 U+ V$ K& d: mvar marqueebgcolor="#FFFFFF"+ P" I& a j, @* q, @9 y
//是否能暂停 (0=no. 1=yes)?
H( c' _" k5 n' R9 Z. m+ s2 Zvar pauseit=10 }! i9 Y- c+ ~
: K9 X' }2 {# W; e9 U& d
//修改显示内容1 f. q/ _ h4 R+ z' T) {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' o7 }, u7 ~: M. J. p: P8 H' M5 j- ^7 P. s
! D2 i8 q4 Y* ^3 [////下面不需改变////////////$ X: D% B5 n0 V4 i* V5 _
* w5 m, K% q( F) `& c
var copyspeed=marqueespeed
% c1 @5 ` a. L a2 w( u2 h5 Lvar pausespeed=(pauseit==0)? copyspeed: 0
0 h* R; h/ N8 ^1 w; [4 Evar iedom=document.all||document.getElementById2 V( l" ]" M: z9 z+ o# _
if (iedom)
i. t+ y( Q- F9 ?) Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. g0 C* L+ j# h# M6 _var actualwidth='': v) J3 X- N& I U1 x
var cross_marquee, ns_marquee, ?) y+ ?- J* a2 T6 _' |" n
6 Y4 w& h9 {0 B6 r/ P" ufunction populate(){3 X$ n7 y7 `3 H. K$ m3 w4 d2 p7 h
if (iedom){
* y8 B& x- P: Q, q; ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* c% T; N3 M" {8 m
cross_marquee.style.left=marqueewidth+8) [1 i; I$ ~9 ~ E+ R1 D
cross_marquee.innerHTML=marqueecontent7 h' ?8 h% z) w% s% O' x2 g+ @1 I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% k' t- [% D( x; h* f( I. x
}6 |& Q) A6 Z7 c5 K+ @) ]+ b
else if (document.layers){( {+ H1 m" l+ M+ p; X6 Y
ns_marquee=document.ns_marquee.document.ns_marquee2
1 a( e3 v4 e, e7 uns_marquee.left=marqueewidth+8
8 ]# b# x% c! q. ^% ?1 g" s' \# e4 h) i4 m& Mns_marquee.document.write(marqueecontent)! u. {! P* h! W6 f' l
ns_marquee.document.close()! Z: y: y+ W" o- \3 J
actualwidth=ns_marquee.document.width6 Q- f9 h& S1 H2 G4 H- ~; e
}
8 Z+ N \' M$ Z' h: t0 a( qlefttime=setInterval("scrollmarquee()",20)
$ K, a- } [- S7 m3 |# u}
: \8 n, F0 m: r+ _. k. Hwindow.onload=populate U0 @; o6 e4 M5 H$ d, T
* B' t! u1 p! v* Q3 tfunction scrollmarquee(){
% [2 p" `' I* b6 E; F2 pif (iedom){
0 y$ L! M; n1 vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& z- P) e& M# D* u) ]/ k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# f- u6 ?. N& w/ q" z3 c1 melse' E: R' N& Y6 m' \! e7 W i1 Q1 J, Y1 M( I$ \
cross_marquee.style.left=marqueewidth+8
4 `" M: l0 N) y2 J8 ~; o* q* @/ o2 g1 N; O8 \: B3 i) b
}* g I' j/ X3 c* ~: o
else if (document.layers){" G/ v8 D1 y, b$ e+ b
if (ns_marquee.left>(actualwidth*(-1)+8))' @8 l$ ` e+ I0 r; v. {
ns_marquee.left-=copyspeed
2 Z7 y2 Y" `6 p, w: Q. pelse$ W. L- L& j6 Q. ~ ^/ Q
ns_marquee.left=marqueewidth+8
' o' K: K6 e4 N( ~) h" U}% d) U3 [) D# D- ?, z6 Z
}
" ]; h; K$ K. Y' {1 R* k) h; w0 m2 _, E* k" t2 a9 n
if (iedom||document.layers){
1 n _9 n2 Z1 U5 twith (document){
8 y0 g& D! C' l. @1 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% |, {9 E# K- Y3 D5 l7 l: tif (iedom){
% ?7 I2 n$ f; Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( X; ^# f7 H3 G" w4 `* u- r0 b0 P* z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 p" N) o5 O9 ]) b( bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! {% U5 ^1 c9 b$ _: y \( v( pwrite('</div>')! ?* b: D8 J6 F& o9 g
}, l$ g: c+ Y, L0 s$ I! k( V- ]) f
else if (document.layers){
, y% a, n/ x- E$ d, `7 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 f0 `9 z+ P5 |2 o7 L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& `* Q& C* T$ y: V, \; o3 c
write('</ilayer>')' A6 D' m' A( i. a1 O3 j/ p
}
( P; u2 A. Y& @9 {7 |5 z6 ~" |document.write('</td></table>') s$ W5 y8 A" u2 e
}
1 L- V: E/ k ]( j; z}6 `0 h) P8 G* V U" V
</script> |
|