返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ n5 `/ ^# N8 k$ M( y+ kvar marqueewidth=300' q! q$ b* b! F7 [: f" F
//高度
- Q' R6 X: W- E& p! q8 Gvar marqueeheight=25
5 g5 B* |# `; j0 b- _2 z//速度(1-10)2 _. B( j! V( [8 v* a7 p8 U% }3 D
var marqueespeed=3) ?# u4 k( ]$ w3 F! a
//背景颜色
. R& D5 |7 |; kvar marqueebgcolor="#FFFFFF"
4 D5 L9 k4 B/ L//是否能暂停 (0=no. 1=yes)?
/ F9 r) d. S: b5 ~3 G, O! Avar pauseit=1, E' R7 U& |1 E

) D' P$ f+ A2 {0 [7 V2 d# Z0 M5 f- j//修改显示内容
  O! N0 }( W) V# x5 Y* m, Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ^. ?% O$ x# s0 a7 s0 C
% e( s$ ^/ `( Q7 ^: q0 r3 ^
! M# U$ X! F$ O% R, S
////下面不需改变////////////$ e. c& K( C% h$ N* i
; A0 z3 D! }. I
var copyspeed=marqueespeed
5 q# l9 e" M: _9 u8 `var pausespeed=(pauseit==0)? copyspeed: 02 |3 A; o5 ]4 a' C, W
var iedom=document.all||document.getElementById
2 b& p: r1 L8 T( _1 Q# z2 fif (iedom)  O5 X8 E9 O9 f" v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( z0 Z# ~/ e9 {4 Vvar actualwidth=''
4 k* D" l8 X. `) C2 y: o2 `+ |- avar cross_marquee, ns_marquee/ J3 i) N% Q: z8 C
- n- o/ p/ x& g6 X
function populate(){
# W6 x; W8 n5 G% R8 uif (iedom){
0 e9 g. V5 ?2 u4 [: Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 Z6 K' @( M) pcross_marquee.style.left=marqueewidth+8
; j2 t' d* \+ P. n1 L; B9 d3 Tcross_marquee.innerHTML=marqueecontent
0 T; v' s6 s: W4 k% F' V. M( V; d) Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, r6 R/ y% k! [$ r: y
}  s) F2 [- O1 t) H( d* G
else if (document.layers){- ?, @$ a1 v0 I
ns_marquee=document.ns_marquee.document.ns_marquee27 `1 a# d; A. d( s/ v  u
ns_marquee.left=marqueewidth+8
8 ?# t1 x3 {8 `/ b/ I, h! Kns_marquee.document.write(marqueecontent)+ j( M3 C7 @8 q2 N) ~1 U
ns_marquee.document.close()
' f0 {' f' ^0 c1 B3 Zactualwidth=ns_marquee.document.width2 A, a; u  h8 g* w! C7 B
}2 _  L' \# g2 M+ I
lefttime=setInterval("scrollmarquee()",20)4 [3 d- _9 I9 H
}6 }; x, `8 d; Y. u. H0 d
window.onload=populate* w3 ^6 P: G9 E

5 i  r( c& t: J- p2 \: kfunction scrollmarquee(){
8 }$ ]3 j$ d, u0 D7 A. nif (iedom){
$ Q- R  n, i% O. |( R2 c+ mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) F% f, _* ]- }  G5 l% J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 l1 x2 S3 w, y0 @& F7 o8 F
else
3 t: R) {7 ?3 b, R: hcross_marquee.style.left=marqueewidth+8
4 F( |3 C, ~5 e+ I3 x/ m0 R/ Z
8 S& c1 w3 r0 i: [: \$ G}
2 K7 T3 u; d2 [; }" aelse if (document.layers){
. f' w# X0 W" `# q; ?+ e( n4 Uif (ns_marquee.left>(actualwidth*(-1)+8))
) H; ]- W. L4 U( w7 l5 Dns_marquee.left-=copyspeed! _# Q$ d* H' `; V+ e$ F
else) n# b$ r5 _* R
ns_marquee.left=marqueewidth+8
6 O# [* L9 U1 n0 u5 h& k}2 `% Q0 i! w3 d1 y) e( e& [
}$ H3 q% p! I& Q( u) t) f4 _
2 W) {# Y" F. n1 x! T
if (iedom||document.layers){
* c- S; H7 ^* d% Kwith (document){
3 F4 y* f$ ~! Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& w/ R/ L) I, M8 X2 q9 E3 }
if (iedom){
  C1 {  q9 c1 K8 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" c  W% H, g% u9 j9 J& Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: b2 q3 ~# ~" `+ T# P$ ]  x7 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). ]* }: G: t& w' P/ q4 C
write('</div>')( i3 |, L' v/ p4 `8 |3 f7 @' B& G. S& C
}
6 d3 q  p3 b3 f  P! oelse if (document.layers){
& D( ^. X- s, G: r, hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 @& N: }' l3 o* t6 z/ U( S% y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) X4 [1 F" I4 Y0 zwrite('</ilayer>')4 l0 d& F, c% h. {
}
# I" B! Z& \5 \; edocument.write('</td></table>')
( w! [6 }+ C6 a}
& R9 e- {1 e- R/ d4 a: j}
4 l/ C) d/ p) h( V/ w* T) W- |5 b8 i</script>

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