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

|
网页之跑马灯文字特效
//修改宽度 S( V f# p$ W, G, [" P4 @8 s: ]
var marqueewidth=300
0 d& q, z) ?" }/ w% {3 o' b U//高度$ }7 t# V. y& J# f9 t7 i
var marqueeheight=25
. j ?+ x6 |5 F; V+ z: W1 s) \$ f//速度(1-10)
9 @* h3 A; ^1 rvar marqueespeed=3# n* d1 M4 k& G) a. ]" d' c
//背景颜色
& q3 V1 o P& r: r0 a/ `var marqueebgcolor="#FFFFFF"5 c! N# f, `+ y
//是否能暂停 (0=no. 1=yes)?9 c* u s0 d2 E( r; Q
var pauseit=1
, F* m Y% ^& U3 f+ `- b
4 V y+ ]6 L# v9 {//修改显示内容
7 y+ \2 R( K" U% [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 t) t% p% P, R# g) r6 y; b$ D- y. q
2 F. w. A3 U# b9 g/ P0 G. W, u: q$ J( W0 D. c3 U3 d( n/ G
////下面不需改变////////////
, `/ w) q4 K2 p* U( n3 a
) `6 {+ e% H1 t$ W6 r4 d% cvar copyspeed=marqueespeed
0 h9 m( }4 i4 F6 ^var pausespeed=(pauseit==0)? copyspeed: 0! l* a) M) ?/ ^; n8 z" I# O+ O
var iedom=document.all||document.getElementById4 l! [* i+ B- {8 K. e, ~, v" k3 O
if (iedom)
. u- M. Q0 x0 @$ r. M$ j* wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 |. N! f9 ?# l/ Q& V) v
var actualwidth=''
2 y5 A4 y0 ?7 S+ h- Uvar cross_marquee, ns_marquee* x" l( R4 {3 ^$ D
& x3 }! l- Z) N* p# `4 Vfunction populate(){3 b& Y0 G" g- }% q
if (iedom){
6 u6 A) X" j& }& S( ? ?: F7 `3 bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 @+ {9 g$ q" r0 J+ T& m( ~4 L
cross_marquee.style.left=marqueewidth+8
) C) Y3 @$ F8 C# o" A4 h2 Ecross_marquee.innerHTML=marqueecontent& G6 X$ _2 y- r# i6 _- e: ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 k9 f$ }2 Z! L1 ^6 o}; Y/ ]) k* l/ S+ C0 l% [
else if (document.layers){
9 j# y7 `; u8 z) @& \. u1 c' Ans_marquee=document.ns_marquee.document.ns_marquee2
* H2 u0 s! a; M; r3 @8 gns_marquee.left=marqueewidth+8# o. N; M: l( @/ T5 u
ns_marquee.document.write(marqueecontent)
9 U) o( _# P( yns_marquee.document.close()
# w& k5 w c" W6 r, cactualwidth=ns_marquee.document.width+ G7 b5 H4 W( ~4 ]% _
}
3 p( Z5 C: L l0 H& `1 O- E Elefttime=setInterval("scrollmarquee()",20): |& p2 i* _* C4 X" s% i# P
}
! t' {# H. H( awindow.onload=populate6 I9 C$ H ]+ H0 [+ u# z9 x
/ E1 c7 Z: i, Y/ f7 d' s
function scrollmarquee(){( L* ]) k- o$ @- ^2 l
if (iedom){
# s0 N' O6 N! _+ ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; R- w+ c* O6 Z5 Y* scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& D+ P. A9 G9 J: _2 Q1 celse
9 Y5 ]/ Q) G$ Ycross_marquee.style.left=marqueewidth+89 W7 n+ V- w( U+ u0 O
3 ~ u- D2 Y6 D* @' w
}
8 E+ y! b1 S: `4 Nelse if (document.layers){
0 V" j/ d& a/ z _- ?if (ns_marquee.left>(actualwidth*(-1)+8))
" w$ ~) f3 C; W7 h# H9 W& b3 W( rns_marquee.left-=copyspeed8 C( ?6 E6 E- L: R7 W6 @
else& }; L1 i( T% g" p$ ?
ns_marquee.left=marqueewidth+87 H6 c: g7 ^# X2 {
}
% u2 N2 V& x+ B0 l7 D0 C}
' B/ f: e# M4 N" P1 P. d9 P _: y$ O9 C2 o& w( Z5 C. d4 B2 }2 a
if (iedom||document.layers){: t9 ]$ P1 u" Y0 a f, P; p9 l* f* f- X
with (document){! C" K" r( R1 V5 f3 h* _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; b# a4 a4 P' g$ N# Mif (iedom){
- w2 e* }; y1 L" Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% [" `( |; o3 I4 B+ wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 Y. E: j/ O1 z7 R+ uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') ?7 H0 S% a' g& s5 v- ^9 y
write('</div>')8 _* w" @, S& B
}1 F6 l1 v& D; |) x
else if (document.layers){! d- F( L3 v' G4 n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! l( x+ v$ r, bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' o, z% |1 ]. [ y$ ^write('</ilayer>')
5 Q' c- H/ W% h. C8 p" S}* l; ^0 C8 Q8 L
document.write('</td></table>')
) [* s" B( _9 S. _ H' P}
5 }6 E5 V: f4 f) } b}: r# |" z/ }3 D( }
</script> |
|