返回列表 发帖

网页之跑马灯文字特效

//修改宽度* m% a' `" n  _6 y
var marqueewidth=300" P  I' I+ t  `- v# X
//高度' ?6 e5 T7 G8 G+ H9 G6 d
var marqueeheight=25
+ ~5 ~8 E0 @/ d# ~( x% z3 z//速度(1-10)
* j8 O3 C2 v- i" jvar marqueespeed=3/ z: O) d3 v. h  G
//背景颜色
) Z: B* q1 C; Nvar marqueebgcolor="#FFFFFF"
& G1 X8 o) n  x0 d//是否能暂停 (0=no. 1=yes)?# X4 l' [' R7 Y- t3 D0 Q- [; \
var pauseit=1
7 G+ M+ `+ Z; X% k
0 p3 |- v+ B1 C$ a8 n8 ?# m//修改显示内容
; ~. j9 C& X4 p2 C( D/ w8 z% S( Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, i/ N# U6 ^. O' e5 ~3 d/ @% i' M1 F3 F- |. W  o& w

0 @" z2 q6 Q' Q% c# S////下面不需改变////////////
* k- X# k* E# V
3 ]& G# W5 S" Uvar copyspeed=marqueespeed
  p! n5 k. d* X& w: G1 Fvar pausespeed=(pauseit==0)? copyspeed: 0, T( \% N8 L3 F4 B
var iedom=document.all||document.getElementById
8 z/ i- _2 B4 r/ K+ hif (iedom)
; F6 s5 F% F3 L5 s2 o' [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 ^" l7 G; H1 _7 z3 ~% ]8 b0 H
var actualwidth=''
* I; y/ m+ w6 Svar cross_marquee, ns_marquee
/ T# `0 |- w5 ]* w; |( q# K# D
7 h. {! ^9 z! ?+ @" Z; ]( efunction populate(){1 z2 e8 Z. n: U* f
if (iedom){
5 @( J+ ?* }; _- V8 I. ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 P# d4 G) c  R" P1 Y
cross_marquee.style.left=marqueewidth+8* Z7 p8 }4 h* j3 v1 o' u" @2 r
cross_marquee.innerHTML=marqueecontent
) w9 O2 ?+ c% Z7 b  zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: O" d# _" H  M1 ^4 W% \7 o, j7 _
}
- b8 j4 E, |9 q  X" S2 B6 Gelse if (document.layers){2 N6 R8 C! o$ X( b8 g  y
ns_marquee=document.ns_marquee.document.ns_marquee2
( B" n9 E& V2 N( ^! E& R; U# Dns_marquee.left=marqueewidth+89 t8 H1 u# X/ C4 q9 e+ x
ns_marquee.document.write(marqueecontent)
( K  d& _  D% \1 M5 x" ^) _2 f0 ans_marquee.document.close()
, l/ m) P5 G. C/ V5 ^2 Tactualwidth=ns_marquee.document.width% b& D. j3 u' F: I$ F$ u
}/ U& [* |$ {7 `- F3 L/ P
lefttime=setInterval("scrollmarquee()",20)8 L2 W2 `/ b" S( p& o
}0 c3 P4 S6 w& Y4 f$ t
window.onload=populate3 J# `9 \; d& V1 z
$ b. b3 ^( A$ k. Z; F& Z
function scrollmarquee(){7 F/ |' m3 G3 `  |. k& z5 B
if (iedom){7 J% v7 |7 B3 h8 A8 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 |9 T5 d, B5 K3 q# H& e- q  W) g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& A$ `/ t' d6 k# `else
2 f5 R5 C" P) b1 Pcross_marquee.style.left=marqueewidth+8
" K; J) \0 V: z' g  H, y5 J8 ~* E8 M
& o2 ^$ w) ^7 J: L+ b}
+ M/ W) _0 e  V! oelse if (document.layers){
' ~0 k) m& X  B; S8 @  Z0 bif (ns_marquee.left>(actualwidth*(-1)+8))4 v% a7 w1 a+ X
ns_marquee.left-=copyspeed, v" {# }7 L: D
else
6 a4 U6 N/ b7 L% j! k0 h5 Kns_marquee.left=marqueewidth+8
0 R4 E; O' ~7 [0 A6 b}
% p  I  v7 [- x- I; X' D}: q9 q1 Z$ ~8 X+ g& }' s9 {
+ |4 j( |5 e8 v' l. I
if (iedom||document.layers){3 W8 Y6 d4 b! O- P% x0 L! r$ W
with (document){
  k0 s  l$ C0 c) R$ S. M, ]. Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 a' X% i0 y" ?$ Q
if (iedom){( V, \" B$ b% h1 p8 C  F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* c1 x% `; o, g  Y! x9 x! Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 P; E1 u& G' S  G' L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 o0 D( g  A/ s3 K1 h$ m, w+ o
write('</div>')* Q' e: {3 ~2 \$ g' c& q
}
' e. i- Q6 V* e- a: n# i4 Aelse if (document.layers){
# h* l- F; ]$ e! r6 [6 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 v7 q* R  B0 W$ G0 N$ F* \( P5 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): \' t5 `8 N$ i' ~
write('</ilayer>')$ o$ p8 O6 e5 t/ o% b# W
}9 g/ Z8 b% d9 @* v& _+ D
document.write('</td></table>')4 P" ]) Y  _+ K/ t' l
}
( I( T3 H' ^9 S$ f( l; P}
* g) g+ q. v$ l5 Y4 H</script>

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