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

|
网页之跑马灯文字特效
//修改宽度
% h5 h0 |' w) k/ f9 svar marqueewidth=300
; p* b& O$ @! a% Q//高度
4 N4 O3 g1 M% e6 `# H; v) ?- v* Bvar marqueeheight=259 u1 a" H5 ^9 P4 `% E) j
//速度(1-10)
% _# r [" T; o. j4 _- n; h @var marqueespeed=34 g2 h1 I. j3 y" A. X
//背景颜色- Z6 S/ h& R- Y. {! l" V( j1 r
var marqueebgcolor="#FFFFFF"3 {+ x' ~3 u7 b* b4 E
//是否能暂停 (0=no. 1=yes)?
) x0 e9 o: x2 T7 w/ E' r% ? D! xvar pauseit=1# M* @3 ^5 O% s! H
/ P7 }- i8 N0 a( s) J) H
//修改显示内容7 R; N2 ] W' F l7 J& l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! }1 Z; L, S: c8 o
3 w8 y9 Z; v% x" B6 o; e; T* n, F o( ?, M, k- `
////下面不需改变////////////
! ~+ c, b' S) m
; x# z' x8 B& z9 S. h/ Rvar copyspeed=marqueespeed8 l0 q4 ^2 s! h1 j2 O6 |1 u
var pausespeed=(pauseit==0)? copyspeed: 0- L ]' ]% @3 I' A4 v7 X: r0 \9 h; v
var iedom=document.all||document.getElementById
" _- Q* p0 K5 F/ Z7 l0 d+ i. T* Fif (iedom)" U. M1 j3 d8 N/ w8 V2 H% k' {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ f! b& ~9 F3 P! c% f( F# N$ A( F
var actualwidth=''
5 q: ]0 y3 x0 kvar cross_marquee, ns_marquee$ q) } D$ A9 h. L+ B: `* k
/ l- m( s3 r: P
function populate(){
- |0 W& x# }! |" O6 _8 \if (iedom){& S3 _; B$ C# Z4 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 i4 q- X$ m; \% ]2 p7 e2 ?! xcross_marquee.style.left=marqueewidth+8
* H# q1 x' P0 }! Across_marquee.innerHTML=marqueecontent
- @( |( H3 N7 yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) m( k, @) p* A" K* v$ i& }}
) j# |" F6 Y# [+ `" L9 F' V9 k L2 delse if (document.layers){
# N& i/ [5 Y0 S) j9 @ns_marquee=document.ns_marquee.document.ns_marquee25 a" ~4 W3 d% ]
ns_marquee.left=marqueewidth+8
/ o& E& F u! F% U! N9 h$ `ns_marquee.document.write(marqueecontent)
; {) C t0 G* A e* Cns_marquee.document.close()
$ I* x* Z: M6 J3 Q |5 ^actualwidth=ns_marquee.document.width
0 E5 D' E4 R6 t7 }}: |' z) ]* j' s* v- j
lefttime=setInterval("scrollmarquee()",20)3 t: `' A# b4 n, m' I" Q
}) P6 e* t8 f% G: `2 m, w9 i
window.onload=populate8 l3 {9 o: b) y+ b3 P* R% E- Z& M
- h+ X6 v4 Z7 Z6 N5 {1 S; _" O
function scrollmarquee(){
2 |# a% X' G) ~7 M- U. Q" t. }if (iedom){9 ]" g& j9 F3 d9 R9 ?7 K2 |8 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' s& {; f! ?, x' B( a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( v Y: e6 @$ v, F$ x* J8 \
else6 s2 B9 R% r( ?7 B& K8 \, {
cross_marquee.style.left=marqueewidth+8# @0 P8 ?# a4 g. g. {: \
3 e( ?$ m8 [6 V6 s1 s2 S; o f}
?( Q5 h) Y# gelse if (document.layers){4 d( I6 N/ X9 ?- \$ p0 c9 _
if (ns_marquee.left>(actualwidth*(-1)+8))
5 d! k; o, T# N2 M4 B- g/ Ons_marquee.left-=copyspeed. c3 q% S1 j3 M* c
else) l' D& a; \, x# l1 b0 Q
ns_marquee.left=marqueewidth+8* k3 z; z6 x" n1 v
}+ G( m& i- U8 [. t
}
* Z( C" U$ W9 C+ N, _* d( z c' n8 N7 f9 V' E5 Z5 A
if (iedom||document.layers){$ Y$ z& N P+ O4 \. ]' d
with (document){
. X0 k) `( }( w9 e8 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& a9 _1 v- ~0 ` X! n5 E$ D
if (iedom){9 m4 f. ?- Z/ `8 y, a- d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) i) s7 q) W+ }+ V# l* \8 a: bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 N+ w1 [$ c2 L. A- swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- Z$ |0 L8 w" z" t7 o5 t
write('</div>')8 ^1 f9 H, ?% f+ p
}
& V5 T' j$ x6 felse if (document.layers){! T0 W' k9 l( H" ]# O/ w( v, G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% n# r/ I) e9 {. B! r, E% N+ Q# Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 X1 Z! U f+ [7 S7 S- c9 b
write('</ilayer>')) s2 Q0 h* b& t# X7 B. }- G6 U" n
}" Q& b# d! n; S
document.write('</td></table>')% F- z7 x% J3 b! C/ l2 v
}4 f6 S9 g* z: o& b
}
; X+ A* O" f" Y/ _</script> |
|