返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 U' ]+ E/ I+ Z7 Fvar marqueewidth=300
# S, Z% l6 i; R3 \//高度
, U+ Q* X3 Y" L* kvar marqueeheight=25
+ S9 e: M1 H0 U! l. v4 o# o//速度(1-10)$ G0 ]4 o7 Q  |0 F
var marqueespeed=3
. T3 ~; N# I! P+ R0 S//背景颜色
- F/ D2 z% [3 k7 u: Z) c: L  Hvar marqueebgcolor="#FFFFFF"1 ]7 n) I- a5 }7 g2 B: e. N
//是否能暂停 (0=no. 1=yes)?; K9 W1 ^  O# E8 v& K0 W
var pauseit=1# F' ^' M. o% T

0 T6 x' q' p0 {  n9 r//修改显示内容
6 I9 v' A; X' x9 ?& Q) `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( R; k+ @: ~+ P* C) \/ h) U  e* I& Y7 ^/ \2 l! q, z
/ P# S; H. j3 O% H
////下面不需改变////////////
4 I5 U- g  a5 v* w: V$ w
( ^  @+ [+ i7 {8 N3 Avar copyspeed=marqueespeed
1 w& O, t- u2 k3 `  W0 pvar pausespeed=(pauseit==0)? copyspeed: 0
& W' f$ s% Z6 D  q' z4 j% Yvar iedom=document.all||document.getElementById
  p" }0 t" D" i! P7 v/ Pif (iedom)
( V' |7 c- E, t. r6 z" O7 n& ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 ?: f4 Z# c+ D4 j6 d! kvar actualwidth=''( R; U; Y, t; U5 n% G; |( t
var cross_marquee, ns_marquee9 H% H- c0 [: W4 c
6 M2 ]/ ^$ u9 Z" E% u% X4 [4 x( f
function populate(){
6 W9 ^2 e$ J* Q' h, H( o; R/ I- r9 cif (iedom){
& Y* Z0 s: s; I; d6 `6 W+ b; a  Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 D7 k) E8 W+ W1 R1 @' ^. {" rcross_marquee.style.left=marqueewidth+8
& ?! {1 R# Q) C9 H4 N/ _" q$ Rcross_marquee.innerHTML=marqueecontent
: O, H) W; z& s; uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 \2 x6 c: A) _9 k2 X* e}
) A/ y& N# ?* n  V7 l  ^5 s: Aelse if (document.layers){
- p5 y9 j, y# }3 r  h* O& U! o& zns_marquee=document.ns_marquee.document.ns_marquee23 S9 H8 J+ M6 g/ I" F* W) Y* \
ns_marquee.left=marqueewidth+8
4 @1 s  T/ b* e4 ?ns_marquee.document.write(marqueecontent)
( ]! C- o7 h/ I/ e* |3 hns_marquee.document.close()
/ V) W; h- z& o- H- R0 P* K: mactualwidth=ns_marquee.document.width
* e/ a6 X; D0 w. Q! I8 L}& \; |" p. Y0 h9 A0 n
lefttime=setInterval("scrollmarquee()",20)+ ?5 L" D" x" y
}
# r! N5 J: T& Z6 p% p. @window.onload=populate
0 w9 H3 h# x! \3 J& o5 _" T7 U) K* ~2 L; J4 q7 H# @6 D/ s+ j: n/ W1 p
function scrollmarquee(){- O6 a7 l: Z+ F$ c
if (iedom){5 d3 B( C& I! h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# c1 U3 @) _) c% F  l+ ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ~; V0 d2 R  Q$ t0 l! A
else* w/ p$ W3 H; C  n$ v3 j( F+ c
cross_marquee.style.left=marqueewidth+8: {4 @4 U: ^' i' P# [& {
* @0 F2 A% j7 \( k3 \2 A: }5 G
}
7 ~7 U6 N7 E7 g; g3 ]% j' H' Selse if (document.layers){2 d( ~) x: _7 k
if (ns_marquee.left>(actualwidth*(-1)+8)); Z! a  \0 j4 K( Q
ns_marquee.left-=copyspeed
- g6 {& u0 @. w  Velse
( N: G  C9 ?: j) g& w1 @! xns_marquee.left=marqueewidth+8* N2 o- g/ V& s
}2 ?5 O7 S$ G$ n! n8 l
}$ V# \  `4 R1 S+ ]/ ^! O

' O, g3 l& @* bif (iedom||document.layers){
4 E% r4 h$ s8 dwith (document){+ ?7 ~% m, q% ^, L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: v  ~( `: H) q; L0 R( v: x% dif (iedom){
7 l: _5 W' F9 P' ]% Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! `8 h: f0 C. R; W& Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# I* O& R* x# i3 W& i' dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 O* v/ X9 w$ \0 f
write('</div>')9 A$ a" O6 g- K! {) z3 |. r
}
' V: L' f6 n) T3 a" P- u& ]else if (document.layers){
% E. K5 m4 C8 c. ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% p, p8 T; a! p! L2 @: s8 Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. L/ d/ @$ U+ u3 n5 M9 Dwrite('</ilayer>')
, A1 p4 G3 K; P0 B7 R}: }' n0 k( B8 p6 e
document.write('</td></table>')* t" ]* S1 R; W, ^2 v
}
- Q# f' o" h4 i9 t8 R}1 Y6 e. F2 r) \: l* C
</script>

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