返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( r; Z5 k$ E- t2 E/ _6 v9 [var marqueewidth=3007 i# Z- m$ r9 a( ^- X
//高度
3 R* Q$ R( C2 T$ Cvar marqueeheight=25) O: S2 x) _& F8 R
//速度(1-10)( o( S( Q& _2 s" E" w0 p' }
var marqueespeed=3+ {0 I0 H$ `$ n( ?8 T
//背景颜色# f) I8 v% r: M# V+ f! d2 p5 l
var marqueebgcolor="#FFFFFF"0 Y: b9 A+ k9 ~; z6 ]' A7 v
//是否能暂停 (0=no. 1=yes)?
' N& i6 G$ ^8 u) q# c5 Y3 pvar pauseit=1; b( H" M9 Y1 \8 V& W/ H! O

" d  A1 m3 ]& I8 Z$ m- Y. h//修改显示内容! g9 ]% I( }0 ?! o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 z& S7 K! f6 O" I/ w  C
1 V% ?2 Y$ ^0 u$ P& X7 z: u3 R9 k8 C( ^

: ^/ Q8 N1 U5 {' c////下面不需改变////////////9 [( o# ]4 _# Z" Z' f* R
2 w% E2 H" `" a
var copyspeed=marqueespeed
- C% f; J2 o# j& q; c5 P; b' cvar pausespeed=(pauseit==0)? copyspeed: 0
% k' [) m# }2 @; c& v" ]var iedom=document.all||document.getElementById, m- Q$ l- t2 J1 K/ {
if (iedom)
3 [' E9 e! V- L$ O! i9 \; I7 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- G. ]3 \5 x7 G6 `6 hvar actualwidth=''
5 ]4 V' |1 [$ T- nvar cross_marquee, ns_marquee
+ w4 c" ^; z& U/ T9 h9 X: k' M( a: N- k4 S; H$ F0 v8 v
function populate(){) W( E" @( Z# v  ]8 B* n
if (iedom){
9 \- ]9 \: ]4 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* p" P, U0 J: W3 n, f: M2 O
cross_marquee.style.left=marqueewidth+8
2 m# |5 `) P3 |1 _cross_marquee.innerHTML=marqueecontent
0 Q1 A: W7 ^  |! b2 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* a7 K9 G/ K" p$ x* k
}5 B& R3 ]5 J) n) ^
else if (document.layers){
' O/ c1 {5 N9 L' o" Cns_marquee=document.ns_marquee.document.ns_marquee2
3 b) ?( z% r/ V: X  d+ Ans_marquee.left=marqueewidth+8
3 a7 q3 v. {# p/ E; Gns_marquee.document.write(marqueecontent)+ [( ?+ e- W6 D4 r4 a4 Y8 I+ V; Y! r! K
ns_marquee.document.close()3 \+ B$ V" E) O! g2 Z$ L
actualwidth=ns_marquee.document.width. Y* \, _# h/ }8 u  h
}0 D1 ^1 t$ D1 W" k; |# F& c
lefttime=setInterval("scrollmarquee()",20)! b5 l4 C7 r- R+ X' M
}) U2 H. j$ {$ m5 U( }9 V
window.onload=populate# J5 Z2 u1 V7 t% G, ~; g( I+ y
- q# [" w) m8 T( P
function scrollmarquee(){8 n+ |. [% P% l: |4 o
if (iedom){
; [; g) B! O6 Y  y% pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 x' a$ E- i; Y9 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 q4 k. K  r- H* a1 z$ g
else
# s! j3 }# D) w3 ]: ]( V. Z, Jcross_marquee.style.left=marqueewidth+8
) {# p5 ]% w; E+ b4 w  Z0 C& u7 q/ M  E! D
}9 d0 }. m7 x" v
else if (document.layers){
8 H3 I  @& O' p5 sif (ns_marquee.left>(actualwidth*(-1)+8))
7 e* C+ p1 M* U2 Bns_marquee.left-=copyspeed
6 u8 N/ ^! S. `1 H5 gelse
& W$ t$ Q; a" s% u  Mns_marquee.left=marqueewidth+8* F% H) ?& }* I5 @- b5 b
}7 \* b9 Q) T$ ~  b- p
}
* T3 ?& {" i6 z: o- ^- K7 U3 s( X9 ?0 L" o% X- D. f
if (iedom||document.layers){& b' D: w9 c% y. W
with (document){6 U9 B! Y' P% R, z3 }' ^( L1 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# a. T, R9 M; B+ u* X  I3 R, gif (iedom){5 @6 y9 [* p6 J9 a+ n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; J5 t) X, }) z$ n8 M' |! bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& K+ x2 f1 y* Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& X/ m/ u" C. Z8 J' \, ^write('</div>')- c" ?% F# G- W4 E" y* e4 K4 h
}& F7 x1 s3 v' |6 `6 Y
else if (document.layers){
5 J# V8 Z2 G5 t9 X. G6 R# x+ i# wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# l& J- h+ f! W( a, X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' f5 `  `! l3 x8 r5 u6 xwrite('</ilayer>')
' Z! e) e4 A5 k1 n, ~& T}
+ y2 q/ g8 g6 R5 K, D8 T0 ~3 [document.write('</td></table>')
+ [; B- F* x# f' |' T2 x' }: r) E}
4 {3 a# b. @& l* |0 U1 D% u}* K3 f( a. ~$ R& o5 N8 E' n5 P
</script>

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