返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 f5 c% E, I+ H8 `
var marqueewidth=300
- r" o& |( x% x1 l2 C8 |& t$ y//高度
5 K* h8 T1 F, Z% ^var marqueeheight=25% w. D0 o6 h* S! ^2 a; n" P+ w: \
//速度(1-10)7 }& r* X+ S- k! V, e4 u
var marqueespeed=3
% ~  F+ V' j! g% f8 u6 ?//背景颜色
8 y0 S( L9 F1 Q9 Y: Q* ]) bvar marqueebgcolor="#FFFFFF"3 w3 K& ~$ C6 u4 e
//是否能暂停 (0=no. 1=yes)?7 c) ~% o8 M+ C5 f1 h$ |
var pauseit=1. H: x$ R3 G8 |

3 ~/ J' j# K5 _/ H) |- Z//修改显示内容
2 l0 T" n- \. j& w7 J; ^5 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% L$ X: n  j! _
; O* e1 ^7 U9 _" K* _# Q' z# d$ E& M
////下面不需改变////////////
! \( w! L7 ~2 H/ a4 Y& E; w4 _; H7 C+ x" X- s# {- I6 L" S
var copyspeed=marqueespeed4 X8 p  H6 P8 ?) x8 d
var pausespeed=(pauseit==0)? copyspeed: 02 J# k5 C" ]) `0 [$ U
var iedom=document.all||document.getElementById$ B6 x) f7 p  f0 c' D1 z' M
if (iedom)
4 _+ h6 b" W% x+ V  F) i2 ?. q' @( Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 y  M6 e; H# l; I% a
var actualwidth=''6 F2 w$ p& _/ r2 Z, [; w
var cross_marquee, ns_marquee6 h, a- ^9 T* n7 `# w
2 e- {; n& b3 h5 `6 b% Z
function populate(){
5 O2 \$ J6 T/ ]4 eif (iedom){
( _  n/ p2 |, i: f& a2 z4 f+ Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ L3 K& X9 _. n/ C
cross_marquee.style.left=marqueewidth+8
  H; A+ a& P: B  p5 j" o4 f& l$ qcross_marquee.innerHTML=marqueecontent* r3 Q. O( S, u" g4 c' ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ q: b+ \1 ]- ?: E! l
}
/ H. |9 J. W: H" I! _; kelse if (document.layers){
; `: W- ~; V, k, p! pns_marquee=document.ns_marquee.document.ns_marquee2
) x9 b/ |; _: u0 n# dns_marquee.left=marqueewidth+83 Y6 c$ H# M( [( L5 Y: m0 x
ns_marquee.document.write(marqueecontent)# e! T5 o3 ~9 D/ f" Y/ M) _9 j' s
ns_marquee.document.close()
5 y- A% o) K6 d- `9 I: k0 ]. f( Jactualwidth=ns_marquee.document.width: L' X) v8 `" K- ?. q$ D
}! z# E% ~5 `+ Q! {1 v! k& A
lefttime=setInterval("scrollmarquee()",20)
- @5 F8 o3 J' b! r}
6 n: J$ U( [* q; f% n0 c) awindow.onload=populate
6 ^1 P  l1 y' O! i& }
( Q0 v, |1 S" d" zfunction scrollmarquee(){
' g6 o5 x2 ^1 k8 Y3 p3 Rif (iedom){! Y4 U- ~4 n! o. U: e& T: o& L: ?. V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 y6 d0 x* C$ v6 G: F( W' j: Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 U( }3 Z- t1 Oelse
8 `! s* U% R. C/ p8 h# q( G  ?' qcross_marquee.style.left=marqueewidth+83 ^- e# O. L. J8 A& ?
1 ^0 [8 r: M, J/ K
}+ O6 m2 L3 E; c' K. X7 k
else if (document.layers){
$ v- B9 h# G& Fif (ns_marquee.left>(actualwidth*(-1)+8))! z7 H- C: U9 J+ F) i/ b
ns_marquee.left-=copyspeed
5 o/ ?3 E3 C5 z( c5 @else) V- l* |( F0 v: K# _6 S) t9 `
ns_marquee.left=marqueewidth+8
! y3 N" i: \1 ~: y}
4 m$ _2 F7 O* X1 D4 Q}
4 @! h1 \7 V( M* d3 k, w8 D, X" o7 ]3 e7 R$ Y+ w. w/ U! J2 {9 ]' k
if (iedom||document.layers){
/ s8 y2 p2 ~9 @3 ~. L; f% Xwith (document){
0 D4 i5 B$ N& g! D& G6 U* W* |2 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; i0 @# v: u9 L* i/ i3 kif (iedom){
( Q$ k. z3 I$ \" ]* Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 S6 t7 K1 h4 r" Q  A% vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 `8 x( S; q& m4 q( w% A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( ~1 E$ r/ P! H( `4 w( t. ]3 bwrite('</div>')
8 t9 R0 F; [) A: m9 a" L}
$ d4 i% i5 Q/ w. h( o- C8 f+ t8 eelse if (document.layers){$ t0 i- r3 o2 g; ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" E0 S5 b7 c  }1 f. Y# h( xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# N& w0 a6 d. {# l/ q$ o, Dwrite('</ilayer>')8 ]1 P6 _- u7 M$ |9 S6 r
}
4 C; I' }9 P) t; ldocument.write('</td></table>')) j) u8 s. I3 G6 o# M. _
}+ M+ u; k" c& F5 j$ M! P
}" k0 t* b% _4 P
</script>

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