返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# m- Z+ s' R9 c$ yvar marqueewidth=3004 D; ^6 v( E' i! c9 ^% F" e
//高度
) A- V* e; R# a" T2 f7 Q4 I9 u" f" gvar marqueeheight=25
7 P9 Q$ Z: E" x& f8 t//速度(1-10)
* ]0 q" m8 m' z$ r5 ~+ H5 V( Pvar marqueespeed=3. s3 I6 d5 B$ \2 ~
//背景颜色
7 }7 E& H6 l1 h2 u5 y4 gvar marqueebgcolor="#FFFFFF"
" v- c' [2 n& {: j9 P//是否能暂停 (0=no. 1=yes)?9 l; x, C0 f* p9 m0 w- x
var pauseit=1
/ ^) d2 O' [5 \) [' u+ g
1 H- ~. x: R* d3 A0 D- `//修改显示内容% Y" n8 Y% [. T3 l3 u3 R+ }- R7 o& x# p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 k' Y# \: @- n* h' V

' G! f" I8 S9 l! z' u2 u& ^+ i% z! a3 ^
////下面不需改变////////////
9 n0 I1 Q& x4 q' p; F" |& s$ A9 _, @5 b! \- X7 |
var copyspeed=marqueespeed
2 d, C6 k6 o: Q/ avar pausespeed=(pauseit==0)? copyspeed: 0
0 g+ [9 L8 A' ovar iedom=document.all||document.getElementById  P) @7 S) d( [3 B
if (iedom)
9 G2 K+ J; s+ S' ^+ T- p  Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# j' g  T- }1 A" K' H) `8 Uvar actualwidth=''
& P3 G! X5 H/ G& v$ e- vvar cross_marquee, ns_marquee2 d! m# E. _/ P8 D0 b

8 e3 B+ @2 S  S/ |$ jfunction populate(){
" ]! L3 z3 A+ e: e( f. Uif (iedom){3 T. N# F& G. R: B- F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 R; `9 c" v  T! u6 j: k5 |: Ycross_marquee.style.left=marqueewidth+8) h, T$ f7 n9 {; n  s! u
cross_marquee.innerHTML=marqueecontent
! W3 V( ]* V$ o: \% Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ n5 G% d4 y& b( d# k1 Y. h2 E( [}
4 S% t* p- d8 b4 j2 [2 x+ `else if (document.layers){
2 K/ p' Y9 o  Hns_marquee=document.ns_marquee.document.ns_marquee28 P& E1 q1 ]& Q% A: Y/ E/ E5 N
ns_marquee.left=marqueewidth+8: Y7 X7 q" H- l6 d. S( `
ns_marquee.document.write(marqueecontent)1 p5 T" _6 Q5 Y: L' v1 Y
ns_marquee.document.close()) S! h' [7 o2 X
actualwidth=ns_marquee.document.width% l1 [# c# r9 \* V$ Z
}
* ?& Q0 E1 E. a' y! g6 M/ Clefttime=setInterval("scrollmarquee()",20)
- i. s+ P- a' s  T! E}
) S+ K5 f" C& V, m0 ]5 d: Xwindow.onload=populate
# {4 u3 K: w6 l) ~$ H
' p# x- P% G2 Xfunction scrollmarquee(){
8 E, [! d1 r5 {; _) o! g% ]if (iedom){5 T0 Z5 n% m/ a8 a2 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 d7 S# S3 O+ `; t$ gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 N) d3 y7 p# _else) A/ R9 X/ F6 U/ Y& b
cross_marquee.style.left=marqueewidth+8
0 p- [& F8 c* G$ `* t5 |$ L! }* X( [1 ^. m1 ?
}
' j  e- d, C, z; M* ~else if (document.layers){
/ o( T$ Y" b2 T3 J# |/ n: a* x- |- T- Wif (ns_marquee.left>(actualwidth*(-1)+8))
$ {' U; w' _& L- P! wns_marquee.left-=copyspeed; G2 ^) r4 E, M/ p6 H+ R
else
1 y1 v9 h5 j* u/ R1 [ns_marquee.left=marqueewidth+8, u: j, Z3 e6 s% I$ j
}
6 |( F7 m# Y+ A" g8 J( P}! g6 P6 g- B0 G) v0 w; j0 P

3 N+ F4 J; Q7 ^5 lif (iedom||document.layers){
% U( @2 B8 W% L- C- w* J% pwith (document){1 H$ x6 C; q$ j' {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); U; e( |; r. h) G8 K
if (iedom){% q, g$ A% S6 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ f+ y5 S3 k* ?4 j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  C! |4 b7 Z) q5 m# Z8 Q( l$ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. M# Y& v- E0 m% _* \8 B/ Wwrite('</div>')+ g  _6 U0 j. D( X2 P- c3 L/ J
}
* W+ Z5 @  V. N; jelse if (document.layers){4 P) N+ j6 `4 J: x9 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ G. s7 ~) q0 S0 n2 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! B. \+ x+ p/ M' M& o5 v- r; N9 Qwrite('</ilayer>')& B( ]$ o4 w, [8 M% N# b6 e3 j
}# b) x/ k* M+ B1 P9 {# @7 T
document.write('</td></table>')8 v2 `4 Q! i- @7 E: z
}
) F. w6 T8 Z% w}* P# O) y6 w* s5 u7 X- q8 I
</script>

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