返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% Z9 Q' J! A& `var marqueewidth=300
  |3 M+ g5 b9 {5 h- a! y//高度' z2 R6 Y6 Z( z3 B
var marqueeheight=25
  b' p2 q& v3 a" H8 w//速度(1-10)- P: `% B. T3 [% f$ n/ a) g
var marqueespeed=3* ~2 \4 H0 y8 e2 k: S& Z* k
//背景颜色
" D' z) i  K+ E+ [var marqueebgcolor="#FFFFFF"# Q2 r1 x" H3 w7 f/ K) r9 L
//是否能暂停 (0=no. 1=yes)?
) X: p% b7 [, B& f4 \" U5 U# Gvar pauseit=1
4 u8 G# A7 r0 e, J2 n; B/ t( l' t: V( |8 T: j" f( }: u
//修改显示内容
0 b& z: H, q8 H9 V- X. ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 H& ]. s2 X# U) n3 n
% _" D$ N! |4 d+ s
0 ^# y3 _0 v7 a9 u7 T
////下面不需改变////////////
# Y" a2 \' T7 y% V" w" `6 O  S' N( j( S7 n# e
var copyspeed=marqueespeed/ c& |7 g% `+ P) ~  B8 h& |' j. f
var pausespeed=(pauseit==0)? copyspeed: 0' V. F$ t/ P1 M' W" U5 T; n
var iedom=document.all||document.getElementById
6 b- _/ B$ H, K) Tif (iedom)! m; V1 i7 W  P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 B/ Q5 H$ d# G0 [" n6 F/ x
var actualwidth=''8 f2 C; B- K  l1 A
var cross_marquee, ns_marquee- {. p! o7 g* ^# ?

) u- o0 `& h4 Vfunction populate(){
" T) d! L( S" h9 O1 \if (iedom){
- o7 ?+ l& X1 F! t( c) @% mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, {8 A3 C' O& i9 J' I; k) o
cross_marquee.style.left=marqueewidth+8! b1 w: ^0 g2 k8 ^) [( y1 g
cross_marquee.innerHTML=marqueecontent2 q. I3 c# O* J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 y+ s; f( A  w. d8 A; X}
0 l( A2 u% S8 m% Welse if (document.layers){$ S8 i: T6 v9 t  E9 A  i2 x3 S) g1 {; v
ns_marquee=document.ns_marquee.document.ns_marquee2
' y2 m! c! y& {8 y! ^" p! [! ]ns_marquee.left=marqueewidth+86 c0 u9 r( t$ B, N/ ?* W% S" G; ~
ns_marquee.document.write(marqueecontent)+ W1 e) b, _* f1 @4 O0 m
ns_marquee.document.close()4 t6 n1 G9 N# A3 `+ H) x3 N
actualwidth=ns_marquee.document.width
) y- ^: a3 k( D  D5 i0 b) x}
. \) l# U$ z4 ulefttime=setInterval("scrollmarquee()",20)
* N0 }+ H" b1 v! F6 u}8 E8 S! R1 G+ }: |7 v0 n* Q
window.onload=populate5 R7 I5 d* L# A" h# U7 C6 ~
$ n) x# q( h' C/ Z8 ~
function scrollmarquee(){
  w: x- \% r6 d* \if (iedom){% ]: y) u  p4 H% f: S" A* d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" x3 V4 a- R* ^& Y( n% @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: a8 w) K# c, [. {9 {2 m  F
else
2 T2 @" R- C& @cross_marquee.style.left=marqueewidth+8  ^  q  {0 \5 A" _' \: z
, ?# I/ B% ~8 F# l2 W
}
  F: Y2 }7 U( R, H6 [' M8 d6 Z7 j5 f$ qelse if (document.layers){
7 E  D7 z; x/ u' {5 ?1 L$ \( Pif (ns_marquee.left>(actualwidth*(-1)+8))1 N/ O7 N. n5 c# ]- \7 M6 S
ns_marquee.left-=copyspeed
8 R. q7 h9 T8 j9 t  A* ~else) h$ ?% y0 p9 A9 ]* u: [
ns_marquee.left=marqueewidth+8
& |! F  f0 X  Z$ r0 m5 J* P; Y" c}
6 I2 S7 |, t# X# ^: f) e6 j}! j3 E) C; ^" G6 C8 ?) p
! E& j. }2 X2 ]& Q# ?  l" Z
if (iedom||document.layers){
1 z) M7 V* Z( P  J* Nwith (document){
0 M1 {6 `. g/ R- Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 f2 Y) f3 E7 A3 s  E- @8 p: `if (iedom){
0 C. E1 z/ z" b0 n7 b0 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 g5 P, v# W% ^! a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): W6 [4 \% H- w6 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" i) E% {5 w8 P
write('</div>')4 U$ C* m- k% l: i0 \2 i
}+ C7 Z8 w# p+ Y" h% ~0 D
else if (document.layers){
/ w, x' J1 ~' n* mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 Y2 n) ^2 y; t, p! Z; ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 P* I  `: Q8 u2 I, h
write('</ilayer>')  D' k7 }& r' ]3 c& P
}( W' p8 J0 {$ D, G: R
document.write('</td></table>')
/ p+ D* d  i: b1 W( e3 ]/ H0 M% b2 a}
, a. e. ]8 g( d}
  {$ T2 ?% l8 d1 G</script>

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