返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 C# j6 G0 q. G: |- e1 g: V$ [) ~
var marqueewidth=300
7 X( f3 s) p4 G7 _  ]4 @, S//高度" K. f" R# m* A. |- h6 V" J  |# A
var marqueeheight=256 F/ x5 C: H; M# V$ G% `
//速度(1-10)
1 o* F( _5 Q+ @5 L0 k. l0 a2 rvar marqueespeed=3
5 L: p4 v3 y/ t3 c4 f4 |//背景颜色
5 a  H7 g5 l$ H* E$ w& Vvar marqueebgcolor="#FFFFFF"2 I# K' v" c0 w7 V5 S! w
//是否能暂停 (0=no. 1=yes)?9 D2 ]$ s  u3 i) h: F, _  \0 q
var pauseit=1
4 h* c9 l, F! d& p5 j) l( m* G8 D) ^4 Q- O
//修改显示内容: N3 W8 r; ~4 J0 H& C+ A+ \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# x# g- U/ |- T, C6 H: T
3 i3 P- V0 }0 f1 y8 b5 H
* A2 c. l8 {* E& ]$ n8 R, e2 y6 }////下面不需改变////////////
- X/ g7 i, `% M9 K
7 h8 @0 O" V/ M4 F2 P1 w8 A! g" mvar copyspeed=marqueespeed. U  Q. L, V1 y. x# L- g
var pausespeed=(pauseit==0)? copyspeed: 07 V  T: p  }: w1 U. o1 y4 m
var iedom=document.all||document.getElementById
, b" }+ f) c( P" k; ]. xif (iedom)
* E4 W( M' o3 }3 \+ J; i6 \  R) |& ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 z4 n: _  r3 x3 B& v6 ]
var actualwidth=''
" C1 x, K9 X! r# Z4 _) W- ?var cross_marquee, ns_marquee
# d3 Z; u/ M" q9 ^& ^# c" @0 ^2 j: A4 q! Y7 ~$ \% s
function populate(){! s: c" c& W+ P
if (iedom){
9 m4 c% A# V( Y. _9 u! fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, s- P7 L, m, s  A2 a" k8 f) I
cross_marquee.style.left=marqueewidth+80 k9 S- V! [3 o4 T
cross_marquee.innerHTML=marqueecontent( J6 f) `1 ^. V3 u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( }* S0 X" L) d9 s* D! X}$ U: |7 z6 _  ?/ j6 l+ S* M- ]5 Z
else if (document.layers){
: J- P& \' O% j3 `  C, Jns_marquee=document.ns_marquee.document.ns_marquee2
% B8 t& I- d9 c& _- Wns_marquee.left=marqueewidth+8! V# W! C6 ~3 `, v( l2 y* u
ns_marquee.document.write(marqueecontent)9 z# W2 t) b' J
ns_marquee.document.close()
; D" w. B2 Y  Y; y/ m- w- Pactualwidth=ns_marquee.document.width
" E: ]9 d: C# x6 S. F# u* U( R}
" H& Z* B- w! j( j& ?1 m% V+ i" Llefttime=setInterval("scrollmarquee()",20)
+ @/ m* E2 [& G8 D}
' D# `/ o0 b1 }" ?. Nwindow.onload=populate6 d4 F' U3 _, z4 ~

) y- Q0 s" l& `function scrollmarquee(){
" Z: Z7 i6 O! Eif (iedom){/ u: K1 p3 y# u; T( M6 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. `# w1 x9 F& M; S) p- v$ @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  ~4 c2 v4 G. |4 s7 D
else
0 b  T: x8 t! T1 N/ q# N# A* ycross_marquee.style.left=marqueewidth+8. Y$ V( B  z0 Y! L
7 W% V( g8 }' `  P9 Q. }" @
}# l' A. s7 i9 G! h  x6 `9 r
else if (document.layers){
4 W0 U0 J" c# C: {1 V4 p' `if (ns_marquee.left>(actualwidth*(-1)+8))
0 ~  L, D- U5 l; w/ q7 X7 dns_marquee.left-=copyspeed! j: ?( D5 Q6 M7 r! }. {+ X5 o
else+ }/ S! W0 T9 \' Q! t7 I0 V' Z
ns_marquee.left=marqueewidth+8
6 x: }$ [6 e2 H9 {$ {1 e+ e3 G}
! d, F4 S4 Y# y% i" V}0 V5 \( D- W! f: `* G7 l5 ^4 E

( o  e7 [6 L+ ]" D* ~if (iedom||document.layers){
, A2 s/ f8 l8 v6 P1 x% g9 O2 M/ Xwith (document){
2 J0 s6 Z! ^6 f- u- {" R" l3 z( Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 h4 ]. o! K& ^  H  {" Iif (iedom){
5 l9 Z% }% N. N7 ]8 I7 o" ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# r7 ^3 F( L* Y2 d! \5 e% x6 Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 v' R% G; s- x7 a* D$ b% y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  r8 J. G1 j/ X% w* s
write('</div>')9 M+ A/ w9 H! k  i/ q; v
}8 A! F! V) p. I9 w% [! {
else if (document.layers){
  w7 k3 t, N3 q& `5 K9 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 R+ M2 t! `7 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) O& a8 S3 Y/ n+ P) e4 T6 s
write('</ilayer>')
% e* f' z% d7 I3 z" ]2 k3 y}. U: b& n% V1 r+ M0 Q; n
document.write('</td></table>')* k/ d3 T) z* ]! q1 |
}  S  w) B1 G3 w7 x$ R3 _
}' {4 H" o; {1 c
</script>

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