返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 o4 I1 `; C; O; V
var marqueewidth=300
4 D; p6 D" l. j$ X+ i//高度
( I( {# M1 A# o2 z" P1 @8 w+ i6 F/ p( |var marqueeheight=25# D/ l  m! u5 d" m6 F9 N/ h/ I  u3 X
//速度(1-10)
* o+ q+ t# `  t0 z6 M( `var marqueespeed=3* V( @2 z9 B8 U+ O6 H7 ^& ^
//背景颜色
8 R) K+ H# L( q; `var marqueebgcolor="#FFFFFF"
) @1 `, p* @" x# [//是否能暂停 (0=no. 1=yes)?
2 d% H0 |9 C+ y: u+ uvar pauseit=15 w; {; r- k  d

) b4 D0 R& d) @4 e//修改显示内容
1 Y  a$ c- m( L- j6 Y% q0 d; }# Y: Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& Y3 L" X  B6 r4 e0 c$ l
* L; z/ J# K+ z& T# J
" i* i# O% g" a, m
////下面不需改变////////////
  `( A: p4 w7 l# W' d8 q1 t) ]& |, V* M/ X# T9 I
var copyspeed=marqueespeed: |! x: l+ D5 d( X' N" V+ N
var pausespeed=(pauseit==0)? copyspeed: 0
; y  M/ y# ]& t( Z- \( \var iedom=document.all||document.getElementById1 y/ O4 Q- I. J- ?6 F
if (iedom)& R/ z" y, ~2 R  _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ G5 @( |, M6 q9 f& z
var actualwidth=''# g( f2 I" S9 \1 m4 M$ d1 J% e
var cross_marquee, ns_marquee
* c( y5 w! K, v/ h9 Q
4 i6 h0 a" t6 I' F" Jfunction populate(){
* g9 z* N3 `5 z2 h8 t, nif (iedom){5 D! _* K8 _; N, D9 u- f4 d1 t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) S6 K% {3 c; q! F2 z
cross_marquee.style.left=marqueewidth+8' r0 R5 a( i1 X) b. E
cross_marquee.innerHTML=marqueecontent
! D) {5 z" Z+ Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  b7 X( B. ?  v' `+ L, ~9 }}
% S+ r' k9 u7 delse if (document.layers){
! Q. Z/ }- n3 N  g3 b" T2 Kns_marquee=document.ns_marquee.document.ns_marquee2/ k( M" W1 k5 S) v
ns_marquee.left=marqueewidth+8
3 j, K, A; p" j, s$ u: w* Uns_marquee.document.write(marqueecontent)
. J: ?$ A9 C# x% v$ ?' M7 ons_marquee.document.close()
3 f) k5 k( r/ S% W+ v5 Zactualwidth=ns_marquee.document.width
8 x) z  h7 C; t}# e. a, y; a4 ?+ Z
lefttime=setInterval("scrollmarquee()",20)- C* ]. d8 S8 g
}
4 D$ F9 U7 M# k4 j* [0 S; vwindow.onload=populate
% k- X: n! B# x: W  b3 Y' h7 \5 J' C7 C; o7 M) P, F6 E
function scrollmarquee(){' l; M" @7 R! Q3 M9 i
if (iedom){
* z; D6 x/ g0 j2 G' U4 R) X1 k/ xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# D  s0 C  S8 ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& d8 r; ]* C- |" D$ t
else5 O# _* s: N2 {9 Q; p
cross_marquee.style.left=marqueewidth+8
# Q# |& |/ w# I* w6 B+ t/ `/ n# ?
}
. u9 q0 o0 k0 Q3 x  x) Melse if (document.layers){: V" w" A0 ^4 o; K- A
if (ns_marquee.left>(actualwidth*(-1)+8))
) A1 A- q0 c9 L  F  q9 h* M- xns_marquee.left-=copyspeed! U& {3 C: w' N" \. [
else
+ D- o1 W5 ?, n9 |5 xns_marquee.left=marqueewidth+8
$ j4 ^/ h  @  m) ?. e}5 M+ E$ p4 Q& u( X* _
}
8 W# s4 f1 Z4 [2 r9 c5 s+ |, n$ ?" ~
if (iedom||document.layers){- _& l0 }2 F; N; r+ g. [
with (document){
+ p, K) |+ U3 `1 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 o. ~: c# U! I) C+ v
if (iedom){
% ~) i4 L. d  }: y% ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) D& Y- h1 t2 u  p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), b  W: _0 m4 M9 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* P6 n2 d: g+ Z* p2 W$ F9 awrite('</div>')+ M: d9 E7 [' c; x
}- z# {6 L. |  H" C$ Z8 H3 G
else if (document.layers){
9 e  r9 L' t/ Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ V, ?" o7 ]: T( \  f( n- E3 H; `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- ]( w, J  `. p# @9 }& _5 w
write('</ilayer>')  h; ^5 R5 C8 E3 N' q( Q- ?
}
. W" C/ r7 e" Mdocument.write('</td></table>')  t( P. T* n. }; {8 Y5 o
}
1 m6 }. R' g: T) c, _% e}
6 `: a2 c4 b6 q( i' X' T! z</script>

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