返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 K* W: ~- k4 j) G+ U& p, [var marqueewidth=300! j5 \- [0 f. H( e  T( C- C' v
//高度
5 n/ ]3 W* N1 evar marqueeheight=25) t6 C5 a9 V- H# H
//速度(1-10)( o3 a2 C. a+ G3 {- _
var marqueespeed=3) L: a2 y' B5 g. ?
//背景颜色
: ~, @1 l6 }9 C$ T: I: f5 Mvar marqueebgcolor="#FFFFFF"/ J6 q% {3 I. q$ ~9 _. R
//是否能暂停 (0=no. 1=yes)?. B4 r8 `7 j0 L8 N
var pauseit=1! n. Z; |4 w) y
) I  r6 o* g' D8 I  b
//修改显示内容
2 j5 `; l: e$ `9 }! ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 e; i* L9 A# B6 `. H8 g- r. g' g
2 D+ K" P0 E" U6 A$ H, ^; u$ c
& {, e4 v3 _! M1 r
////下面不需改变////////////% n" D% I% G/ }

* ?4 G/ U4 t- x0 S6 H( T  hvar copyspeed=marqueespeed0 u# S8 |0 {9 R; }  J
var pausespeed=(pauseit==0)? copyspeed: 0+ k/ N; \6 ~  \- h
var iedom=document.all||document.getElementById  e9 Y, p: w) e7 m3 A+ x! q3 e
if (iedom)7 p& P: ?3 E& U+ E: D, o* @1 G* _. g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; [9 @1 n, G# I; Y& W; |( M+ gvar actualwidth=''' c! ]2 z* Q7 e7 v* {+ a/ c
var cross_marquee, ns_marquee
9 |9 G5 {5 R5 q' ]" |3 Q  B$ I$ I9 c" T
function populate(){
6 g$ e& T7 U1 C3 Z# ^: Uif (iedom){* E& j1 [" Z4 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ U0 G% E% G/ G. U! t
cross_marquee.style.left=marqueewidth+8
2 {/ p' F# P; [cross_marquee.innerHTML=marqueecontent
( ?( u, E% J+ aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. o# x5 G9 t+ ]. p2 [4 I! p
}
- L9 Q- f  A! o9 Velse if (document.layers){, \" b  h* v  i! G
ns_marquee=document.ns_marquee.document.ns_marquee2
  f( M. F$ k+ m: l1 w8 N: Q6 B. j; Tns_marquee.left=marqueewidth+8
7 t& P( S! ?, j: G( b+ a) C" n# x; jns_marquee.document.write(marqueecontent)
& h3 q8 @% J' t5 Kns_marquee.document.close()2 v, G3 b' d" \* V1 S. k
actualwidth=ns_marquee.document.width& o# }" {$ V7 z; n0 \( ?
}" y( M6 q' u3 a# {& }
lefttime=setInterval("scrollmarquee()",20)
2 J" u9 c) _& ?) j/ {) ?( v3 Q; N}
; p" I. f* e# P( K/ D8 Vwindow.onload=populate1 r% p, ~( |2 U  P

& h' M% J1 X7 X& r3 b- Vfunction scrollmarquee(){
8 Y  h9 t1 L8 S) h8 K0 }if (iedom){
  h8 b, x. v9 ]8 x" [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  W# A+ q+ r$ i% ^/ j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) H2 i+ z, Z" I. {  m* `( `
else
5 R' b2 x0 o6 Y7 ]! P, U3 ^cross_marquee.style.left=marqueewidth+85 W& P+ x+ ^# K! A
6 }( k2 e! K. c6 k  }  c( X
}5 o* N- N6 \3 Z7 K& Z
else if (document.layers){
8 n. z: ]3 p- _! G* hif (ns_marquee.left>(actualwidth*(-1)+8))
+ m5 C+ [/ k1 m7 w" K& I+ U) Y/ X" A9 {ns_marquee.left-=copyspeed) r1 P  r2 k- s. y2 {
else. a( W( ?7 @8 L
ns_marquee.left=marqueewidth+8) c- h& o! q+ l& h" ]# |
}
. T% U, T' I: m5 V* ~  f% A}
- {; T2 n) E% n/ ?4 V7 X8 Q3 q) a1 |& N) A0 f( J
if (iedom||document.layers){
; ^0 Z0 S- m3 lwith (document){
7 q' Y9 ]* K6 ^4 ?. ^4 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 O/ z* j8 W) i; U7 Dif (iedom){( L; g- H6 s9 X/ I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: {6 E- {; R& a- _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 n; Z$ p0 z1 w# N% T, y+ @4 e- Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  N7 |' U" [  M$ |2 Z$ _! [, |2 |
write('</div>')+ j) o9 @2 ^6 F7 H5 z" B$ h! R. b9 [
}
' p+ V, a2 k* I4 g1 K# Gelse if (document.layers){1 V/ S. y5 V0 \/ U# {5 t8 H( {! w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 k) d( J5 q$ R" m5 ^6 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ B2 h7 k- k+ T8 T
write('</ilayer>')+ W8 j. }4 m* m4 [% D" L4 x7 b1 Z
}
" a( Q( I3 X0 k/ w/ e  e& _document.write('</td></table>')& c2 y; H5 {' d) S5 m! ]
}
' w4 N: L, q* Q7 y2 S}
! m! }* i# c- ^& x" a; J</script>

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