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

|
网页之跑马灯文字特效
//修改宽度& ^; @/ K4 z9 f+ K& P
var marqueewidth=300& ~, X* \( q5 z+ K
//高度, p! ^! F( _6 s* l
var marqueeheight=25
$ h3 I: b$ q) J; c( p" z3 A/ m//速度(1-10)
: W1 y5 _* _; N# ^- v1 yvar marqueespeed=3
6 y" l4 B u, N! Q' ?. {% j# a//背景颜色 V* Z6 G6 \9 G) f" g
var marqueebgcolor="#FFFFFF". ?" h- W% a/ A0 w4 R
//是否能暂停 (0=no. 1=yes)?" D( T* r9 R( i/ W y9 m& f
var pauseit=1
5 z* d3 u& h+ V- |/ M8 y+ b
" B3 x8 @0 i: `8 @# W& q: p" u//修改显示内容' `, I) w* Q/ [- i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" f& ?8 ?& t) e1 i0 t& ~( k1 A. Z8 v7 G
: Q& Z/ U( _$ k) r. y& g! ^( ? c4 q( E2 J
////下面不需改变////////////
. U- q; P2 Y/ L# p+ x! ^, z5 S" k, ~
" D( q! Y; Q4 I: M7 |- _/ K& Q" Y& Wvar copyspeed=marqueespeed! d4 W1 X2 J! L8 A0 ]
var pausespeed=(pauseit==0)? copyspeed: 03 \/ E7 t' {2 g: ?
var iedom=document.all||document.getElementById' A2 }9 ?6 I# D N3 h3 ^
if (iedom)' S9 l6 {( @2 I; P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 X0 p8 Q9 r, E3 T. [8 }var actualwidth=''
4 {! d4 m) Y, j" o1 y& jvar cross_marquee, ns_marquee
* t: o1 d* g% {2 q) E7 U5 h0 I- P9 l% j" p* b! W
function populate(){
8 q( X( w2 C1 \1 Mif (iedom){- }7 d8 L: Z2 F& _; ~: l! r, z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: m3 j2 o6 o* [' |
cross_marquee.style.left=marqueewidth+8
: l$ P, T0 v' K/ c2 R4 _5 F6 m# C$ Bcross_marquee.innerHTML=marqueecontent
2 J% _ |* Z7 v' s9 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, b# H; [% j0 ]2 M
}0 l' w8 q/ u9 ^5 ]
else if (document.layers){% R1 I. w6 H8 Q+ p0 \6 O, g
ns_marquee=document.ns_marquee.document.ns_marquee2
6 l9 T9 B; V9 `! S* x' Xns_marquee.left=marqueewidth+8
, C( Y+ J, z" Cns_marquee.document.write(marqueecontent): ]2 Z7 w1 b* V& @! s! R/ ^3 P& e& s
ns_marquee.document.close()2 u; z) ^. I. |
actualwidth=ns_marquee.document.width
2 n# y4 y' _' J) h: L5 J} K1 H5 c4 N6 Y U$ m3 w3 \+ Z0 }
lefttime=setInterval("scrollmarquee()",20)
, E* P; }0 g/ |' F}
5 @$ w5 n+ E, W) l% P" N0 e7 D6 Kwindow.onload=populate
+ \! F$ \* J* ~3 D" ]/ i5 x0 a1 p( @% K* S
function scrollmarquee(){
) s# ]: [: a* M) L/ [7 e4 nif (iedom){
5 @ r3 m/ V- Y' E; N0 G* oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
H% q2 i0 G: }$ w/ }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' q& O0 |- i9 y6 X" F' m0 yelse0 Q: q9 l& N& ?5 D8 t$ e+ @, H
cross_marquee.style.left=marqueewidth+83 i2 c2 _. T$ l8 ?5 `4 z0 ?7 w
% r0 |7 L$ A# |' q
}* h0 a2 x# a: n7 k4 ]; ]
else if (document.layers){0 Y; E W8 j, Y
if (ns_marquee.left>(actualwidth*(-1)+8))
3 ?" J8 G# {) wns_marquee.left-=copyspeed- I- e& u4 Q5 q; ?
else
7 }0 n- H: }* ~3 P4 q3 v( J! q% e, ins_marquee.left=marqueewidth+8. a+ y3 ?, s0 r1 H* f
}; ]+ S9 j; Z3 ]: V8 i
}; a* J4 p; b) ~$ {$ u# N; S) T2 G
& Y! X; D- e! Z \8 t
if (iedom||document.layers){3 i) g) m) l H) G8 |
with (document){
- C9 ^$ F, w2 V) Q B7 Q( d0 V" K. W( Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ^* j# R2 s0 K3 T$ U2 Aif (iedom){% S* Z" ~4 l8 B7 i! j# F, O6 t2 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); I# r$ K) ?$ I& Z' n7 v8 b8 _, h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 ?" @# v% C4 B, _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 e, [" k) E: _: dwrite('</div>')
& B1 w, d) H0 E3 X& {3 j}% v4 D& D( Z+ _, o B9 E
else if (document.layers){
( u- _+ q; Y( o) Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! _2 D; M5 ?3 x' }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% D. S: _2 ^. H' L& K
write('</ilayer>')9 _* [- G; c' m# j% |
}% g+ {7 ~4 v3 Y$ ~* ^
document.write('</td></table>')0 K( {4 _9 u2 j1 P
}
2 o' y& p# j8 X* N% ~# H}
, d: f5 p- _. V! K8 g</script> |
|