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

|
网页之跑马灯文字特效
//修改宽度% W/ t) M$ ^: @; t" n- b9 [" m
var marqueewidth=300- w6 d! F$ k8 d; }
//高度
. C" c& |# X8 Gvar marqueeheight=25: r2 G8 s7 T1 b. i: x/ f
//速度(1-10)
7 J0 f3 z2 `% b5 r& A7 \7 ?: p- Dvar marqueespeed=3# G/ Q& W# \& N
//背景颜色# e) i9 [8 B) e9 \% M
var marqueebgcolor="#FFFFFF"
7 A4 `; X* |+ P- E4 @* o3 L" d//是否能暂停 (0=no. 1=yes)?' ^! W0 E" G+ i6 }( }& E# z2 C
var pauseit=1
$ ~2 `2 t& b% G9 r. s2 t3 P: Y) c) e! ^, J4 N+ u+ m* }" }
//修改显示内容
9 Q: a1 `5 p% Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! J1 Q+ {$ ]( x& w
& `$ R' P, r; E1 w, v/ u
9 C; @# y0 A. x G
////下面不需改变////////////
% I0 I( M7 h+ K% C( a# ]! y! F& y# _8 t6 P! ~7 ^. Q
var copyspeed=marqueespeed
5 y* J% V; s/ k' Xvar pausespeed=(pauseit==0)? copyspeed: 0
& C) ?7 z$ r+ t1 dvar iedom=document.all||document.getElementById
6 |# D' k# W& G. d/ zif (iedom)% q8 @; a7 Q( d4 j( L* a; M* |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" K9 P6 \& g7 T Nvar actualwidth='') a9 B g; c0 v( k- M, L
var cross_marquee, ns_marquee# M9 c% C! f7 h7 `9 r
) f7 r7 ~/ u' u1 z8 f& u* ]
function populate(){
' P( L3 W0 _+ u. ?9 @* w) Rif (iedom){1 i/ F$ G$ E) Q* O2 V O2 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 i) C7 i& V& }! _$ z9 E0 q! zcross_marquee.style.left=marqueewidth+8
O5 \/ Y- R0 t9 y; l6 x6 @, O1 Wcross_marquee.innerHTML=marqueecontent/ W: ^- B) o y i3 U2 [0 P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 K2 o% ^$ @7 A5 f+ p}/ w' f3 o+ g. @! t: f
else if (document.layers){) r+ b: _# P: Y$ `: m% V' h, h
ns_marquee=document.ns_marquee.document.ns_marquee2
. {. r& s, `9 G5 `ns_marquee.left=marqueewidth+88 t0 ^/ a* g' _7 {9 I' o. f
ns_marquee.document.write(marqueecontent)
/ N! h: l9 m5 }3 Z' k8 R, |ns_marquee.document.close()1 ^$ b1 R3 e$ U/ U B6 L3 |, s
actualwidth=ns_marquee.document.width2 h9 }, M, B3 [2 d. O1 R/ E
}! h" V$ V6 ]9 V# ^) F
lefttime=setInterval("scrollmarquee()",20)
# x# G' |% h, N! e. [1 J}7 h n0 ]$ k* s: `0 B
window.onload=populate
@' s% F1 J4 z" N" n5 j
" m; o* R8 {2 x0 o- \$ jfunction scrollmarquee(){
! X m( T3 d; o. _3 ^! E4 o' aif (iedom){
. ?9 p2 |5 L4 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! ` o" D$ A& [3 ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ n- Z' d3 s! W5 H
else
0 o+ F8 J9 t2 P+ Q7 E0 Dcross_marquee.style.left=marqueewidth+8( c: b+ d( {' j, l
! m- Y' m* o8 v( m6 t}
+ y& G, ]& g) S' zelse if (document.layers){
" d; Q+ K$ D( K* x- w5 Jif (ns_marquee.left>(actualwidth*(-1)+8))
: y3 v7 f# U( M) F4 l; jns_marquee.left-=copyspeed& e# X4 p' @0 G! i
else
" {1 I3 K3 _% jns_marquee.left=marqueewidth+8
1 J+ A8 j: V" q% z' `, C0 Y' U2 e}
1 F- n& J% Y, ?: p% [* _}
- O1 h$ q1 h. N7 t
$ z4 i3 \7 S& J% |% W# x! J) lif (iedom||document.layers){- d3 X& ? ~- v+ {. W' D& I+ i0 Q! e
with (document){. R) N1 i! Z* J) \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. r+ ]# T6 E" h2 E% nif (iedom){7 J+ ?$ Y& h# y: S4 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ v5 i2 ^% p, p! \& S% c& }" kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( M1 K7 j" F2 ]5 Z# \" _: @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 j d- {% h- p! C$ l+ c: a
write('</div>')( C* M$ q) {! @$ x
}/ o+ m" M% a+ C, |
else if (document.layers){! K/ g& } Q0 G2 b) W J5 J7 c% [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& a+ f/ v! J" @8 e3 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); }& |, @: y3 y W; s. N6 a
write('</ilayer>')
: G( j: k2 u; I, C! H}' c- m: h" H4 O! K' ]9 R
document.write('</td></table>')
* t8 i" C8 ?" Z- i" N, G- a& \4 @4 m}
9 ]9 Y }4 E# x V& @" w( P, r}
* ^, B# y/ ]" u( @</script> |
|