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

|
网页之跑马灯文字特效
//修改宽度
# b" b5 T$ r5 a5 s. u8 G7 B) qvar marqueewidth=300
- N. N, I8 A( A; l7 Z, m8 @//高度
/ Z- x* A2 _( o$ Lvar marqueeheight=25
5 ]# j& X. e0 G0 R//速度(1-10)5 ^: K$ S4 ]% J. d, [6 d
var marqueespeed=3
6 s: z4 n! Y" @) B7 P) u5 v. y: u//背景颜色
) x) c n3 y& Y8 P, x0 A$ [var marqueebgcolor="#FFFFFF"
# G' ~ ?1 [) K( a( l+ G//是否能暂停 (0=no. 1=yes)?* ]1 h- T$ Z$ G8 ?2 H/ k
var pauseit=1' ?( B4 V/ t2 [# Y; U4 w! C& }' R
* w9 Z( \/ X' ?, F7 ~3 b, ]" B
//修改显示内容
~( L5 N* o, Y( Z$ svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 I, A/ f' J# k
: W, r: \) h1 f$ ^; K" s# q
% M9 J! Z% m9 B: a/ [7 [. \" s////下面不需改变////////////( q3 t4 F' @7 H* i5 l
" w6 e$ O( m& e q, ~3 q0 y
var copyspeed=marqueespeed
: d. n. B) p4 f$ Pvar pausespeed=(pauseit==0)? copyspeed: 03 y. m/ d7 F! h$ V
var iedom=document.all||document.getElementById
. ~3 N( @ z% a2 Qif (iedom)
% ^: p& H: c) Y( Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& C6 P, j, I% R) g2 Qvar actualwidth='', w* z" {, m% d" x) g4 ^, [/ d v
var cross_marquee, ns_marquee7 b" }' s: A: z1 ?' R
+ |7 @4 W% }! [; F( v) ]- `: |; m. C
function populate(){- Z+ {0 I2 {3 R5 O# r
if (iedom){# L2 [" k$ |+ p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee T2 R2 h& U3 B" \
cross_marquee.style.left=marqueewidth+8
+ s% v: S8 q7 `: n, wcross_marquee.innerHTML=marqueecontent
& N& L' A+ Y0 S9 F1 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) E4 _5 `/ y3 p& r" X}) Q! I* Y% h: f' L. S! [, S' L
else if (document.layers){
8 q! \" E1 R$ Vns_marquee=document.ns_marquee.document.ns_marquee2( F. _% G6 ?. b1 J" K) s% c
ns_marquee.left=marqueewidth+8
- P c6 o+ S: `3 L; Ans_marquee.document.write(marqueecontent)7 ~! f& o/ A# j$ c1 A/ y
ns_marquee.document.close()
5 M; T3 B2 j& H5 _! B* D2 ^2 e* kactualwidth=ns_marquee.document.width3 g7 o8 V* M7 R6 p+ \! X5 s
}
, ^* B. | { ^3 B$ E, Glefttime=setInterval("scrollmarquee()",20): o9 w" F" Q# y7 g, _
}$ a5 g; i1 y I" z/ _
window.onload=populate
+ K U9 N1 t3 X4 S' E7 h4 x$ y$ X* X7 a3 r4 e
function scrollmarquee(){4 V X0 F6 a1 o+ c- D2 u+ W, ?3 @
if (iedom){
- H, Y4 `$ @) } ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). F( U( O) z. K8 F/ i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! S" G; {1 u( R" }6 ]; W7 y1 _- _else: o$ s" B% B4 i/ j! P, S. t
cross_marquee.style.left=marqueewidth+8
) E, D1 w7 R( e9 m; }1 I! d0 i' {& C1 R
}) y7 o) _/ V4 `* ]# G
else if (document.layers){
7 c& G2 ^$ [4 B2 ~' u) tif (ns_marquee.left>(actualwidth*(-1)+8))
& r7 q/ E' P' ~2 l* s7 Y0 rns_marquee.left-=copyspeed* G* h5 p6 P4 B2 O! J( k+ {& z
else0 o5 D3 _! t7 ~
ns_marquee.left=marqueewidth+8
- U6 l8 H- P3 e. L}
- i) s0 d9 i1 S% Y6 N4 N+ V6 V% K}
) m" f! R4 Z/ @0 P
& a- {9 I8 Z8 I( R. C3 \: L: C- u& lif (iedom||document.layers){& O, g- Z P# z u U) U2 [, T
with (document){# ]# B) O1 \: Y5 O7 W& } T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 [. ]0 d) N# y# V/ q. U. S/ g2 ?if (iedom){
$ V5 ~8 B- G& Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" D; e% q V1 a b3 X# ~2 P4 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 A8 u# e( e7 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), O+ r* I- s* s9 o" D: {% g: `% p
write('</div>')3 s! s: P" E) P1 B, r
}
8 V# r7 o: Z# E) R0 _else if (document.layers){# U# \$ z$ d! Y1 u2 `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# a7 \- z- D" k) T8 \' Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* |5 k. @" h3 ^5 ]- Y, R) W1 Zwrite('</ilayer>')
4 E S( P/ K, X" S2 a; n, F}
. S" ^/ W$ y3 Z& K; e9 ~document.write('</td></table>')
5 P t# u. A- k/ W9 q' |}' Z; Z4 H& {2 ^ [( ~: Y
}
3 ^: o" O1 ?& x, r7 g3 C7 Y) K</script> |
|