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

|
网页之跑马灯文字特效
//修改宽度3 \: g4 p" D) `& W3 l2 x2 A
var marqueewidth=300+ A0 v' A' \ ?) Y l& J
//高度
: @3 y2 t8 P% m9 ivar marqueeheight=259 i, g1 d5 k. W6 O4 o
//速度(1-10)
6 P. w0 k6 s/ R' P7 Dvar marqueespeed=3 e+ L( A" E( |( ^3 c9 K+ l8 F2 d% G
//背景颜色
/ c3 q! J$ G) G1 j2 J" I+ Uvar marqueebgcolor="#FFFFFF"
. o' q! Q6 |% f5 c//是否能暂停 (0=no. 1=yes)?
1 o$ ?0 V) Z+ rvar pauseit=1
: x2 t; [, g" J- j* r: ?* X! b4 u D! e1 r- {" g
//修改显示内容$ r1 }* J3 q. x2 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 |) e. b! v1 h6 s4 m7 \# u$ d& U v. ~7 ~: ^
0 ]) b. [2 d4 g* R% m, U6 V, @////下面不需改变////////////
) v/ e# a5 n+ p+ }6 L% @0 F, L
8 n4 C- E3 [+ @+ L$ z- v( H3 m& V0 ^var copyspeed=marqueespeed" [6 s. V7 Z9 w) `6 S! u- D5 i
var pausespeed=(pauseit==0)? copyspeed: 0
" V, J0 ^9 r/ w3 s' p. _var iedom=document.all||document.getElementById
( b* N# \' h! s6 o# uif (iedom)% ~+ D) _! G% e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' D% X% t, B5 U- |5 a
var actualwidth=''
/ W, @* @- I( @; @. Fvar cross_marquee, ns_marquee' s1 v* b/ n" ^" F% P9 `9 m; e
7 |9 F" |5 S5 P( hfunction populate(){
( Z1 c' ]# {3 u( Vif (iedom){9 d) ]4 z9 D/ S2 @3 J! n# R5 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 \, H: J; ?; N; ]8 ?; S
cross_marquee.style.left=marqueewidth+8
6 O; w. d( u6 e. I; scross_marquee.innerHTML=marqueecontent0 }( y+ p% A5 s8 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- l$ x- M1 s$ x- r; c}- T4 j M. m3 g! X7 O) u5 `, p6 r
else if (document.layers){
2 m$ X) `; t) tns_marquee=document.ns_marquee.document.ns_marquee21 E$ n% m6 P X) F: z/ H
ns_marquee.left=marqueewidth+8
* _" s. H1 I) h. C9 gns_marquee.document.write(marqueecontent)3 R! E" u4 c- c. K$ J! e/ T% I
ns_marquee.document.close()) G* l) ] p* Z6 i
actualwidth=ns_marquee.document.width+ [9 c" d: B& y( M( }8 Y
}
$ O6 ?: A ?, `lefttime=setInterval("scrollmarquee()",20)5 [+ R g, r, ]4 L
} @ ?1 f4 v& P0 y, R4 U
window.onload=populate
, J& G4 g- Q8 [; B: N* m9 T, r# w
function scrollmarquee(){
' \( `3 N+ R) `* L( L% S) ~+ Hif (iedom){2 [; o" _, H8 k4 f1 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 M" k @$ j, P6 `! V8 N, Y8 a% F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- _) X" O' ` r; l" B" }6 H" T
else5 n$ D" M5 O9 T' l( o6 z2 Y
cross_marquee.style.left=marqueewidth+8
8 [# i% ~$ ~! C& z* X4 H$ } W+ P5 O& ~2 V7 f, B3 `2 f+ Q
}
% `4 A2 R& `+ @9 v1 o% d* Telse if (document.layers){
* j4 J+ z6 D: B) {if (ns_marquee.left>(actualwidth*(-1)+8))
0 v# F! T$ z( p* I6 H# _! d* h$ Jns_marquee.left-=copyspeed
) t3 G! n- X: Z0 ^else4 h' [% _; Y4 r% A H
ns_marquee.left=marqueewidth+8
[ t$ u3 ~ g}
9 H3 `3 O2 ~% B7 X) }- G; Z}3 Z$ ^" t. d5 Y# R$ z5 x* g
9 V+ ^* X; D9 h% c+ x3 j" I& Vif (iedom||document.layers){
7 p2 ]& ?1 l7 [( e8 P" V' Twith (document){
! ~$ i) k: }5 V. U1 q$ u% Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# |! T% g( y+ x5 S( G- O# yif (iedom){
8 u5 h# a4 h- U2 L8 {- kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 V( z4 K+ H& X1 m9 I; ^! Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ v3 u9 P& [ i7 T9 [- S8 ]- Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& p# {+ |( q+ Q2 K: A3 b+ @write('</div>')6 A" g3 ^, X& t
}
2 @: F' V9 U( ~8 d' nelse if (document.layers){4 [2 }' d3 y( k% d5 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): U" s# I# ?' `: @7 n! Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& R% C9 i1 Y+ F* h# }. jwrite('</ilayer>')
) [ l0 I5 V, y& _3 ^}
8 e" A1 w" y) r- q+ ` M( Edocument.write('</td></table>')
( k+ G9 m; r G}
3 d* H1 n/ D- F- }6 t: u# n}
( }: |( K) ~2 X: d" _</script> |
|