返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 b, \. ]6 C2 A% tvar marqueewidth=300" I& W( u! H' T) D6 U& t
//高度* C  f5 J7 t0 V0 x
var marqueeheight=25
, w8 w8 ^3 n$ V2 k. v  s. j//速度(1-10)
  F: s4 P% }" c2 A! {var marqueespeed=3
- j4 I9 c7 t8 a( ^1 ?//背景颜色3 D& f8 \. h; I" B# E
var marqueebgcolor="#FFFFFF"
( J! B& T/ p8 g5 ?0 G& K- o5 K' j//是否能暂停 (0=no. 1=yes)?5 j) e2 S# @4 u8 ~& \' m
var pauseit=1
3 I* I! |6 o+ ?4 [; j0 t
7 @- `# S, n4 o' r+ i. S) T, d4 X//修改显示内容
% Z/ a9 }' e* Z8 T7 [9 K+ [) \  Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! y, h$ n/ s8 H8 W% ~# H* \$ h5 x5 P
9 [% ]0 \/ |% b4 ?
4 [- h  C$ L. R4 Q# T: G& ]
////下面不需改变////////////
& [: `5 @" r! z. r5 ~" r, Z
1 Q) i2 F3 j& m, T2 r# W7 kvar copyspeed=marqueespeed
" e/ s8 |7 a  n; ~6 Mvar pausespeed=(pauseit==0)? copyspeed: 06 [- y3 U6 I5 {) c
var iedom=document.all||document.getElementById
4 t0 b8 F# [+ c. [/ ]if (iedom)
' M( w( l8 v" K6 Y4 I& b: S4 s1 b9 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 M: w; R* \9 F% G  Q1 v- B" d
var actualwidth=''1 R# e. F- S: I
var cross_marquee, ns_marquee& L* Q# H; j; ?6 J9 K( d

* J: }3 O# R# D9 A* `! afunction populate(){" m9 C* D) H; G  g
if (iedom){
  [3 H7 u' }" j9 g8 L  L+ p- bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! y& F! M' q6 H$ Bcross_marquee.style.left=marqueewidth+81 c! P2 t5 U; z! w: }
cross_marquee.innerHTML=marqueecontent: B' I" x3 c! y* |5 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! C8 h$ d' k* d
}
5 @. @. G( Q( f0 gelse if (document.layers){  ~  C5 F; A7 X5 F; O, Y. t1 ^
ns_marquee=document.ns_marquee.document.ns_marquee2
7 w- b8 i) d& b! ?- k+ Gns_marquee.left=marqueewidth+8
1 h1 z* K2 k% j5 A( C1 H8 Vns_marquee.document.write(marqueecontent)& O* L! r5 w' F/ I; Y
ns_marquee.document.close()
9 p1 H% n5 ]2 N! z& o  Eactualwidth=ns_marquee.document.width3 m' x1 b3 h4 Q  ~% H
}" i# ]9 J  F+ L! D$ o5 `
lefttime=setInterval("scrollmarquee()",20)
, z+ I2 G( u9 r/ d* l6 E}
+ D1 J3 `* d% Gwindow.onload=populate
1 F% \- g& `5 l/ f- x# M6 q4 S2 x3 x# }" y  m6 ^5 l2 q
function scrollmarquee(){; [# E! y1 _0 l  r4 T: @
if (iedom){
6 P) q; [: K4 j0 ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 `4 N9 w$ L$ u; n. G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! Y- R2 Q) M2 Q! I, belse
' X  e, b( U  u: {, Q  across_marquee.style.left=marqueewidth+84 N, r* x# d: `. s2 {
1 i; M7 i& X. p/ q$ @
}% M* F, @1 _2 Q+ Y) \( i
else if (document.layers){
8 E# J# y0 X( H  l# g5 \- T/ [if (ns_marquee.left>(actualwidth*(-1)+8))  J! l* d; e) u  r
ns_marquee.left-=copyspeed
( p2 ^2 |0 q- {4 X- j5 Ielse# l) b9 n  s7 T8 Q
ns_marquee.left=marqueewidth+8
) W9 n5 K0 J5 x. s9 S. [}% q7 O9 o6 k* l
}
* J) \. K  M$ ~- w" N
& e7 o$ Y$ [# k" Yif (iedom||document.layers){
/ {& r; `5 C/ twith (document){7 _/ l; o1 X& `3 B" Z+ O( M0 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 j- K2 |1 e6 j* O: Y! F$ q
if (iedom){
* Z& U- \) E! v7 \; S( W2 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' J3 F* O: J. Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 @- h% I& N5 R3 Z  mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). y+ L. R3 ~; i0 }4 ]" E' t* ^
write('</div>')
$ n) H. q4 O/ G  S+ S4 U' _}$ s) F4 T4 P- p! l$ R6 C: S
else if (document.layers){
0 W1 h% x) L6 G' |6 O- c/ Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# `9 H3 S- u3 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 X( K3 q5 C; l2 }+ V1 Gwrite('</ilayer>')
3 {8 i) P& t9 J0 ?- o}5 N5 B$ ^& r3 ^" G3 g; e
document.write('</td></table>')
9 N1 X# `8 |# H2 A% d* i& V* R" G}1 s0 o- T5 G4 X  a0 @5 H' T4 g1 S' L
}3 a0 Q  J3 |" Z' Z* r' T
</script>

返回列表
【捌玖网络】已经运行: