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

|
网页之跑马灯文字特效
//修改宽度
9 _& M/ T& O6 }* p7 [var marqueewidth=300
6 q3 L+ x0 h& k7 M8 ]7 D% E* y//高度) t: D' Z4 L B/ } V8 g
var marqueeheight=25
0 p% u* ^' s. a* p0 V( D. a//速度(1-10)
7 F: R, Q# E, d: q2 Nvar marqueespeed=3
5 L8 G: R& Q V/ T//背景颜色
0 t" g% S) ^. |& o3 cvar marqueebgcolor="#FFFFFF"
4 C1 d( W1 T9 {1 D//是否能暂停 (0=no. 1=yes)?6 @* X$ n1 v9 P; @
var pauseit=1 l9 Q9 U! L2 d: D9 w- \$ N
) P T2 B8 ]$ \- j, k- y//修改显示内容. V- v9 Z* n* f) {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 T: ~8 a: [# P# E0 t: Y4 _* `4 @( g" ]- s) D4 o0 t1 I* M0 ]
& j( P3 |. u' ~; n3 e
////下面不需改变////////////
: t: i$ a R _
s; l' f9 O8 Z; y+ q+ }var copyspeed=marqueespeed
8 A. U" X! o Y, n+ R- cvar pausespeed=(pauseit==0)? copyspeed: 0
& t! ?* d8 S& I- X S! d3 _0 v$ A% |var iedom=document.all||document.getElementById: J( n: o( U9 I% J4 Z, [9 S
if (iedom)& B# }7 u/ Z, z1 m% S8 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 N2 c& P7 X& }
var actualwidth=''" X. d9 n" [2 S3 Q
var cross_marquee, ns_marquee
$ o0 I6 d8 J& z( c2 K$ \) E& i: @
# g2 X X7 g) ^$ vfunction populate(){
7 ~0 }) ]# M6 c: g' }if (iedom){# T, N$ z* w' t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% h" V) v, P8 `
cross_marquee.style.left=marqueewidth+8
: w( f- `$ E; [' d4 r/ Zcross_marquee.innerHTML=marqueecontent
4 y3 \, i" I- Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, i, f/ V+ `3 W; @
}
$ F! D& U" G- I/ ^/ h* H+ helse if (document.layers){+ I: l$ Y3 I0 s9 h( I) G
ns_marquee=document.ns_marquee.document.ns_marquee2
! d; g0 T# ]" {) j; M3 K" f) Wns_marquee.left=marqueewidth+8* J) f& ?5 |" B0 E
ns_marquee.document.write(marqueecontent)
1 d% w& m( ?) s9 h. wns_marquee.document.close()
! q. V, n y% ^actualwidth=ns_marquee.document.width( y5 ~6 n) _ z( c) o2 i3 r3 U" ?3 A
}
# ^7 W/ O+ G* q$ plefttime=setInterval("scrollmarquee()",20)6 p- g1 J' }8 y3 j* D9 C7 N X
}
8 V+ Y$ `* \. E6 c E* kwindow.onload=populate7 j: `7 {8 B S, M0 ~ |6 V6 A1 O
. L- j y- i' c$ Z1 t) _0 Hfunction scrollmarquee(){7 z" ]) B5 p2 E, L
if (iedom){7 b' L% ~5 _/ p8 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% z- U1 H, K& Y4 y4 Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 ?9 u$ q" e6 M+ Aelse
5 F7 l1 j9 ]* }+ f: [# zcross_marquee.style.left=marqueewidth+8* F: d3 o" V, K6 L0 w: `+ x& F
1 _" C3 |; U* }8 t1 ?' E; t) R
}
# f3 {& m* g$ j; J1 helse if (document.layers){
$ O/ k- U/ U! u# Hif (ns_marquee.left>(actualwidth*(-1)+8))# T9 F9 ^7 D$ Y# j
ns_marquee.left-=copyspeed
! P, p* {2 y+ S. [+ Relse+ U# a0 \0 H+ `% ^5 `5 T6 D- ?
ns_marquee.left=marqueewidth+8
! n5 h# c& J2 L: E( n) m}! f. s2 u& w, w( `: E+ ^- N i
}' H6 h+ Z. r" N; u
! p0 f* T! o* I8 |
if (iedom||document.layers){
' g/ T4 \+ s( F3 y& j: d8 W! ewith (document){7 v/ `9 `# O. X$ U5 T2 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). ]: A Y! w& O
if (iedom){
2 W# r2 v2 u7 N9 [ a* i( w6 P6 J+ Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 H0 W; C9 v- b( w. Q" K9 o% kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% K" Z! r+ ?# p# V5 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): `: j, P4 `2 ^, ^4 z D8 o
write('</div>')
$ w+ A" h0 F1 q( k6 ^ I}
6 U# T v4 ^/ H( Z$ m, ] ~* celse if (document.layers){6 E: {0 E Q- ?' K# b' k+ c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 P& p3 \+ m& d2 E. o, P6 d) |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 u+ m! V7 @: D) r: b! ^! qwrite('</ilayer>')
[( T1 p9 w, R1 r: i9 G}
+ ?) ^) L3 ]8 kdocument.write('</td></table>')* o s q# [" r; p4 T/ H
}
: c) v$ G- v3 L$ Z* k}8 a! x3 z0 q1 M$ e
</script> |
|