返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 j! L8 G3 c' evar marqueewidth=300
, r. E' U7 K5 B; @$ J* L# s//高度* `# F% x0 y& V- {
var marqueeheight=251 G+ m8 N" \3 I, r4 B
//速度(1-10)
8 l. r1 s2 J/ l( Z: M1 rvar marqueespeed=3) O4 b! @9 i/ M* q$ c  X
//背景颜色" e* ?& U  [7 i( X% f/ O
var marqueebgcolor="#FFFFFF"
& G4 H0 @0 V* Z; t6 F0 [//是否能暂停 (0=no. 1=yes)?$ p7 |$ m: X% |6 q5 |5 ^
var pauseit=1
$ y3 u5 t, B3 }+ `0 X4 m2 r) }% j$ ^
5 a1 E7 F, h; L6 M//修改显示内容; R% N  V! E2 [0 s- g2 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; U, g+ X$ N/ q8 h2 b  a/ ~, Z/ O4 P# Y. ]! U5 X8 c
+ R- G, e5 j2 J( z. E- K
////下面不需改变////////////! ?. k, ~: j, M& W" N8 ~

7 B) T3 }) `2 F* C9 l/ o8 Dvar copyspeed=marqueespeed
' `! z" z  O1 G3 {. H: V& Svar pausespeed=(pauseit==0)? copyspeed: 0
5 S- S( m1 B# S$ w/ O  g8 P! N7 Bvar iedom=document.all||document.getElementById; h$ s8 ?! }) j5 K( H" p. ?
if (iedom)
9 Z0 b& f) k/ i) B! f! hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): s7 C5 `: y, E
var actualwidth=''
  H" b$ t2 N2 w8 v% ~var cross_marquee, ns_marquee$ [0 |7 h2 v! ]& `1 t
  p2 }) e; t4 x) G4 @
function populate(){1 N. p. L; s/ |8 B) Z
if (iedom){( N, g! s  Z: c" i4 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 D' @5 B! s3 p2 _
cross_marquee.style.left=marqueewidth+8' j7 Z& b: H! Q. Z. Y3 C4 H
cross_marquee.innerHTML=marqueecontent
: }- G3 b( k' S, u+ N# Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& M: `3 |/ n. H" ^) b; o}
2 k! M! Q' _( c( P& x, ]9 h/ qelse if (document.layers){
  k- {- B. [: c7 A; N4 z& C  d+ Fns_marquee=document.ns_marquee.document.ns_marquee2* M5 y* ^8 T$ j, i( G5 _
ns_marquee.left=marqueewidth+8
6 h0 T/ u$ z" G& O" Fns_marquee.document.write(marqueecontent)4 o) Y' Q( k6 W
ns_marquee.document.close()
2 E  x/ M) c+ H6 m9 Y5 l1 dactualwidth=ns_marquee.document.width
" _7 N; @9 F3 q8 M0 l9 c}
( `: f2 _. v# X  r# X4 Alefttime=setInterval("scrollmarquee()",20)
1 c, X4 U; T7 B$ T3 X}
- r; z& @9 I( s; Fwindow.onload=populate
! f: B) o# z) U# X
4 h5 u# q* V$ K8 e2 s6 k1 kfunction scrollmarquee(){
8 t5 i9 B1 [! \/ T( U8 Uif (iedom){
- F- x; o4 t3 G1 H* rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 ~4 V: h  N9 h! `  A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, e# y7 F& y! L, l& t; n# O
else
% Q* }1 W1 M+ Q* P5 ^& ]cross_marquee.style.left=marqueewidth+8
  ~& ^5 u2 ]% W2 z# I# O* U- S. O& `
}
/ n( [$ Q! m: G' v' [else if (document.layers){
% l1 _# p7 y. q2 E! V& O7 {# pif (ns_marquee.left>(actualwidth*(-1)+8))$ B5 j, Q6 H1 z- B
ns_marquee.left-=copyspeed' m. {  I" c- w8 m
else
" ]: u1 v4 R4 u* s6 Uns_marquee.left=marqueewidth+8# M- _+ l) c0 u
}
& H: ^) ?* v( }9 l$ A}0 u) _8 ^* C% g
9 a: ^( x6 a* k1 A+ x$ U
if (iedom||document.layers){5 s3 L4 j( F4 |- y
with (document){" A4 Y( O8 T9 b" f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ [7 s7 f- A5 c7 I2 K( R) I* C
if (iedom){
# Z! G+ B7 [4 X/ H4 A2 W% z( Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ }4 K( w5 `  p, y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! L0 s& ^! M& b# u8 |; F' u. Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): v+ b# j! G1 r$ f7 O2 N
write('</div>')
" K0 V6 `* L* Z- a}
" H" L9 e; L/ y$ B- j7 N# }- Relse if (document.layers){
* k; d2 E+ t' l0 y9 a; n' {# S! Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 c: ]2 B& {3 ?& p0 C8 z2 u0 Y" {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# f4 d# c: W( ?write('</ilayer>')
/ q8 I8 {# P: i/ Z. d}' i" a/ n# C  |
document.write('</td></table>')
! q2 ~  m) O6 |& `}6 _6 o' e! l" j
}4 D! }; A# Z+ E5 J! ]/ Y: R# A) T
</script>

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