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

网页之跑马灯文字特效

//修改宽度
2 }: {- _) H& |2 L. t. @( t$ tvar marqueewidth=300
$ n2 |9 p" F; z+ I3 Q& u/ L//高度" y! d0 z# H/ y4 y1 _; `
var marqueeheight=25
+ D& C  G$ T* ^, C7 \. Y. X& l//速度(1-10)
, O# ~+ ]9 ?; U5 q1 s5 qvar marqueespeed=3* Q+ ?* A- Y- q+ z0 u" h6 \1 s1 Y% i' m
//背景颜色
$ B+ k  y9 x+ c1 rvar marqueebgcolor="#FFFFFF"
- g( C; g# x8 }/ {3 w7 N5 }3 P5 R# }//是否能暂停 (0=no. 1=yes)?5 z, q  [/ j, l8 y9 F
var pauseit=1
6 |, y1 q, l. i3 W! Q- B' n0 y" p  o) z$ J" X
//修改显示内容4 X8 [& \4 B+ t# v7 p/ C; f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* a# t+ J4 x! ?5 l; K$ z; m* X& E* e! S( Q# H. l
4 z- d  k6 D, T! {
////下面不需改变////////////
) B, p% I2 P8 H' E+ Q
; W, ?/ O$ H( p5 f, B/ q+ x0 Pvar copyspeed=marqueespeed$ J3 h0 k$ P6 {+ A, [
var pausespeed=(pauseit==0)? copyspeed: 0& A2 ~( G1 t* W
var iedom=document.all||document.getElementById, H5 X7 X. K4 }6 r- L  N/ c
if (iedom)4 F0 p" Y  ?( r7 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' ?/ F! d3 k: F+ T' a
var actualwidth=''
% q! G1 g( q1 `$ N, Dvar cross_marquee, ns_marquee
0 A; B; ^  V. z9 |: c* S2 I" L6 \' |1 @' p" I. B2 c3 V
function populate(){  L6 ]& n. D3 h9 d
if (iedom){2 @; w9 N  M. A7 f% B6 z8 D, z; C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 {, Z7 s0 U+ g$ ?6 J4 j; h
cross_marquee.style.left=marqueewidth+8& f+ ~1 y. S% \+ E% B# L- h
cross_marquee.innerHTML=marqueecontent
- f  s" T- M: [, ~( U4 R5 @: n: c9 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 ]. v7 E# a& r7 V+ w+ q. f}& w2 H0 \9 I+ D" Y3 h& J9 p7 ~- v
else if (document.layers){
  t. E) e: Z1 E- h; q2 H/ x* Hns_marquee=document.ns_marquee.document.ns_marquee2
. y$ \! t9 G. c5 L3 _. y/ Ons_marquee.left=marqueewidth+8) M( c/ r' `- l3 h2 b+ R: u
ns_marquee.document.write(marqueecontent)
4 z4 {. G2 O; b& xns_marquee.document.close()
8 ?( a6 }1 R. i$ c  dactualwidth=ns_marquee.document.width
# S9 Y+ Y1 Z2 F; O4 [}
* H, H# [$ t7 m" Klefttime=setInterval("scrollmarquee()",20)4 E, g5 X7 K% o1 J" @( `) c9 z
}7 N5 W2 p- g1 i* R0 F7 g% U& Z
window.onload=populate
1 H9 ~6 d( z! g3 n( {4 m! s( M6 H  b. r
function scrollmarquee(){
$ l3 q8 k( w" V# v5 I- yif (iedom){: Q; k9 R* m% K# Z; D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( j6 |# ^8 l, v/ o) R, p6 }5 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  \' |" D& N$ v0 ]$ k
else
2 Y2 N8 M9 Y1 r$ P1 ]" }cross_marquee.style.left=marqueewidth+8
  E' C5 D% k6 J  {3 P
$ o1 h  [: U7 A: b# |}/ J- I- n2 D" J  t9 C
else if (document.layers){
& R5 @! s. Y+ ]9 `6 o8 c4 n% Gif (ns_marquee.left>(actualwidth*(-1)+8))8 O  ?  e( j5 J- f- J9 a0 P
ns_marquee.left-=copyspeed( d- D9 y, b4 g/ s
else. \. w$ F8 q( s$ ?7 a5 b/ c8 ]6 G
ns_marquee.left=marqueewidth+8, Q+ j8 V* Q! D" e. |
}4 T! g/ E1 W$ ?
}
( b* W5 k% Y. G, H
' W; d, c( N( I& S- yif (iedom||document.layers){$ P: u, A. k% n* a& p/ x# @
with (document){
2 t4 R: H" Z* odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  T4 |1 w4 |( k
if (iedom){
% e  s6 A! t+ }! }3 {: w: W1 Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! y# v5 z4 [& [& A1 Q3 }: Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 s  d& f1 \3 W; M9 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ l9 o7 ?  W. a9 _8 `: m
write('</div>')
, ~, G8 F8 Z- r8 y" g}
# g+ S) X, T- Z* {. relse if (document.layers){; R9 M$ f/ I4 s! B' j; a& N1 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! `/ ]9 s* {, n0 W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ a' O: L4 \! c' ?4 `/ x
write('</ilayer>')
& {) x' {) o" W, ^. T9 b( _}
, s& V( X5 S" Udocument.write('</td></table>')
2 s$ l: N& d: {' P$ C}
7 k( D0 Y( p9 ?* [- i. L}% }# y5 ]! I$ s/ F7 Q4 ^1 V5 u" f
</script>

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