返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 n- R! [8 d! g. i! H) xvar marqueewidth=300
% r& @% Y" Y% I//高度. d9 Q$ p3 P/ V
var marqueeheight=25
3 L0 z! F: @! \  [( F  P8 \6 S1 J% a//速度(1-10)( }1 X2 k1 [2 g. U
var marqueespeed=30 K$ ^  h8 h  b& u' t2 z9 @- B% d
//背景颜色6 b* U+ t$ Q& {& f/ |8 a
var marqueebgcolor="#FFFFFF"
; V' m: B) L" _5 w  X( i//是否能暂停 (0=no. 1=yes)?
: f: |4 ]) v: K0 W& u1 {var pauseit=1
1 ?6 y0 M  S7 Z: _9 W
7 e5 I6 [3 H4 J//修改显示内容: w/ w$ w1 A3 D/ ]3 d5 D: z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': H( n; |0 L& a+ U& i0 u" {

, g8 S! X# B; W* N4 }( O; O3 ^
////下面不需改变////////////
+ q; n8 v6 Q; n* w! e/ K  |- f1 }
var copyspeed=marqueespeed: d- {( D; _$ v$ L8 `$ a8 k& H
var pausespeed=(pauseit==0)? copyspeed: 00 ~7 U6 [% @+ q! B
var iedom=document.all||document.getElementById
8 n! k* j/ C  z0 q. gif (iedom)
6 m3 h5 R6 C& u. H$ Q, b" X. U, Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" v8 j$ L1 e, z, `( Y  gvar actualwidth=''
& p' I: K' d' o+ n7 S: lvar cross_marquee, ns_marquee7 |$ }3 V0 J8 I" U$ h; U

! t# T8 J, G8 B3 M; S5 H8 I. e' @function populate(){
7 A1 l, z0 X) D) t5 \& q* v* k+ Z5 S  Hif (iedom){/ ^- l) C& S3 {4 [$ ]. {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 Q1 Q: F: A' v5 M4 gcross_marquee.style.left=marqueewidth+8
* S9 C0 k$ X$ G: j, Xcross_marquee.innerHTML=marqueecontent3 A" [& h. A8 W7 ~# Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ a& O0 Q  T. |
}
2 f! X! B) a+ Pelse if (document.layers){$ i! D8 Z% L: s* s7 `
ns_marquee=document.ns_marquee.document.ns_marquee2
+ x( e" u& h. Lns_marquee.left=marqueewidth+8: L2 a- z+ P! c, H  v  g4 E! a
ns_marquee.document.write(marqueecontent)) u. c2 ]% w1 ]5 `4 U
ns_marquee.document.close()2 A0 e/ E  |% C. p, @( J
actualwidth=ns_marquee.document.width3 r/ H/ d. E( L' t# L) \
}4 F: U" x% S* z) Q# E
lefttime=setInterval("scrollmarquee()",20)
3 r* X! s5 B5 J' Q}
  O' G% d; j" Nwindow.onload=populate  y' Y& w/ \! N: y3 w; ~

) }- }( P9 Y9 T9 e6 f4 Dfunction scrollmarquee(){
: ?+ y( i7 s) D5 `( k2 E. tif (iedom){  r; [5 q3 H0 w4 M! H1 e' L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). U% l+ {7 I/ y" X' D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) J! c# i5 g- e" D2 lelse
* }1 Q: e0 z2 J+ Q. [: Ccross_marquee.style.left=marqueewidth+8
2 `" {# W$ J+ R4 a
) \7 G1 ]" e6 E( r3 ?}3 v+ o& s( l+ M5 _. w% [
else if (document.layers){
( f. a: }0 c  q* o) Mif (ns_marquee.left>(actualwidth*(-1)+8))
# t9 V& P/ Z5 v2 g. \4 X3 Bns_marquee.left-=copyspeed
' }& Y) R5 c" Y# E) g4 d+ ?. jelse
$ B% ^( P. F& H1 a  Y( e0 |+ d1 jns_marquee.left=marqueewidth+8
1 I7 c- L/ `+ x# P7 ]}" }, k. T0 u! l* I, R) }
}) I# t9 Z) J7 s0 A& r
# `' z! y- w) T/ E- w7 d" p  I
if (iedom||document.layers){9 `+ C# B- R( l* I
with (document){
3 L* h' V" W! `) A" Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 c- b8 q9 w  w9 i6 gif (iedom){6 g( m9 c  s5 e! j# |& X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 E; |9 s# v2 Q7 z( g( G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), I6 P! s3 ]1 ^" L: ?  C6 @. ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 G# q. Y9 a( C- ~. `
write('</div>')# p7 j9 _$ ?! Z; R& @5 B! P  f
}8 j% H! S0 D- e+ e" O6 \
else if (document.layers){7 v  J; U9 g! U6 \" h+ `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" D1 a5 W5 H! }& \, q6 C0 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 f. t& \4 s- T* {! ?
write('</ilayer>')
; h2 w+ H2 [; f0 {3 B8 c" L}+ M5 Y  Y$ Q4 f$ a6 W- e
document.write('</td></table>')
/ ]2 q) Z6 p4 Y! L; o6 [) ~}6 B4 }' q1 ?/ p) F  D0 u3 C2 o8 w6 `
}: c2 S7 w( T9 x
</script>

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