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

|
网页之跑马灯文字特效
//修改宽度
5 ?% h$ q$ \. `var marqueewidth=300
, c+ ]$ g1 v9 W7 ^7 A$ q//高度
3 n' z5 w& v8 h. ]9 evar marqueeheight=25
5 b! B4 ^: T* q6 h# R7 E# v//速度(1-10)) l' M0 |$ J$ W5 J
var marqueespeed=3
+ k r7 g5 u: {! w Q//背景颜色
: m1 f* G- n! ?$ Tvar marqueebgcolor="#FFFFFF"
# B& z! m) G7 a* ?7 F' S& L9 z: F* v//是否能暂停 (0=no. 1=yes)?
9 `6 w" w. w# F- A: R; Evar pauseit=1
( @3 R% z# T- e' ^4 v8 A
3 K0 l# k% I# t2 }; F. x//修改显示内容
; g- F& `. ^0 O: [/ pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& _. l& _, i8 m5 J8 v
, L$ ~6 W E9 `% R) c: d5 R& ~* S8 D- _0 k
////下面不需改变////////////0 T5 p$ d5 o- y
+ o7 {' h% J7 h' [* T
var copyspeed=marqueespeed+ B; O1 R) o3 b" ^
var pausespeed=(pauseit==0)? copyspeed: 0
% c6 C# J; Z! @var iedom=document.all||document.getElementById- [6 M5 C8 k. v8 j7 t% f6 O; k6 d
if (iedom)
! c9 w1 B. m% e6 Z+ S; a3 {% Q/ t$ ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* J8 w5 N5 K6 O7 K! I x/ e* x
var actualwidth=''
2 p6 ]+ S4 D- i9 K! Ivar cross_marquee, ns_marquee" V2 x+ a6 o. J2 @* f+ _4 W4 O
' P2 U, G0 F! D9 J8 Efunction populate(){- }+ `* w$ ]; a8 k# n
if (iedom){
: S i: Z3 ]5 G' z) ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& y7 G0 C* B. |3 ?cross_marquee.style.left=marqueewidth+8' S5 o0 n P" n; M. F
cross_marquee.innerHTML=marqueecontent
! Q2 p* j2 U9 M$ aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ M; {: z+ ^. v8 m3 E/ a}7 _2 s. E+ k5 c8 r4 c: P
else if (document.layers){4 x) `8 ]7 O( ~0 T
ns_marquee=document.ns_marquee.document.ns_marquee2, T* |+ U! L4 ?: e5 f! C' p
ns_marquee.left=marqueewidth+8
! P- j D# F/ M! t- h4 pns_marquee.document.write(marqueecontent)
( g0 g7 a1 f6 T# f- _ns_marquee.document.close(). h9 E- Q. F$ T! E8 z5 j
actualwidth=ns_marquee.document.width
2 I" K- G+ i4 ^6 I7 w2 x3 S$ M}
; }/ S) _/ [& C# E8 L8 ^3 `7 a1 vlefttime=setInterval("scrollmarquee()",20)
: y% Z+ r- ]2 K' D' j- u}
. O6 [( @' X" o; N) S& nwindow.onload=populate
8 Z/ w0 c/ ?! F, C7 N5 j) m. E3 Y7 d* C
function scrollmarquee(){) c+ M& `$ K& e+ N$ J8 n5 j
if (iedom){) Q' r5 ~, C/ e1 _) Q0 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). R$ V$ J `% E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 F- _8 D9 I8 ^+ p" z4 yelse
" V6 ]2 p2 [* r* V3 b5 kcross_marquee.style.left=marqueewidth+8
7 U* P2 }7 {7 ~: V% D3 u
* q) ?8 Z% g/ l% Y, f/ K. w}. W/ z3 y; I' H8 \: Y5 E; j. G
else if (document.layers){% @1 U2 ?+ c) p% m) ]
if (ns_marquee.left>(actualwidth*(-1)+8))# n7 E. S w+ o/ e- u" c& Z
ns_marquee.left-=copyspeed$ t- Y: s1 a0 T6 z2 B
else1 ?/ a- s0 b' I p, x% Q
ns_marquee.left=marqueewidth+8, r B7 j* i8 u$ S
}
; H2 y3 ~+ s# |" g5 F}2 _+ N% y# r3 d. {
# G: `4 S1 y7 Hif (iedom||document.layers){
6 l+ k# U' Y! o0 f* x) p* Fwith (document){
. w5 F8 t% V1 |$ |( Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ S; c% m0 X: u4 hif (iedom){
, Z1 E: ~4 D# U% t' h* f/ Y+ wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 x: q! g% i; |6 N9 Z% P) ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. M1 ~# ~1 ]& K" I7 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" i- y9 a' h5 a- f+ E
write('</div>')+ b& i! i; N$ b3 m4 z4 i
}
' D+ a7 E ^* H, F- W g- Felse if (document.layers){2 E- D: ~ |) e" Q& i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 ^. k* f r' p; M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 f3 A4 l1 W5 ~5 B/ S
write('</ilayer>')7 H3 b& n1 s4 s; |) S6 _
}
5 }+ G _5 D8 n+ ^! Pdocument.write('</td></table>')5 K2 K, x: W) T7 v9 Z5 a( G; `
}
& z7 n2 T8 z, W5 {+ T' X}) N( w, F( s; G+ R
</script> |
|