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

|
网页之跑马灯文字特效
//修改宽度
; E/ D( x) r1 n* cvar marqueewidth=300
' e8 Y' G7 E; ~: e//高度, M- n: i; q& X) p/ ~
var marqueeheight=25
3 ]+ ^1 u' Y& z5 h7 F' F//速度(1-10)
! c& W* ~4 U) W7 jvar marqueespeed=3* f* E2 D: z, V. l
//背景颜色
5 r$ Z$ p, ~ [8 N5 Qvar marqueebgcolor="#FFFFFF"
, B+ h& l9 p& V4 R* \//是否能暂停 (0=no. 1=yes)?3 V* X. \& [+ O
var pauseit=1
" G5 }! m l/ G" n3 t; G* p
+ e: R4 @ G" x) V1 Y& b* P$ @//修改显示内容
k3 _0 V/ o* A3 o% Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 f1 v5 }. B1 X8 O) U. f! Z, B) P
" p+ r h0 |# k, Y* b* L' v3 k0 b% t& Y2 d C
////下面不需改变////////////7 z) y7 }5 m" N: s: q% t2 L
, w% d/ | j X8 t+ F# l; hvar copyspeed=marqueespeed+ @! ?8 @' {( U: A d" z8 a
var pausespeed=(pauseit==0)? copyspeed: 00 I3 W- n# `6 q3 B& V6 X6 Y C
var iedom=document.all||document.getElementById
# K1 e2 G2 a% X6 |0 M4 cif (iedom)$ y5 x: Z* y# b) l: v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% t( D8 }0 x8 Y) ^) j
var actualwidth=''
+ }0 c! Q: r+ t j. C' h# gvar cross_marquee, ns_marquee
2 q) v; `7 ?$ \; J6 A8 A
2 Q9 _6 M4 W4 \$ G5 @function populate(){7 m" }) b: e3 W: `" K. z
if (iedom){
0 _, O! m- t( m5 L9 Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" Z; M. q6 @6 Y5 K- A! k+ y; V7 S: @cross_marquee.style.left=marqueewidth+8& s: ?* l" L& u) v- @
cross_marquee.innerHTML=marqueecontent
0 H8 N* z$ }: ] P# `. zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ u0 P+ d4 O! M& |5 K( y}! ?5 \+ n- V* s
else if (document.layers){' {2 N9 L d8 N& A' s% I3 C; U. w$ ~# H
ns_marquee=document.ns_marquee.document.ns_marquee24 w7 @, m5 b* k8 m
ns_marquee.left=marqueewidth+88 s( X& x" h3 b# q |& Y0 v3 Y
ns_marquee.document.write(marqueecontent)
4 {. W6 Q9 J/ X5 g& hns_marquee.document.close()
9 p5 s W' R; s! z: Gactualwidth=ns_marquee.document.width
% j3 t) _. w6 N/ g}
% G9 i$ ]% _6 H, T, zlefttime=setInterval("scrollmarquee()",20)
3 }& v. L) s( a& z' |* m: ` ?4 J7 N}0 `; f5 ^7 U9 P
window.onload=populate& W: W8 ^* S* I* O* h* h8 [% O5 T! r
' `& n% r0 q% D$ M. I! |1 i% {
function scrollmarquee(){
& i8 y4 S! J' s( Z I _. Uif (iedom){
$ J, U& L3 ^6 i" [5 R* I Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 R' u: P# E6 H U- T- ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' ~+ C3 ?+ i3 B, m9 c+ ~5 ]' h/ welse
$ I; K" M6 v5 R8 f+ ocross_marquee.style.left=marqueewidth+8
$ V2 i- g, R6 F. v7 R+ v' |, w- t! t. y1 J2 T; r
}$ m4 h( o( k V) p6 l% c5 w
else if (document.layers){3 K( @1 z+ }1 @7 M
if (ns_marquee.left>(actualwidth*(-1)+8))
) x- T% D* Q% {9 l0 Gns_marquee.left-=copyspeed
. j8 j. s5 p2 f7 c2 x2 A- pelse
6 s4 E% |1 d" K4 A+ dns_marquee.left=marqueewidth+8
) D7 Q4 Z3 N. ? q}& B# \( m0 \$ _0 b M- c1 v& I4 ]
}
& n& e# l$ k/ {1 D! r; E
; v% v8 A& h$ C$ P3 pif (iedom||document.layers){
6 G: R0 v: O7 r* W5 x( n( Qwith (document){& h1 ^2 Y8 X9 f& v% S2 J" e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 L; J+ |7 h- p, ]& J7 j$ t
if (iedom){ u+ e9 v$ }" t% S8 C: Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 g& w5 v, i* q# w% |0 z+ x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 O5 U; R& c! V1 M, k0 vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; @, ?% V; _/ I3 |( b, wwrite('</div>')1 F9 ~( v1 x9 N3 M7 R
}6 E. U$ g# l9 l g* u) v
else if (document.layers){9 s! g& ^/ r% y5 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ` c+ P( [6 Z0 Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); ~' L% N- P- @5 T* u8 Z: G- f
write('</ilayer>')
0 |+ N1 y$ X* b% s' j% \0 T) h9 b}
: R+ @* P- Z% h0 @9 s. ydocument.write('</td></table>')
( c& ?: v* L# Q+ h1 I}3 I# o$ Y; S) {0 J x
}( F" H1 B0 X3 D* ~% `' G* p
</script> |
|