返回列表 发帖

网页之跑马灯文字特效

//修改宽度: ^( R0 w" }: P6 ?+ G- z) U
var marqueewidth=3002 b5 g* q1 N9 `$ D4 T
//高度- A. J6 k9 N$ L' H: l% \
var marqueeheight=25; ]6 ]+ m0 K% I) w5 b& d  d
//速度(1-10)  V) U& i6 l, `; c- g; F% b( M
var marqueespeed=3
! M# v. W' H8 i+ @/ [//背景颜色8 d+ d" K; j4 {% ^' X/ O
var marqueebgcolor="#FFFFFF"+ {3 I- ~& F3 J
//是否能暂停 (0=no. 1=yes)?
7 ~( _# A7 G3 E: w( ]var pauseit=1% m; ?% c! P% B1 ]" J/ k$ P
$ q9 U4 g( W# a1 i4 b$ Q
//修改显示内容
: O: B) @- \: H: x; r2 i6 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( k- V) O, z) {* |
. J# K  \& d0 H' A% H: F% W  G

7 ~- |! R0 y6 q# U! q////下面不需改变////////////
) f, V* J6 t5 l  `
' q' E" G( R8 c6 ?var copyspeed=marqueespeed& y+ [) Y! D. h/ F
var pausespeed=(pauseit==0)? copyspeed: 0- j3 R- x) b# q0 u6 z. _5 P
var iedom=document.all||document.getElementById
+ ]" R9 M9 `1 j1 r! n, G. e# }$ D8 cif (iedom)
2 @1 f! y& c, _* J4 Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 W( |! w. u! @- N% T+ y
var actualwidth=''
. V7 F1 k7 W- j/ S7 @. Rvar cross_marquee, ns_marquee
; K; U: c0 b2 o& J" a9 n4 A4 j- c* v- F: _# Y+ ~' u
function populate(){
7 j' Q7 m1 A# L) D  Q7 K" Kif (iedom){
% f: t9 ^  s  ~2 P1 scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  X) g- _, N( }8 h$ K$ d
cross_marquee.style.left=marqueewidth+8
" n8 `4 ^9 W% z4 Fcross_marquee.innerHTML=marqueecontent- I6 H# Q, ?" F6 G' D0 Y6 d5 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 J& _" N( e% b/ F5 @
}
1 ~8 D4 j4 r1 v6 S7 Z# `else if (document.layers){
, l; I& t. s1 i* U3 e4 I3 {9 c5 lns_marquee=document.ns_marquee.document.ns_marquee2( d/ r' r, E$ n6 b. u& h. L
ns_marquee.left=marqueewidth+8# l- K3 r3 U- q. E
ns_marquee.document.write(marqueecontent)
' o5 q( k8 H. ?- U8 fns_marquee.document.close()8 J+ G8 z0 V- I9 C. t& n; z  r
actualwidth=ns_marquee.document.width8 L/ ~* T" T) q* y$ }/ n1 ]6 z
}
- p1 T$ }; T9 C9 _/ \9 t( ~lefttime=setInterval("scrollmarquee()",20)
% n7 A! X$ z. b& E. g3 f4 j}/ I, O- o7 G! ~+ b/ b
window.onload=populate
! K: _/ m) N3 X0 I4 k. \) H/ c4 {8 H; v% S
function scrollmarquee(){. B: L4 b; u+ X1 G) m1 J
if (iedom){
9 V+ Z9 `- Z) ~" t3 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 O# v. ?8 }( C8 S- ^, Z! k3 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* b8 _# h) B( o& Gelse
- P' C- D3 X- ^5 @. J# Y) _5 ^cross_marquee.style.left=marqueewidth+8
% w$ P; {: k- J- ^8 t- R4 B2 v( m9 I6 Z& |8 ]) x
}6 D* ^) ^) r9 [: H( Z* {2 m/ T
else if (document.layers){
* O( M8 Z2 p& ]2 ~if (ns_marquee.left>(actualwidth*(-1)+8))
$ y$ b; n7 L8 l+ k  C3 `ns_marquee.left-=copyspeed
# E* w# z3 u, L* W. {+ Velse" t2 W1 p7 I3 U
ns_marquee.left=marqueewidth+83 q6 X" P( E. `6 R- J
}7 ^! ?  Z- i, y- o7 J2 E& ~$ W. _
}! b6 R$ }& F& H' A) z9 N# g
- f2 n& k; n1 y' W7 L
if (iedom||document.layers){
  b) H& T: U! P& [' v* e" ewith (document){
; N2 Q: I. N: _$ c1 R" X5 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) d& j. o7 q3 l3 [6 y+ z# Rif (iedom){* Q# }# \; s* [' T( x- r1 t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. E1 B& Y2 }/ g" ~. Y! Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- |2 _( p' `' K* i( owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, i( W3 K/ e* v2 x8 hwrite('</div>')7 z2 n+ C' V2 ]) w' E
}/ _* R( _8 |  A
else if (document.layers){
* N) {- w4 K* ~% Z' Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); {- c% I; V, ^# e- M; x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), t; ~, e- g, L. |( {0 ?7 i
write('</ilayer>')
. R& L/ U6 N# F3 F& |. v( |  y" M}
5 y  `; C0 y7 O3 Z. S! {. Ddocument.write('</td></table>')$ ]& W, q$ B# T' i& [6 ~% @
}
0 @, U# n( H7 J$ E0 h6 O}# t+ |: ?: l& ~
</script>

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