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

|
网页之跑马灯文字特效
//修改宽度
/ |9 u& u4 b$ W& P, e2 lvar marqueewidth=300
/ k5 m) k1 l! J$ S3 G& @ s/ M8 q//高度" W) ]" i5 c' r* S
var marqueeheight=25% C0 i9 t1 H9 w* Q8 Y9 c
//速度(1-10)/ G. l; A2 t7 B1 F
var marqueespeed=3+ H' e0 I# Y( N C
//背景颜色 E# i, @: b+ a* x6 D! q
var marqueebgcolor="#FFFFFF"
3 a, D/ v) i, k) C# D$ Y _//是否能暂停 (0=no. 1=yes)?
! W. |* D4 ]/ \var pauseit=1
5 N" E* c, Q- z9 G3 U0 f+ Z( D/ s1 D4 _9 l' N
//修改显示内容
3 h8 e, K& _ B6 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# |. y9 l: K6 c o \3 c% a: C+ N4 C$ a" c
; g" c. F" F- X7 a9 \
////下面不需改变////////////
& J* s7 m4 t( y3 S, F& {
1 \' o' l3 |( }var copyspeed=marqueespeed
. v/ E* o i/ zvar pausespeed=(pauseit==0)? copyspeed: 0
" O6 a) K. } s" U' Qvar iedom=document.all||document.getElementById2 b- C& i1 O" Y: {- @
if (iedom)) }9 [% |0 h! k9 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 S5 R* S+ ]1 v' [
var actualwidth=''- H% a& z s1 A- G
var cross_marquee, ns_marquee
+ y2 p' @% l% x" A6 [
6 h- b4 V% G& N" o( U8 |function populate(){/ U3 }$ W' ^8 L5 f
if (iedom){8 j. T9 W. D5 @2 C: d+ K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 R6 x; s( ~6 E: w _, B" Z. Kcross_marquee.style.left=marqueewidth+8/ [* o* f: ?. i. [/ `9 s# A
cross_marquee.innerHTML=marqueecontent
2 \5 I: A* D' ], A: `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 A7 p6 f, ^- w4 b7 f
}
& `" R8 n- V- _7 B. helse if (document.layers){+ p7 P9 e7 k( ^5 @! j: j, j
ns_marquee=document.ns_marquee.document.ns_marquee2
4 w D2 V8 T+ N- j5 ]ns_marquee.left=marqueewidth+8. B9 \. H& x- |0 V/ ?5 q2 y% |, Q
ns_marquee.document.write(marqueecontent); r! E8 T$ C0 b1 m/ l
ns_marquee.document.close()* q8 g7 l/ z J
actualwidth=ns_marquee.document.width0 T& H- \1 H' w1 L5 r6 R! x! O: G
}2 K5 E8 X* d: n3 ~
lefttime=setInterval("scrollmarquee()",20)3 L; X! x+ i# v1 _+ e3 e
}
8 m9 `6 S! _( A' _% a/ X7 rwindow.onload=populate7 ]$ a! [7 Q+ b; q
( u8 j4 G# h& x, z
function scrollmarquee(){
9 L5 Z- z+ K+ vif (iedom){
3 U+ l4 ]4 k) E4 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& d$ ?3 n4 \6 T/ e( P3 K! m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( b4 p$ F6 `7 \3 i0 g( a8 o! Eelse) A ]: J1 N4 o5 O3 f ?
cross_marquee.style.left=marqueewidth+8
{7 c" D2 M& A. h6 F, Q/ B4 t K2 D8 |& v6 r7 y- W% J
}$ E+ p2 [! S3 L1 t. P
else if (document.layers){4 F* u/ y: } i& R
if (ns_marquee.left>(actualwidth*(-1)+8))
$ d0 V& s0 X4 j Z1 G$ f: ?ns_marquee.left-=copyspeed$ D$ R6 ^6 w$ f% }3 Y! D. d# Q
else
$ S) ]: g/ ^8 t2 m0 O) v" bns_marquee.left=marqueewidth+85 X# q; \- e8 f5 @4 J T
}3 w3 t o% m4 q B8 m6 H1 ^
}8 V1 `5 V+ @8 B# g0 r. D4 V; ^1 y* E p
1 u: f Z. W# Q5 u2 Xif (iedom||document.layers){
& x) q1 R; ?( c o( k+ E0 e- V! Kwith (document){) w& K" \/ |- Y/ o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 F0 X, K6 E0 S6 n, t% w, [9 o: y
if (iedom){
1 Q" Z. e3 b$ y( \) Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 T$ W1 m% @ twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ e# i8 U3 m' o$ [1 ~+ Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 R" n# z4 F! [" ^! T' I ]write('</div>')# V J6 W* M. k, m7 D# n" V! [1 w
}
7 ?- [8 O6 s' k+ M" n6 x2 [7 Lelse if (document.layers){/ Q1 ^. U* |/ |, a) \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 E$ M/ @4 `4 `* X, Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ E: m- r, d; E7 M2 Jwrite('</ilayer>')$ }* b0 H$ V$ N9 t9 V
}3 `1 h3 h3 g. U
document.write('</td></table>')8 n3 Y4 p! l/ k+ y
}4 I7 i$ `) w" M* F* J# b- Z
}
( t: }7 ?( _! e) E4 c, _</script> |
|