返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 r* q  ]& C1 U; ^& [
var marqueewidth=300$ D. q' `+ c. c
//高度7 R5 A. n! i& R) @9 u9 p% k
var marqueeheight=25
* M( y* b' q* f$ J' _. H//速度(1-10)4 {2 z4 e3 x/ j4 t
var marqueespeed=3
" F* \0 ^' V4 ^//背景颜色
: @- i7 ]) w. _6 gvar marqueebgcolor="#FFFFFF"
2 L( y" z8 |# h+ k* ]; B' Q7 G7 c//是否能暂停 (0=no. 1=yes)?
8 h$ k6 y4 X+ g7 Avar pauseit=1$ u8 j+ g3 W6 o6 O; W

# \% X0 ^  @$ C; B//修改显示内容
: E( q/ o" m, k8 J5 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ]4 o6 I  ^1 W, B8 u

4 u" e6 c% P, T: ?* X1 c/ `) s! {4 D5 n9 v$ o4 h  a/ l# s
////下面不需改变////////////
' r$ e$ P- a5 O8 n" ~2 D3 a' b& v3 ^( C  s1 @( G6 R+ j& {
var copyspeed=marqueespeed
+ X' K/ J. X8 {* W- z4 E# w/ k5 G5 g2 qvar pausespeed=(pauseit==0)? copyspeed: 0/ U) P1 t" N2 r( E! _! E2 N3 R
var iedom=document.all||document.getElementById( t* {1 m# j  B3 @& v
if (iedom)
7 R$ |# O1 v: `5 i) a) m" R3 v( T8 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" q0 c+ z/ C) d& x8 b
var actualwidth=''
4 J" i4 [- d* O. lvar cross_marquee, ns_marquee
$ c  f3 `7 X8 L  ^# U0 E( ^
8 {- _, G+ C5 l. Yfunction populate(){
8 r0 `0 f: S1 Aif (iedom){2 T* E1 M, ^: {0 D& a% Z& @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' a7 H3 Y/ h; F# d& v
cross_marquee.style.left=marqueewidth+82 u3 Y3 b  B# K* P  R4 f
cross_marquee.innerHTML=marqueecontent1 h1 i+ Z" a* Z8 l- F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- I* j, J) J6 L2 D7 X
}* c0 X3 E7 {' |4 A
else if (document.layers){
9 v* F) \  V0 J" N& Uns_marquee=document.ns_marquee.document.ns_marquee2
& {9 ]# m9 G" Ons_marquee.left=marqueewidth+8
4 [$ F7 J) `7 J1 S  y  {: mns_marquee.document.write(marqueecontent)
' J( W# ?5 ^& z4 G( tns_marquee.document.close()
: o+ P" y8 F1 }actualwidth=ns_marquee.document.width
  P( _+ `% q) p}
5 e9 @0 c4 I& P5 ]/ ?lefttime=setInterval("scrollmarquee()",20)8 z0 X) f" ^' o4 O  R. I  y
}, l: U9 }2 c# b
window.onload=populate  S* s* `/ G% Y, T  J; E
9 W3 G+ p! C% _$ z! L
function scrollmarquee(){
) y( i: ~! C) }( w( S- ]if (iedom){
; U4 n2 @8 y, j, _: V( Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' V5 i# m" S" Z; d" G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: a0 D! _4 v  v, i+ e# F- aelse
% s% r( J( |. e: F) [) }  ycross_marquee.style.left=marqueewidth+8
3 Y; c3 a4 T  ]2 ]. l: k0 Y7 U4 c! X4 `- C$ D& g3 z6 j/ [) j
}( |5 L9 N2 H1 N3 p
else if (document.layers){% m4 |8 M/ ]( S  H- Y- t
if (ns_marquee.left>(actualwidth*(-1)+8)). I: e! i& ~; U! o6 z
ns_marquee.left-=copyspeed
7 K- c! e5 E  h7 ]. k0 u; Celse( F0 {6 T; V8 w0 y3 I1 M
ns_marquee.left=marqueewidth+8: n6 X: Z4 Z$ T/ B. L! E3 R# V
}. L( r7 c" O0 M5 g' C
}
$ a* o) s) ^; t( F- F- S; h' p6 L, f0 r& {$ E& k, {7 P
if (iedom||document.layers){
$ x" h. b' ~! N& z: g( v1 Z) a- M8 `with (document){6 R$ D4 a8 U# e/ J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 P, k: X6 q* @2 r4 jif (iedom){
7 z7 V; A& t% g+ G9 `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 x& ~  N: @( x1 U+ z: `. s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  v( F6 v' f( Y/ T/ Q% k: d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# G* o2 C; `- S% [, |+ T
write('</div>')9 K& p3 [! w0 O$ o$ J7 a% U
}
# b, p0 e- y8 D( h/ [else if (document.layers){
, E. u% S7 t9 j% z2 Y' {# U# ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 u# }% Q* B; d" n: W+ a( mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 J+ R5 ^: u, {5 R1 U
write('</ilayer>')
9 x3 Y0 ?3 [. N$ U- O/ h}
1 |/ k6 F" x$ T) {) }- p( X2 X" Odocument.write('</td></table>')/ Q3 i* c7 A( S$ F) C+ L! _
}9 z" H6 D9 F2 U& A( b* M
}
; a( G3 z+ O0 B: z; h' i9 K</script>

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