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

|
网页之跑马灯文字特效
//修改宽度
) t. Z; S/ ]3 T6 L1 l$ jvar marqueewidth=300, o2 {3 `' T; \* ~
//高度) u1 }' Y! ~# u9 L1 s+ v' H
var marqueeheight=25( \+ R3 a' _3 r- N0 R; ~' E
//速度(1-10)8 t V7 N% _; R: s( o* e# i& J y
var marqueespeed=3
; K# F/ x- q( `( c, [//背景颜色
! v/ i2 O `7 C# S; I# mvar marqueebgcolor="#FFFFFF"
. q1 n; E# r# J( Q//是否能暂停 (0=no. 1=yes)?
' r* Y/ m% |7 U% j! O0 P; x1 evar pauseit=1
/ H O7 Q8 F0 v& R% ~# C: X# T7 K" v4 I
//修改显示内容( | K& i- c* Y1 u9 ^! H8 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') l! s- A2 [3 _
, }/ i. x [& w8 l! s1 ~. X G1 v1 S7 \, p! b" F
////下面不需改变////////////
, i3 u% T. j# B& F/ z5 e9 F9 Q. o2 Z: v7 w. w% h% r" a9 [
var copyspeed=marqueespeed
a+ n3 ^1 S* jvar pausespeed=(pauseit==0)? copyspeed: 0* J7 ~8 ]) {. A0 Z
var iedom=document.all||document.getElementById
5 ~% G$ D/ _/ U+ z8 z F* M" yif (iedom)
& e/ ~% U& y8 Z% g* @9 G# fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), m/ M4 I2 N5 M8 e0 r1 V
var actualwidth=''
( f1 I0 f5 G& L1 R7 \6 Q$ E( K1 Fvar cross_marquee, ns_marquee% ^& |8 |5 l( e* h
5 E2 Q5 P0 ~2 |, v6 \% G8 U
function populate(){
5 n; S: t3 S$ d" J8 a9 K8 {, Bif (iedom){2 x( Z7 E8 n L8 N8 r( O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; s) m" U7 W% j5 R: o8 |6 ]cross_marquee.style.left=marqueewidth+8
- Q6 n7 A4 M5 `7 P- c$ Z" Z: Xcross_marquee.innerHTML=marqueecontent& d) F- `0 ~% @: b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; l* }0 ?* U7 i4 z- l& l* W* o
}
( P1 g2 i0 g3 i! E4 ?9 felse if (document.layers){! c! M# x, n& j5 _" f, \6 x
ns_marquee=document.ns_marquee.document.ns_marquee2
2 `: g+ U0 u4 a4 B! [# A+ W c8 _# Dns_marquee.left=marqueewidth+8
1 v4 J+ w4 B" H1 n/ O9 Cns_marquee.document.write(marqueecontent)- G( P4 Q* m' D0 ?& l
ns_marquee.document.close()% F# Z! ?" R+ Z% u* C& O. G
actualwidth=ns_marquee.document.width
: f) E6 j6 Q6 c, ~0 Z2 D& Q, c}
! j1 a! J+ @2 z3 Wlefttime=setInterval("scrollmarquee()",20)6 [ y% \: q3 r% z" w: J& M
}
6 Z5 @, Q# Z7 r/ i* |window.onload=populate
; R" _) o, L. r$ P/ ]2 \
& `, v7 O+ @! wfunction scrollmarquee(){
0 D7 R" C$ O9 y7 V+ D% A) wif (iedom){/ O6 S2 i0 @/ i7 ]# s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& {, k' C+ Y5 Z( h6 G) n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ G, T' Z. r2 V* k6 Belse% k8 X f i$ C: E E# ?9 e
cross_marquee.style.left=marqueewidth+8
* K* X5 H" `- ?: G' h6 s7 [# q9 Z6 R6 i
}, b# b3 U1 o0 A+ v+ L. n9 y% n
else if (document.layers){- G0 {8 W. D5 w
if (ns_marquee.left>(actualwidth*(-1)+8)) t( s% C V, k. B" [
ns_marquee.left-=copyspeed
5 J, b! l3 x' Z/ c. J8 T) e/ Xelse
0 s$ H: ?8 |; V/ t5 G. mns_marquee.left=marqueewidth+8. Q( |( n |& E& Z M" j
}/ s7 A6 x- W% O4 l t
}5 \+ s5 |$ q p' K5 {7 e7 N
7 u3 w3 D. V+ M8 W" z# W- c
if (iedom||document.layers){
9 q6 U% j3 b. _% ]* \6 Awith (document){, S& ^7 L- `" T$ A( v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ V {0 j! q; e* Q+ Iif (iedom){
3 j2 S6 F- ^1 q: ?+ H, G/ q3 Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" i% f5 c2 i. B) c- {2 H& Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). [5 J# s0 e0 Y) P/ K2 ]5 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). ~ @# g1 \+ A, g7 M s
write('</div>')9 }8 J4 t' P7 ?& w
}7 h$ a) i2 ^: n' M. w s/ n6 k
else if (document.layers){
) t5 X1 Z& g* s6 |. v! Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ y" g! T+ l7 f# kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') M5 a& r& i/ R y: \! S+ Y
write('</ilayer>')
$ p! x' g' k3 V0 q& Z# N) D9 N7 U}; a) V4 z$ d+ k5 ]2 H5 l: O
document.write('</td></table>')
' [+ D5 e& O0 L% q6 C7 e}' I4 l. I' h T& }3 G
}* B1 b- _) @1 u6 ?9 }
</script> |
|