获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ Y  H2 {2 L6 K) t2 {' y: M! Zvar marqueewidth=300
  [! S( O+ I2 [9 J' Z. @# q' R//高度, C, a. g8 y  C# u- m, u
var marqueeheight=252 g9 T! F3 x# R- Z$ {' @
//速度(1-10)8 x5 N3 ?! a0 ]+ o1 K0 Z
var marqueespeed=3
! c+ D' K! `5 y) ?! Q& M//背景颜色
) C6 s  {/ m" T/ zvar marqueebgcolor="#FFFFFF"
3 T# U" f- y* h3 i//是否能暂停 (0=no. 1=yes)?( Q* ]4 T/ z! p4 T2 P
var pauseit=1
! z- F4 F) M4 M' J( f# J/ @) O9 U  d3 U0 {+ k
//修改显示内容
% c6 e6 r, K3 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 a( V" R8 G8 ^3 T" U  c
- T5 g" P1 S3 {# \. ^2 }$ F
' D( V) q- m) c/ E3 c- e////下面不需改变////////////
- x  F9 k6 r9 g# k( n& {; f" C. {! c: |7 ^! ~: v% j& R
var copyspeed=marqueespeed$ }5 Q1 p2 Q9 }; D: z: c8 ^) S
var pausespeed=(pauseit==0)? copyspeed: 0
# c& B, b8 Y1 |3 i) Q, pvar iedom=document.all||document.getElementById
, Q( W- j  Q2 \! I! cif (iedom)2 r" \0 [6 _4 G# c% A- X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 t$ w  x; A, a- Qvar actualwidth=''
. k0 @. J+ ~/ n5 k1 P& I& g; Fvar cross_marquee, ns_marquee8 n* Q$ S; {( M! S2 G7 Y

( q: k# l+ I) A/ a! wfunction populate(){0 Z' ~  v1 I! |  f: ~& J+ y
if (iedom){: E0 V. t7 c" K% c) ^* s, o" {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: H1 Y- I( v7 S/ X) R. jcross_marquee.style.left=marqueewidth+83 r3 h. |- U- x4 ]
cross_marquee.innerHTML=marqueecontent' S& N9 e0 S; z/ z! H3 b& g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( K" R, i3 y& e7 t, C4 X}
' a2 d* X" p6 kelse if (document.layers){3 P, h# k$ u) o0 A8 U
ns_marquee=document.ns_marquee.document.ns_marquee2# T- h' T  g# j- T& j% O
ns_marquee.left=marqueewidth+8
3 K  E9 ~% @; V. I9 u7 wns_marquee.document.write(marqueecontent)
) d, a5 L3 y4 B" kns_marquee.document.close()
3 m/ P' F+ c: d+ r2 @actualwidth=ns_marquee.document.width
4 V! D! e* N8 W( S* v' S}) R: j* m' p1 j
lefttime=setInterval("scrollmarquee()",20)
" p/ q* @: t6 I  M}$ k: X* }+ d# \: @0 N
window.onload=populate
6 O/ O, r' F  T( a; k8 Q% E5 P& ^
3 U$ A* d6 ~' {0 }function scrollmarquee(){
7 Z' {4 U! w. s& g& ]' J: b4 Q0 Vif (iedom){
* `4 [, Y: u, ^: V5 d; |- _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): e+ ]2 v% N& e) a7 N. q* a. a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 ]5 b- s! T; q& U
else
$ o# u4 |- c0 s; H8 `% [cross_marquee.style.left=marqueewidth+86 |$ i  i& F% j2 i5 x9 g, l  j# a

2 E* D6 Y, V3 q5 w, O  p2 P0 o}
2 K8 Y2 ~1 }8 z  Eelse if (document.layers){1 b0 r4 g* |9 K: |. s! \
if (ns_marquee.left>(actualwidth*(-1)+8))2 z. }9 C& s. K  N# i9 w8 y0 i" n
ns_marquee.left-=copyspeed& s8 B) p, e# [8 R# v9 ?+ a
else, q( O1 G; @4 U& ~& }
ns_marquee.left=marqueewidth+8
6 y' j$ B0 U  e: _1 j}9 v0 V3 K8 w; m0 }" N4 A0 I1 u
}
# o( {4 {) R& U2 b2 ]7 A! u: Y/ d4 K
if (iedom||document.layers){7 F# v. f" x% ^, c& M+ Z
with (document){# k+ ~! S4 {8 C8 `! `& J3 ]/ Z0 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' c- F# B, [( A% Y, @
if (iedom){
0 u: `0 \* ^+ e( Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 D8 E% S, D, B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- M, G! r* K; Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 j2 R* S" e$ F9 A# j
write('</div>')5 n3 n- h- W* n' N
}9 R- i5 m9 T2 t5 w% ~: ]
else if (document.layers){# C9 [- [+ V4 l5 `. O! v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' R" w& ?, d* Y1 T' S9 {5 J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" `+ ~+ R4 n; m* A# H7 |. _4 K( Jwrite('</ilayer>')0 v$ u. ~9 D) Y( Z
}
, j! n- A8 a* R1 z+ @document.write('</td></table>')- s+ X- u( z, M5 b6 o" V8 z
}5 a. X& F" v$ d$ z
}; r1 ^0 i# f+ A% s* @8 P9 N- u
</script>

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