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

|
网页之跑马灯文字特效
//修改宽度
; v% _. A, d. ]! r- h7 C/ jvar marqueewidth=300
2 p0 Q% T9 k1 m: P$ p* B//高度" s D; f6 X9 j* n/ g
var marqueeheight=25
+ s3 ?: i j- F' ?//速度(1-10)4 _. }8 ^0 Z% j6 l
var marqueespeed=3
( q/ Y# P8 M4 E//背景颜色6 Z1 Y! F0 N. x& w( [
var marqueebgcolor="#FFFFFF" `6 G- h& v9 _+ J }( b
//是否能暂停 (0=no. 1=yes)?
& v: K6 j+ y5 S5 y+ ?2 l: \- lvar pauseit=16 z4 e7 A$ j d, E5 m
1 P1 Q, b& U# N- T$ p
//修改显示内容
! M, G3 s" }/ x: Y2 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! u* J2 W# J/ `. F
9 j" o8 V; q, d: j2 [! h% `
: B+ |. i3 x) e4 V2 p0 n; w////下面不需改变////////////" j1 Y* i$ a* w' X; w
# T3 t1 T1 a, l( w9 J6 S
var copyspeed=marqueespeed
/ Z9 H& a( s) J/ k- R* ivar pausespeed=(pauseit==0)? copyspeed: 0% ? n% _$ Q& A, y
var iedom=document.all||document.getElementById
" X e/ q a3 @: i2 cif (iedom)4 P1 ~! d0 T K/ g$ e: E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. ?3 K" E3 N0 C' i; Xvar actualwidth='', H2 v( o5 d+ ]4 [3 k
var cross_marquee, ns_marquee& x5 x0 ]! y/ B" w
6 `/ e7 e# m2 y# {
function populate(){
/ _9 x. ` @, f8 A9 w! Yif (iedom){7 p1 @0 M2 [; J% A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ _! \3 P2 q' o
cross_marquee.style.left=marqueewidth+8
# m3 S* v8 Q: h3 q: Y8 g# U! @cross_marquee.innerHTML=marqueecontent
! `% [/ ]* `: e$ F/ X/ ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( k4 N5 ^ P" M4 q}
# ` [6 C3 w; X+ [0 w- I9 L8 @) Selse if (document.layers){
' [, y& F& l% z' b0 W4 I) |0 n& J6 jns_marquee=document.ns_marquee.document.ns_marquee2% ?, m0 i- T2 m9 j% G2 D
ns_marquee.left=marqueewidth+86 u }/ Y/ c0 G& j
ns_marquee.document.write(marqueecontent)
/ z6 p* ]3 r- |7 V2 w& R! U' Tns_marquee.document.close()3 n# {1 u+ @" d q
actualwidth=ns_marquee.document.width: |& l6 @. {/ C
}
0 l/ ?# H) O5 E; t% elefttime=setInterval("scrollmarquee()",20)
% ~ e2 G1 r: o f; U} g* V1 l* r! z+ q
window.onload=populate
3 f+ L& K+ D5 q J8 N$ D
$ F! j* W: }1 \, E/ C. U9 Efunction scrollmarquee(){! T2 ?0 u! @; p) s& F3 J. r9 l! x3 o
if (iedom){
& d( m) }$ n7 y7 W6 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, N) E7 F! M$ Y' I/ Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ _' r9 \$ l- X" k+ melse0 X% G m, s* a3 }; V( H. V
cross_marquee.style.left=marqueewidth+8( }" C4 F. V' Z" c4 q/ n9 v" L
; x% ^% e( e/ ^0 O! C- \}
6 [" g% O0 o+ s* j& R+ t& _/ A( {+ welse if (document.layers){
# @( a8 c1 r5 p0 v" `' Nif (ns_marquee.left>(actualwidth*(-1)+8))
- I; q @. L: A& P5 D# `6 {2 I: Zns_marquee.left-=copyspeed) i2 k' U; s* ^# C. ^
else* N7 P9 x' d1 ]6 \
ns_marquee.left=marqueewidth+8' C, k* W' ?# i8 |! H9 Q
}
( Q9 X; E0 h3 `8 X: g! Y}. y. N5 K1 z8 y+ A
' g7 r1 c: Y5 mif (iedom||document.layers){
1 a! W% f% l* N4 o* v3 r1 ywith (document){3 N, k% I! q+ Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: H4 s- L2 O! e [( O7 c5 d0 X! M- ?if (iedom){( F" l' }5 g: ?$ [9 ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 C* E G, S: _: G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% ?' G; _9 E, t0 K7 Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ r5 I; ?% D, q, y
write('</div>')9 G# ?' A2 G0 F' W& T y- @9 P( j* x9 T
}
. J/ s8 u6 n4 C) s9 V' {else if (document.layers){) ]- V( s+ J& }; a* f* N5 T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ A+ A3 }, ~1 Y2 f% Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, \2 b& K/ I8 M6 [ Twrite('</ilayer>')
/ e. C. N) e3 i}
# C2 {( h% c% D+ fdocument.write('</td></table>')
! h* b* R9 f( ?% ~# W}
( [: I! e8 D) g5 A4 _# W}
$ ^: e6 S1 L- ~</script> |
|