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

|
网页之跑马灯文字特效
//修改宽度
0 U* s- J$ `4 zvar marqueewidth=300
& a: a; Q1 q5 V: I//高度3 U. j8 h' H. J: J, n
var marqueeheight=25
9 P$ I4 y6 _, F% z//速度(1-10)9 g6 d& t. u, |. n5 M: I
var marqueespeed=3( D) D; S/ b+ y9 }" x9 T7 X( Y9 C
//背景颜色
- m% f: Z# |$ b1 |) B0 P+ [var marqueebgcolor="#FFFFFF"
" v" Y0 k' g. s: F6 q* Q1 u! u//是否能暂停 (0=no. 1=yes)?
6 S9 E7 q# N7 Qvar pauseit=1
0 m0 p0 i) l, T ?. s7 k) `" j( ^+ y7 N! c; Z2 M
//修改显示内容
# a6 l/ j# F) j' ~( ?0 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" A, ` d$ y; s9 l1 W2 @
- B d( U4 Q% P
1 z, K d9 i# Q8 I4 ]////下面不需改变////////////+ z, K. Z- a; w) v! ]$ ^# E
. g% B/ J3 G: t! A* S+ I
var copyspeed=marqueespeed) b+ K* g, q: g- A3 \- ]
var pausespeed=(pauseit==0)? copyspeed: 0
, g- t; I/ A% a: `, ]7 M, ivar iedom=document.all||document.getElementById, X+ \$ @ [! |- I3 d. x0 H% @6 b
if (iedom)
+ c# C" ^4 d0 y5 k; ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; n+ x3 B/ m2 S/ l* k/ Avar actualwidth=''
0 H8 A# M7 w) o6 s6 Pvar cross_marquee, ns_marquee; I+ t" d" x& H5 c: {" L
; }3 z+ X" O4 t9 `: a
function populate(){
2 \% S% k/ q8 O: \3 }if (iedom){8 [( S5 a& g( @( q$ h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: T' E! i$ ]2 f. o! s Across_marquee.style.left=marqueewidth+85 q& v) K9 \# S
cross_marquee.innerHTML=marqueecontent7 a+ r/ f& S' P t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: K% `6 W' T/ Y) `& T" N R
}9 B( ^/ c( D' o* `8 D2 H: O
else if (document.layers){
" C H7 X. ]. `$ K* m% \. Qns_marquee=document.ns_marquee.document.ns_marquee2
; g5 L& |2 \8 N+ m% R& O2 Xns_marquee.left=marqueewidth+8
- s. N% B d& D& M+ N9 ]ns_marquee.document.write(marqueecontent)
: M; f: J$ S: ~8 l dns_marquee.document.close()6 h& Y6 a9 Y3 {8 f
actualwidth=ns_marquee.document.width: f. c+ x1 ^2 ~* B( ?9 @& S
}
* i0 U) C1 j3 j+ P4 glefttime=setInterval("scrollmarquee()",20)% [* w1 r. K3 q1 A" ~" e+ ?
}
; d/ D3 Q; Z$ K2 ]window.onload=populate% X0 Z; R5 Y5 q, {
7 _0 q5 E. _# p: ]& Q5 J7 Z
function scrollmarquee(){9 b& n' o& `: @) [; z1 q6 o$ L
if (iedom){
; v( p8 K$ v+ J* r* Z7 q( vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 F2 o, X c, {9 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ `# m/ h- I. p0 L
else
& k8 n* b7 j( |4 P0 n9 _cross_marquee.style.left=marqueewidth+8- M7 ?( Q3 `# q# I
* u' {! ^3 Y( Z/ q
}
! F4 |6 Y1 J6 [! G( k8 ~" ?else if (document.layers){
( E0 S. s( @9 l$ J0 Cif (ns_marquee.left>(actualwidth*(-1)+8))( J2 { n! x- w# h6 r. `+ M0 |& ]
ns_marquee.left-=copyspeed
7 @, r! h* _8 K4 {: Kelse& S% | ] @8 g7 v
ns_marquee.left=marqueewidth+8; c/ T0 U' F( Z0 C
}
/ R2 y+ j7 k0 i1 _, W1 p/ b( m}+ J$ r3 i9 ?/ m# O' m' H: \$ l
/ q+ k5 \7 m3 y. q
if (iedom||document.layers){
3 F }& ]* ?% kwith (document){
/ p3 l+ c$ |7 d. Y0 D; y# j- odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( C# H2 |3 j% m+ F. Q0 L3 Bif (iedom){5 ~+ x4 C1 A7 S2 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ p, b* `# x2 k. p# y! Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& A2 z& u+ \: D+ y8 c) uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: h3 q& }1 R+ C9 E Cwrite('</div>')
2 {" w4 Q' ]( T2 B7 c0 i/ B}: p6 k3 f0 `, l
else if (document.layers){) n- y' f# q6 H6 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! N5 Q& J8 L( c* K9 Y( Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). K2 h- \! e. N$ V
write('</ilayer>')
I# J% s. z# u J4 Q4 }}
' m J% @2 H9 R, D0 qdocument.write('</td></table>')
( S8 i. _9 l# e3 g6 h% a}
! e% i0 H6 V& L# _* t; M, H}2 b( r8 D- d% I* ?
</script> |
|