返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 [$ \  |. i7 ]$ H0 p
var marqueewidth=300" O# i! N$ s6 S7 U' o6 T
//高度) f2 b5 y" O. @+ M/ I
var marqueeheight=25  `, l1 F2 h  w/ J) V
//速度(1-10)
7 \$ Q8 L1 g7 ^2 ]: O- pvar marqueespeed=3
; ~! n! B# Y2 }, U* p" N//背景颜色
4 l  e; Q* E- p; a3 _) Y0 ?; r  uvar marqueebgcolor="#FFFFFF"
3 M- o* `. {: k- \. r$ B2 o//是否能暂停 (0=no. 1=yes)?
, [% C( p, T! rvar pauseit=1  r) d# I- I9 T1 B

2 A# W1 e7 v' G//修改显示内容
. m& @" X% G$ Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 H- g& m7 j5 _5 O- k, _; t' B2 F1 Y' }9 Z
9 O. W. K; L" x8 m7 I
////下面不需改变////////////5 d7 p! P2 A" Q8 a: n
/ v& S$ y' N0 D- y; B) }  w$ L3 ?
var copyspeed=marqueespeed% w2 b" {/ C  R. w" `
var pausespeed=(pauseit==0)? copyspeed: 02 X2 t$ d) j" T3 D
var iedom=document.all||document.getElementById3 w% f& g. {% ?) E2 ?0 ?+ c  P4 F
if (iedom)
2 Q  `) e5 p/ p$ ?) n4 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: o3 f2 x; B, fvar actualwidth=''
5 A" ^  s5 R+ R# l. ^var cross_marquee, ns_marquee
  S' x9 L  x' W  _( L2 Y5 |  G7 W7 p3 z; h
function populate(){
6 b; W1 I7 F( f' b# O  j+ `if (iedom){
. s/ B' k4 K* `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; |* Q6 ^- }% \% j% d* ]cross_marquee.style.left=marqueewidth+81 n9 n( k# O6 Q$ ^- r' H
cross_marquee.innerHTML=marqueecontent) e8 r2 x8 i+ H9 H1 m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* b5 A7 z6 L& G% a* J0 f, b. L$ Q3 \' I}; _' A6 `( }" z( n
else if (document.layers){- n: @$ U. }4 Y" x; S3 c. I
ns_marquee=document.ns_marquee.document.ns_marquee2' V* R7 k( j: N" Z: \6 T5 Y9 z7 e
ns_marquee.left=marqueewidth+80 Z# ~& q0 c) y0 Q
ns_marquee.document.write(marqueecontent)
" H, w+ J+ x( m8 X  Qns_marquee.document.close()
9 A5 \# o4 W! }  T4 E1 O7 E5 lactualwidth=ns_marquee.document.width1 l2 p* S" F0 Y% j
}
  b$ L! N/ B5 ~lefttime=setInterval("scrollmarquee()",20): T! W; L7 `7 p4 |
}  K# H7 m+ [  m& I5 _& O; ~
window.onload=populate
5 S% p4 d6 w) b3 o: ~
$ S* `1 ~" A; m9 w0 xfunction scrollmarquee(){
- M$ m6 C5 Q+ `" N5 q) @8 \if (iedom){7 C# n, J$ q0 o  b6 w# H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 q3 N: r) ]: H5 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ \; Z' E$ O& \5 O) K
else
& J; o6 {) i% O4 B1 Pcross_marquee.style.left=marqueewidth+8
2 w+ P, ^. M! A9 m) Y" ]$ ]0 }7 W  H( D$ u0 R- \* U* n% V. P) y
}; _/ p# T* d7 c! d9 i7 w
else if (document.layers){
9 b. j& E' X# {- Aif (ns_marquee.left>(actualwidth*(-1)+8)); w8 r; l$ @( V$ g& K
ns_marquee.left-=copyspeed# C: M0 v! }+ h8 W+ J
else
9 X; e$ Q' K% \2 ens_marquee.left=marqueewidth+8& S6 C4 J; B( p, C
}
6 N8 F8 r. b8 Q8 c& p}
3 [9 F% A+ o$ K3 B2 a
: m" c0 }# r; y' l5 d2 Rif (iedom||document.layers){% ^0 j5 w- z/ `" Y' F' x* A8 L% ]
with (document){
' D* {6 G9 P3 Z: Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' I. T, l5 T* l' Y* r2 F/ nif (iedom){+ L+ f" s) n: O1 i0 ?! L! C* U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; C. x9 h) A' V. N5 }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* S2 p( u, h2 [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! z5 h/ r: U" _write('</div>')
; T  S% m5 y3 E( T5 o6 P}
" S& Z0 q; F1 Q% I2 ~# felse if (document.layers){
+ F2 ~" r% E, @6 N# P' h3 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 U6 e- r" @% `( l" k8 t, t( uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 T( H3 R- {( k* J6 B
write('</ilayer>')3 c- k& Y, c! E8 }
}- S( X& Y! z4 R  t; n- }# @
document.write('</td></table>')/ Y- Q* X2 L. B) E: |. h5 e
}
. j- k5 b- v% z}
% Y5 Y$ R5 D8 T2 M" u% B</script>

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