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

|
网页之跑马灯文字特效
//修改宽度
5 F" ]5 H# N* G6 R; v9 tvar marqueewidth=300' p3 C( s9 `9 ~: H
//高度. \6 \# O% |5 ~ I2 _0 _" }) Y
var marqueeheight=25
: X' a* n4 C5 h0 x$ h6 z* N//速度(1-10)
9 p, Y: Y" r$ n) h3 Bvar marqueespeed=3) D- Q! R& O* I" {) `" U% G
//背景颜色
* f9 U9 d) S8 I- Y) ?! A0 Wvar marqueebgcolor="#FFFFFF"
! M& f# G- x$ n1 q, V8 ]+ k0 L: o//是否能暂停 (0=no. 1=yes)?
( x$ I4 w; s) g* f rvar pauseit=1! Q8 ?" Y/ l- C% `
% E! q+ m5 U2 m0 U0 \: a( g# y
//修改显示内容
9 w$ M' {7 I) x$ I- z$ ~) ?% xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' P o% T% y& k6 w+ }0 Z( ~
4 T: W* [- g0 O6 @% X6 U% q, w; a# [7 b( j! q7 \
////下面不需改变////////////* l9 v8 V2 x: [$ @( ^: i9 b$ R
7 g" R9 [0 _- f4 \var copyspeed=marqueespeed
5 L# M3 I8 G4 f7 r. J2 mvar pausespeed=(pauseit==0)? copyspeed: 0
4 F B6 X# K2 E; f0 A1 Evar iedom=document.all||document.getElementById" T, J9 B1 m7 y% u. }' u1 r( K
if (iedom)
, Y" g. i$ e4 V& g8 C, Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, c7 G6 o! k0 R y6 V6 H1 Zvar actualwidth=''
+ A! E( L( i" r" K6 [0 Tvar cross_marquee, ns_marquee
& N# H$ @- a2 U
- T( E# D% E0 K/ {' G; xfunction populate(){# H/ o4 r) w/ j! c4 Q Y0 I
if (iedom){
! L7 l, [( ~% {8 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! q M; i: L9 M, across_marquee.style.left=marqueewidth+8
! t+ t! W% M; L' F/ V2 q! \cross_marquee.innerHTML=marqueecontent
5 H: r+ r7 b$ w# p7 g0 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ ]. y/ V3 b$ U
}
! B: G) v- t) l. \* j J" Helse if (document.layers){
# C1 E8 J$ o, I' Z% Ins_marquee=document.ns_marquee.document.ns_marquee2
" o9 [% _4 H- M7 n" M" ^2 t( Ins_marquee.left=marqueewidth+8) p, K$ J1 H! T
ns_marquee.document.write(marqueecontent)
; e: V/ F# k# \1 ?ns_marquee.document.close()
9 b; ^/ @$ e2 qactualwidth=ns_marquee.document.width
$ ?) }% T- B9 [8 ]7 }# K1 |}
S8 I% g- `% r& tlefttime=setInterval("scrollmarquee()",20), q! C$ W6 o/ @6 _
}$ @, d8 g! X$ c7 q5 E5 B
window.onload=populate
$ X) `5 J- [; @+ l# I, T/ o) W# a7 k- ~
function scrollmarquee(){
# Y4 U5 g2 N# }3 iif (iedom){) G* | D, ?. x3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ r1 a% x, D4 \+ Y9 [4 e. Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# I5 c8 a: P& b
else7 P9 n# V5 a* J U
cross_marquee.style.left=marqueewidth+8
( k3 [/ l0 _! i: r: ]( S5 l: l; }: ^
}8 y8 P5 q/ ~' A. R6 G
else if (document.layers){
: }+ W. k+ ]- w) b& e& ?if (ns_marquee.left>(actualwidth*(-1)+8))
q9 B$ P6 W& d) e- `+ ?ns_marquee.left-=copyspeed
. y. Z& r. ]8 Q) @9 v) Eelse
5 s) @' D7 Z2 B; }* O9 F2 L4 r0 b! vns_marquee.left=marqueewidth+8( e9 z$ W7 A4 t* ?: F9 _
}
+ F; q% G9 h5 Z( L}, V0 _" P" v7 T6 S2 e$ g# T. T/ p" J
! u; f; B/ R4 ^) r2 O" yif (iedom||document.layers){
* _( X! i$ i% c: O( J4 M4 _with (document){
) m+ T( b$ D8 U' \1 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: q' m; |( s4 m5 }if (iedom){
- b5 e5 O2 K/ d2 o2 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ z, C+ x ]: ]' f$ twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* g% E* Z3 B Q: e* Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 {; z: Z2 m; f! p& C; W" ?write('</div>')
4 f2 A3 P. U4 S* ?6 G: L! N0 {& ~}
& ~$ Y, C8 r$ [+ \- ]: m) X8 ~1 U- Eelse if (document.layers){7 @* d3 }! F* l9 A! P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 _4 e% ]9 b7 j4 q; k4 }/ {/ y" F- wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- a+ M! f& T4 l
write('</ilayer>')8 g. S$ D+ C S5 y( X: ~" G* o# Z
}
* C0 B" T( ?/ [6 odocument.write('</td></table>')) Q' h. n+ O. a( M6 ^
}
6 p& v. A8 I+ R0 p- T# }4 i}
( m6 z( I& }+ K0 k</script> |
|