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

网页之跑马灯文字特效

//修改宽度. F8 ^, {; |7 {  a. ^
var marqueewidth=300- I: {1 X' O1 Q0 Z+ C/ Y" n
//高度
6 S; `' M$ P. c1 M5 y1 t9 Nvar marqueeheight=25: X2 Z6 N' d9 q- U+ `; u+ g
//速度(1-10)
1 G& Q/ e9 |* _  ^: \$ kvar marqueespeed=35 j7 \5 H- |7 V% p7 J- O- [
//背景颜色
8 ]" x- a7 U7 Xvar marqueebgcolor="#FFFFFF"- M- K2 r1 E% S; X5 \7 Z/ Z
//是否能暂停 (0=no. 1=yes)?
3 f% Z& y& k( _. v3 F1 k) Zvar pauseit=1/ [7 F9 P2 ?% f4 P) O

& s/ `/ r" I5 P% |9 I& I- ?6 n//修改显示内容) ?7 E) d. K* S! q$ y9 X  A" a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') K+ Z# j: p! c& ~# l: E
" t9 W4 l: J8 Z9 C. D

  B( m3 R9 {3 r( }; V( h# v////下面不需改变////////////. n- U/ S9 o/ i- C+ K

9 P) z3 W( ]! ^1 p9 Z/ Jvar copyspeed=marqueespeed
# S1 `, D# A3 D$ a/ r# C" q* Avar pausespeed=(pauseit==0)? copyspeed: 0  o: [" t5 `- ~" E9 g3 m  S7 @
var iedom=document.all||document.getElementById
1 a, w$ |  \. t- U/ hif (iedom)
0 J2 u2 I) P- q; B; q0 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& [" B" Q& G( |: L; P3 q' ovar actualwidth=''3 L( M' Y& q2 V$ k5 o" I, \5 J
var cross_marquee, ns_marquee
; [: P' L: }1 ?2 Y) w  K: u
- F: y# I% Y6 r' S' {& |function populate(){
8 N4 z- o  J- [. I  vif (iedom){
! X+ C5 W1 `5 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 K, i# f; f, c' G6 L
cross_marquee.style.left=marqueewidth+8" Q- |# m4 b! P# D  u4 |
cross_marquee.innerHTML=marqueecontent( j. J( G: O# @! b3 ~$ k3 J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 Q- ?3 n' z* ^  w3 l7 c) ]}; N" ^+ s9 ]* v2 Y
else if (document.layers){
, f1 z+ t. g0 m$ q' m4 T) z' ^ns_marquee=document.ns_marquee.document.ns_marquee2
1 l: b+ }3 g4 Q( i4 v7 K+ ~9 Qns_marquee.left=marqueewidth+8) \$ D# r2 p- e9 K
ns_marquee.document.write(marqueecontent), v+ M/ {! q& K3 s
ns_marquee.document.close()
% A9 F5 F" K" s4 k. c& d( {: mactualwidth=ns_marquee.document.width
9 R8 S( t$ y7 t6 ], N}
: E& {# {: T( B; C- ^6 Z  x# ?# Xlefttime=setInterval("scrollmarquee()",20)
, N. c! ]6 V+ _* G}1 d/ I: l: L" t9 e
window.onload=populate. b( {* Z$ V- f" [

  O- _* H0 p( Pfunction scrollmarquee(){( P2 J# Z' e2 x8 Y" B
if (iedom){
8 w# v$ v. V+ U- ?) x' T) tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 G( C: `% b: k' G9 C; rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- Z4 h0 Q; s- {. r  oelse$ G' t! _3 f( f
cross_marquee.style.left=marqueewidth+8
) w+ g5 C! x2 I) i- O& [! q
2 l# P9 U8 q1 h! F}
, ~( G4 K6 P. Felse if (document.layers){, T4 c. H1 h. [2 p2 _7 ^- d
if (ns_marquee.left>(actualwidth*(-1)+8))
7 ^+ ~7 W  w! ~7 ~3 q; U$ I. `ns_marquee.left-=copyspeed/ V) I+ K% X  u
else4 Z. C  S( q6 s& o; u
ns_marquee.left=marqueewidth+85 e; k) t6 Y# A! c/ ]
}
* U9 b3 m- r: r9 f}* i6 N. f) N9 I% ^/ w' o

- a! u% s4 W, V4 H/ L, l4 kif (iedom||document.layers){; j' O7 z7 D  N6 e1 ^
with (document){
2 v" H  A4 j8 u; M3 x- a4 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 F. d. g" [# t* V( W
if (iedom){1 P/ v# u" w$ ]* H1 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% N. U; q9 ^; {" m4 z) R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 K0 u4 M- m8 e8 y' b$ o2 n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, @5 f, N& @/ P+ I6 Nwrite('</div>')
+ ]7 K  ?1 @# d$ n, g0 ^, g9 p}2 c- n4 h3 ]! ]. k& t) X* v
else if (document.layers){$ f+ b2 H+ c  N2 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( s1 H- O* }/ v: M% a) W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); I- T  v; l- q0 L* K& Q% ?+ @7 k9 M
write('</ilayer>')
; L' ]+ D- C9 z5 l. a1 T}% }7 h3 u  ^: F. b, J
document.write('</td></table>')4 H8 z- n6 c5 [+ z
}
7 A3 q$ l7 x+ o}. e3 O6 t  o3 D' o7 I
</script>

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