返回列表 发帖

网页之跑马灯文字特效

//修改宽度! F) {, e5 M$ n" q) H# M3 N
var marqueewidth=300* K9 H5 y. [% G
//高度
6 ~/ ]" B% O& V( X2 d; ovar marqueeheight=25
5 b7 e5 b$ y+ [1 G//速度(1-10)
# o7 @/ C: |" y/ ~. A6 Q- }var marqueespeed=3
, I! w2 l3 x* f7 {: s$ ?//背景颜色9 V9 l6 f1 [" b6 r% P
var marqueebgcolor="#FFFFFF"4 c  ?2 g- y7 {
//是否能暂停 (0=no. 1=yes)?
7 x" |4 J1 N$ Q/ [( X- |. [var pauseit=1
6 r! {5 z. l1 ?% c
* ]8 \3 a" n" T+ |) Q# j//修改显示内容
6 a) P5 G) A# p! K, K- Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 `4 P2 L9 V) I0 ?% f! ?) T
( j) q$ b+ x3 c# W, j
/ s( }* n9 L3 T& V& X" `////下面不需改变////////////
- R6 V+ N/ J6 `8 k) B3 ]8 J3 R1 }) g6 x! o
var copyspeed=marqueespeed
% |% t7 \" R: b- a  A2 d5 Ivar pausespeed=(pauseit==0)? copyspeed: 0
. O; ]' X- z2 }! }8 B5 p. Zvar iedom=document.all||document.getElementById
5 o8 ^. K6 A* g! Bif (iedom)( [3 j  D. B( c' N7 W, I, v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( e2 d0 [/ W" ^4 X
var actualwidth=''/ p, l. H* \" M7 g( H  H1 `0 L
var cross_marquee, ns_marquee6 p$ [. L4 Z: x1 ?: L

. l! I, @& V+ P% pfunction populate(){
7 E5 U- r8 T# ^# p  Gif (iedom){
( u+ d5 q6 j+ a& Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 @7 K0 B4 m2 K% U0 N
cross_marquee.style.left=marqueewidth+8
3 u9 N( x9 g# P# icross_marquee.innerHTML=marqueecontent. s1 j' ~7 D6 ^; k# Y; _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 q; Y4 t( I$ s4 c
}6 t. [2 O* s( Y
else if (document.layers){
  x/ y3 G& d; s' ]7 U8 Kns_marquee=document.ns_marquee.document.ns_marquee2" ?6 ]* i4 _4 I3 E: r- h6 C
ns_marquee.left=marqueewidth+88 g* b' P! X) z, |( y+ p: M# j6 K5 I
ns_marquee.document.write(marqueecontent)) o5 a  O, i! _5 O1 t3 N: r
ns_marquee.document.close()' O; p/ u- m0 M% p/ V
actualwidth=ns_marquee.document.width
& e+ @' H! T- s! M# @}
' u/ N2 u/ q* Vlefttime=setInterval("scrollmarquee()",20)2 `0 m! j+ t% B# {2 q! K
}
. h0 ~) M5 O! m0 O+ ]6 Z2 N  b  awindow.onload=populate
7 Q+ I& _0 o* i+ J' o$ w! Q% \) G
; k0 F: s8 d2 j7 w6 p) M% gfunction scrollmarquee(){. M+ h* r* V2 H* t; G8 y& _, x: t! |
if (iedom){1 x6 j, S9 n, T3 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- n7 \) ]  v, \/ Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 i. w5 x! e. x& [6 Z% Z
else7 e* |" Q$ X8 i' s* }+ k1 P5 c
cross_marquee.style.left=marqueewidth+8
, G& k; P- i$ E8 `; Y, J  T; M- g8 E% M5 u# A
}
; G1 Z( i& I, Y/ k) |# kelse if (document.layers){+ [9 \. r) n4 F4 s1 c
if (ns_marquee.left>(actualwidth*(-1)+8))- f$ M0 N- w1 @- v) |
ns_marquee.left-=copyspeed
" |4 i" A/ t% ?+ R! ielse
) }4 m; y/ ~) r! b9 x( Z# Lns_marquee.left=marqueewidth+8! r& O! T/ k: E% x+ R- [$ l7 A+ q7 F
}
0 Y! x5 a1 W& ]}, m/ q: X9 G9 K, A' {& A
( h2 Z( l. a+ {! j
if (iedom||document.layers){
' l1 d: E! S+ e& {3 I: e6 Ewith (document){1 c- ^! i" m% A1 n3 N7 o; k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 \) \* h' C5 Zif (iedom){
& _# X" N( u4 {6 {! D( Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! i! J. y4 C8 h) l5 O8 l7 n% s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 u* o; X' x+ ^* M* ?0 W8 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ u0 R0 w# j: N
write('</div>')
% `7 `' R# o- Z3 H' h}
" M5 Q9 p. w: xelse if (document.layers){4 E: [! V) p6 W- L+ J3 j- i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( `3 J, x7 }* r5 N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); |& {0 \( T/ Q# M6 B
write('</ilayer>')
) g# [. V4 i5 R* i# f& f+ r}
( m" i8 t& Y' g2 Idocument.write('</td></table>')$ u3 s) p' ~7 \- U5 k4 s% p* d
}
9 G( d1 X, L% A5 H! [}+ c2 h: {$ o& X1 W2 L5 N( f* q
</script>

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