返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ s# |5 p. w( u+ nvar marqueewidth=300" @+ V6 q  m, N1 J& M8 f) }' i
//高度( N' p, J0 t* D* |
var marqueeheight=25) Y2 `; @) d2 x. A
//速度(1-10)( ^& R/ Q3 G6 Z* o% V' y( M8 f
var marqueespeed=3) Q: t- Z9 U$ r6 F5 q! H
//背景颜色# P2 i8 F3 m1 W( D
var marqueebgcolor="#FFFFFF"
5 C+ h  g4 P/ d0 `) ?6 w- W* P- w//是否能暂停 (0=no. 1=yes)?
6 e# U: T8 m6 j" o) }: qvar pauseit=1' i7 t+ t4 j: m, W% m  o- T' i; h
  x3 b6 ]4 q5 y/ |/ ]5 w
//修改显示内容$ p5 K& c8 ~0 y6 k% \  c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( Z6 Y9 f9 y9 V# b& |! x6 M) F1 R8 v
- K  d# @" j( x2 [8 h& ?- [  [: ^
////下面不需改变////////////
5 E- j7 _/ N' w' X1 v# `7 X, Y
var copyspeed=marqueespeed7 r" l8 J) b* o  K5 q
var pausespeed=(pauseit==0)? copyspeed: 0
7 I$ U% b$ Y" [var iedom=document.all||document.getElementById
7 M1 g5 x) T" Nif (iedom)
# I" D5 q/ y0 e$ `8 jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ ^$ I7 [8 }5 z+ }4 j' uvar actualwidth=''
( c' y$ M, x% Wvar cross_marquee, ns_marquee
4 B! ]- H: V7 q7 i' @; ~0 h( P% P
( {/ r6 o) k- u4 Q" m. Q1 X1 ~function populate(){
5 R8 Z  N" a6 ?* I/ B# z, b' cif (iedom){3 O* ~+ O" K' T2 F* ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; T- U( f6 ~/ h0 b
cross_marquee.style.left=marqueewidth+8& I% r" Y! w9 ]4 J3 I9 R+ X
cross_marquee.innerHTML=marqueecontent3 E0 w' O6 r0 n2 m# ]# F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* \  b- }: s. |7 V4 N
}
9 S$ d3 d+ D7 jelse if (document.layers){7 d+ l% M, V3 K1 k
ns_marquee=document.ns_marquee.document.ns_marquee2" V! ?5 p$ Y  J7 M/ y2 s% M
ns_marquee.left=marqueewidth+8
( g- c# w& n0 C, Kns_marquee.document.write(marqueecontent)# ~+ d1 L" v2 K8 D/ M! H4 K* V) i
ns_marquee.document.close()
5 a* ]1 J1 z0 [" `. M3 nactualwidth=ns_marquee.document.width
3 N* v$ B) l8 S; S2 v}
, X* ^% _% a, t( ulefttime=setInterval("scrollmarquee()",20)
* _/ @" Q$ d# D1 M}
/ X' M1 {7 e4 s7 M: e: pwindow.onload=populate1 F6 U+ v: \4 K* C

! Y/ b8 i, s; |9 |* wfunction scrollmarquee(){
6 A/ V! g, S- Hif (iedom){
2 f; {4 S- ^: _5 f! A1 U: h6 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" S* a8 S* Y% I0 o6 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ z# o) U' K/ n8 m9 j) M$ Q
else" F  p' m! z( h% T* B5 O
cross_marquee.style.left=marqueewidth+8- B: @5 a1 I+ x4 u" j- Z- Z
) u/ I9 e% s( Y0 y5 |% n8 {8 x8 U
}
! k  B! M: Y2 selse if (document.layers){6 k. g4 X' Y/ v0 P
if (ns_marquee.left>(actualwidth*(-1)+8))
/ @9 P1 {5 D0 ^) Pns_marquee.left-=copyspeed
1 S) `, f/ F5 T" }else
$ B1 f( N9 X$ }. Uns_marquee.left=marqueewidth+8
8 J4 K; F, t- A: S* S+ q}  g: f# t4 [1 V
}
2 U% k9 `1 i8 l* u) o9 r% y; c9 b- ]' n' H. ?' T6 Z
if (iedom||document.layers){
7 l6 X9 K- q$ P2 e* `1 F3 z# Lwith (document){- @1 U; ]: w1 K" C  j; I8 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; l6 M* k0 O/ Y( w) B$ i$ m) ~if (iedom){
9 o6 A; y* U4 p- @6 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 [% h6 |2 \8 _7 d: T' `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 T: w( s- Z9 v. o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( q: [  w/ b; P( K( F2 k
write('</div>')
7 m8 p# k6 ^1 i' g7 F' ~}
+ d5 f8 e# [* ielse if (document.layers){" m' C" @& B# }/ p. a" w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' S* w$ n+ M1 b/ _+ C7 Z( i0 q- vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" c) Q. a8 n- r
write('</ilayer>')
4 Y  N* e: e5 q. r}
$ T; ]* b5 p) s1 Adocument.write('</td></table>')8 D- L" k  \0 @/ B' F: |. |2 ]+ e# x
}. H( \$ X. R: c4 _; T! T
}9 g& n4 k# v+ L9 Y7 O; @! a
</script>

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