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

|
网页之跑马灯文字特效
//修改宽度 s5 p* [$ b: W3 R9 _1 L# _
var marqueewidth=300
% l8 H3 v# M. H0 p- C//高度# j: C$ O& N2 _
var marqueeheight=25
6 V; v2 o& P. ~" \+ A+ ~$ v4 U//速度(1-10)
2 i1 |2 z" U9 \, G @4 h* }var marqueespeed=3! R5 L" v) x. p
//背景颜色8 m K) N) R q& a9 e! @
var marqueebgcolor="#FFFFFF"
; V+ T9 J) {, ]& H6 a% m. ?. O5 G p//是否能暂停 (0=no. 1=yes)?
8 ?1 d% k8 U, V5 ?$ |* C, evar pauseit=1, M" {6 q8 i* z) o8 s, P6 e* _; \9 Y
+ X5 ~3 H/ g- {' I3 v! ?( B
//修改显示内容6 v) S$ f n# I" P+ b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- `* q, x) R" y1 Z* z( s) ^- v0 N* q. _/ X: D
& h* q# F F3 v5 X$ {' k////下面不需改变//////////// a: h" q5 P! F/ m2 g
7 G n2 [% l' Q l5 i
var copyspeed=marqueespeed
( D R) \0 `3 L1 dvar pausespeed=(pauseit==0)? copyspeed: 06 j+ o6 P+ n, ^) W! _5 D
var iedom=document.all||document.getElementById) \. B0 s3 |) p! h! q0 J/ {
if (iedom)! D# [( e, i) D: S# i7 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 j$ h: ~3 ~% {. {7 h
var actualwidth=''
9 {" u0 a( e* tvar cross_marquee, ns_marquee9 W* h; S, D d1 L0 k8 {
( w( }0 c4 l6 d! a; \) x5 i) Gfunction populate(){
/ P$ h- d- _2 h- zif (iedom){0 i4 L9 ^9 _! e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% `" p- l5 Q" q9 d, N- fcross_marquee.style.left=marqueewidth+8
# W7 D) V; A* D Ecross_marquee.innerHTML=marqueecontent
2 l: {3 T! z$ D( nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 a6 a8 ]# o+ V8 O" V. _4 W @
} p" T: ] ?5 m7 q
else if (document.layers){
# o0 s; I" O: `% F: W$ Rns_marquee=document.ns_marquee.document.ns_marquee2
9 i4 }% X! h( Bns_marquee.left=marqueewidth+8
' b5 _+ q' ? J6 ?8 Y* C, wns_marquee.document.write(marqueecontent)/ ?( t7 f; G1 e: D
ns_marquee.document.close()
, q6 F# B% {. ^$ P) l3 e7 S. hactualwidth=ns_marquee.document.width! |* E) Z% ~3 |4 M
}
3 j! p/ ?, R" x6 o3 Qlefttime=setInterval("scrollmarquee()",20)
6 c$ _) N* p2 y! A7 W$ B* A}* V( d! g" ]9 q. O) Y) d
window.onload=populate9 T9 N3 j0 h9 }# h& R
C; {0 h. ^1 D7 D- _! t. u) S5 D
function scrollmarquee(){- b* ~5 l/ {3 b5 E, q7 h
if (iedom){0 [( ]% {8 o/ k! G5 A' e4 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 a3 m7 w6 o4 A% F/ z) N4 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# b7 \# D9 C" x+ I9 R, w
else
?: o+ p! I$ M6 [) @. lcross_marquee.style.left=marqueewidth+88 ]/ @: c) h: _7 U1 n' v: {1 J
$ G0 Z% b7 C I0 [* d
}+ `! ]' }% Y" w9 \3 `! ~
else if (document.layers){2 i! V! S! t! h9 `6 {
if (ns_marquee.left>(actualwidth*(-1)+8))
$ G! B* x: ]8 V3 W( _ns_marquee.left-=copyspeed
, A6 {8 w+ t3 V1 telse8 w" |7 d- k* E2 N4 o
ns_marquee.left=marqueewidth+8, {2 Z/ v6 n& w& n& N* d7 u
}; {. q( X, l* E1 \" e6 _, Z8 {
}
, y! n; f# G h+ z, s( H# @( p3 B5 [& ?
if (iedom||document.layers){# G! o8 @; s* g6 Q x
with (document){
: y3 j# ] l2 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- Z2 T- H: w6 \2 e3 R
if (iedom){ U( _4 k. }( S( Y& ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ F# ?9 k! n C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; B' w$ Q8 G& {2 }3 s' Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), p/ J8 j# B$ p/ X
write('</div>')
& e+ W$ N3 B! T3 L$ @, J/ @- P}$ a( A' p$ [0 W. R; ~0 H
else if (document.layers){( S% Q( ]9 X& Z6 i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ Z& }1 a ~& f# c; m+ T% [+ j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; Q6 Z/ `! {+ o# O$ `. rwrite('</ilayer>'). N) ^) O. g$ h; `5 m
}/ `7 O* v2 I6 O# X+ P% b( Z) _9 Y
document.write('</td></table>'); `0 a2 G3 `+ B
}9 ~" T" A. |/ C2 R7 R; Q
}
7 [! c! D( t( \- [+ }7 X</script> |
|