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

|
网页之跑马灯文字特效
//修改宽度
8 G/ a# N- T) O* o6 m" hvar marqueewidth=300
" p1 {# v: Y4 R//高度
! z0 Z M- \) j7 K5 M: Bvar marqueeheight=25
+ m3 Y3 T, c$ S5 y& M//速度(1-10)# l: z/ z- o) D+ M$ x% Y0 V
var marqueespeed=3
k, n! ?5 U/ I! `/ U4 y//背景颜色
" ^' k% O4 }) N& K* V- U( jvar marqueebgcolor="#FFFFFF"
1 y4 q, P/ E! w1 s//是否能暂停 (0=no. 1=yes)?
; W$ ^- g- D: u6 T% Q( v& Zvar pauseit=1& |. R9 c% i" H
9 k: f# R: g# L, R* y//修改显示内容
0 \0 j, @( _9 X( U/ ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 [" M+ p& Q. }4 C) ~. ?
* `# U( f7 k( J3 X. W: s4 H
6 h2 |" ]( a, o////下面不需改变////////////
2 O( d* M5 N4 [& u5 I/ @9 E4 f+ @1 z" v" e) t( h6 E
var copyspeed=marqueespeed+ c# O c9 U3 L
var pausespeed=(pauseit==0)? copyspeed: 07 M) T0 D/ j' I: z2 c8 `
var iedom=document.all||document.getElementById5 H. B! F" m% u: O2 a4 ~3 A% [
if (iedom)0 b1 R1 _; x; q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; F- r, y( G1 `+ gvar actualwidth=''( L k( v- @0 N* ~
var cross_marquee, ns_marquee, S. f5 V2 T, i7 L' F3 k; m# a
# Q( t. i0 [. v: l5 ifunction populate(){
& d- s' N& Y+ ^ r8 W" Zif (iedom){
$ C' |% R! I& ^" S7 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# F& }) C2 z2 L1 |8 qcross_marquee.style.left=marqueewidth+8- a Q% j# D; R( o9 J) ~$ \
cross_marquee.innerHTML=marqueecontent& l& p: f) n; Y- R4 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* M1 X' T7 z$ I5 x- Y}/ t$ \! g6 z" V( l `
else if (document.layers){
- |( i0 n, t0 `2 }ns_marquee=document.ns_marquee.document.ns_marquee2- B; ?0 x$ M/ [9 ?6 [+ ~* z
ns_marquee.left=marqueewidth+8
0 Z, f& A) `$ ?- Z& {/ yns_marquee.document.write(marqueecontent)
0 y! x5 G* C9 _6 y+ t! M0 bns_marquee.document.close()% m7 F4 \5 X3 z( x: w9 i+ l! }
actualwidth=ns_marquee.document.width3 d4 p! p% ?7 k M$ y+ {6 `
}
5 n! a5 n. p5 I2 _3 blefttime=setInterval("scrollmarquee()",20)( l" S& M8 E$ z) U" u$ ~
}
$ I- m" Q$ b7 O6 ^( ewindow.onload=populate% E8 o9 h4 ~2 F$ g9 t% m Z8 J) P
( o! _4 Q; w$ ?6 f2 ~1 {function scrollmarquee(){
) Q& J% l5 u* D4 ^& V8 `& S hif (iedom){; K/ K. @8 x* ]6 I: Z" l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* D0 ?: S$ d0 p7 t. Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 o! Y+ O; Q0 R3 R- Z1 [+ Melse
$ k0 I& W) P' y$ ccross_marquee.style.left=marqueewidth+8
9 v5 f5 r% u- N, Z6 u. }' ]8 h0 h0 P0 T8 [. `+ T; L3 G+ q$ l
}2 j+ W- P" b4 A. x# w$ t m
else if (document.layers){% r" f8 S. T2 O0 S8 R0 T2 y. z: ]
if (ns_marquee.left>(actualwidth*(-1)+8)) c1 n0 g: P' G8 w
ns_marquee.left-=copyspeed
& r/ b0 _$ R9 A; N+ V, e3 M& lelse
; ]+ r, ^, ^+ l, d8 ~ns_marquee.left=marqueewidth+8% c+ d5 s) L Z* w: a
}1 S8 ]4 m2 {6 ?
}
( z1 q1 ]+ k( v2 @+ P" }' H6 j% J: \6 l" F
if (iedom||document.layers){) q! M0 M+ D4 P6 X) c2 Z1 u
with (document){
% M2 Q' T7 f/ G0 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% {! g, V9 {7 N1 r, Bif (iedom){3 n7 F9 q+ W9 p( r. o/ T8 Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" V4 ~3 t/ d+ r+ Z+ `, A8 y! a7 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 R6 T M* y7 c. m' N! H, [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& H0 G: r: }9 Z( w# d9 Z- P2 xwrite('</div>')
% [; L% f: W, D$ I1 Z) N}. e8 J- M$ f- y* ^& c
else if (document.layers){! m8 v" d: ^9 J, e/ s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; [% W: \. Q' \2 e( d2 jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& F' }( w( k. P
write('</ilayer>'), u7 ~$ E4 ^7 L1 t- H
}
6 P1 K* I9 P& ~$ odocument.write('</td></table>')
) A9 {. n/ |" t# o6 O5 x+ i* U5 L}
8 c% m4 ~! a7 J& h}
1 O2 U& z: r* m3 T6 t" y! s</script> |
|