返回列表 发帖

网页之跑马灯文字特效

//修改宽度& M+ w, z7 `! N. B
var marqueewidth=300. G- D( q& @  N2 H
//高度
# r% F6 b+ Q% n+ Jvar marqueeheight=25
1 E( J3 ^, F, i' @( N//速度(1-10)7 u# @% z6 C" V2 q
var marqueespeed=34 S2 n1 l+ F$ D
//背景颜色
" S0 d: g. C" wvar marqueebgcolor="#FFFFFF"
: G+ A! j" _- |! B( ~8 u6 s. |//是否能暂停 (0=no. 1=yes)?0 ~8 C6 |. c# k1 Y
var pauseit=1. _9 U. r2 k# B. ?6 j+ W' j
. {/ ~! z; J! i  B6 r5 t
//修改显示内容
% S7 G. Q6 m  [7 c- R1 ~; \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& D  a+ S. _' s/ i2 Z" y1 @7 i% Q5 y4 q

) X7 o4 F$ @" l+ o+ {////下面不需改变////////////
9 N6 g. W$ V' w- B+ @
6 R: b/ _- ?  d! Qvar copyspeed=marqueespeed) {% ^5 c; z" n" F9 M: ^* c
var pausespeed=(pauseit==0)? copyspeed: 0- g: q/ V( w. w$ }
var iedom=document.all||document.getElementById
+ f' A% ?2 I$ Q( \) Hif (iedom)
5 \- k- _! v1 |) v" M  N* tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 Z9 m( S& ]5 M0 Y4 g
var actualwidth=''& T2 |5 j$ R( g  K. c7 v  o8 Y, p
var cross_marquee, ns_marquee
+ f3 h/ a8 [) L) Z  ^, l  q9 U
function populate(){
& a1 b( p: r, M" Y/ f$ aif (iedom){
7 W" g$ `' {- N6 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 h& k2 X, p5 |/ v
cross_marquee.style.left=marqueewidth+8
; }. D  X& K" u4 _( r( I; Lcross_marquee.innerHTML=marqueecontent
' k% N* J/ b( W, ^/ ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" F! ~. v! w4 k3 M5 W( g+ w3 R
}6 p( r& `* \7 k% ~9 Q  \( K) c' c, N6 [
else if (document.layers){
5 l8 V! A6 S$ k* G! Yns_marquee=document.ns_marquee.document.ns_marquee22 c; l$ p8 w- J# t/ h
ns_marquee.left=marqueewidth+8
* I# L3 x, s9 Q/ [ns_marquee.document.write(marqueecontent)
( y, u9 Y- u0 ins_marquee.document.close()3 s/ K' T* I! G& p" D
actualwidth=ns_marquee.document.width
" ?! p6 N& h  P}- R# l! C3 A& |, ^3 ?3 `+ S
lefttime=setInterval("scrollmarquee()",20)
- F( ^2 }# S/ \3 K& L% Y) l}
: K; b7 W7 r0 [3 ?  }8 b( lwindow.onload=populate
. h/ {  M" c6 h9 [+ L# O! |; g" G! F4 F/ o: Y
function scrollmarquee(){
* u7 L& `' m% V/ ?# vif (iedom){
  z% n1 t  U8 x5 y- i4 v( u1 Y" a, Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 }& M( r& O0 ~/ mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% X! a+ H6 {- D# n( X0 h4 f8 r
else
. |& p) Y. f6 Xcross_marquee.style.left=marqueewidth+8) |$ g! }& F4 y1 F6 M% n; Y' B  S7 k

+ r. B- o/ j6 V) z2 L% o}
% d! T; }# E8 @9 q8 Pelse if (document.layers){" @: g& _8 i; [# R) S6 F# X
if (ns_marquee.left>(actualwidth*(-1)+8))
5 M! l  [+ \+ x- H5 Ens_marquee.left-=copyspeed6 X& ?$ ^& n- R$ K, x
else
- i) _% d6 F' f) G4 ?ns_marquee.left=marqueewidth+8
3 G; |: ~/ W4 ]/ F) Q( t}
9 I9 w7 N- l& x7 n. c3 F}4 \" B+ M7 ~  c1 c/ e; j' q3 t

" M5 N2 X1 F0 U$ M7 bif (iedom||document.layers){9 P2 P( _# H% r1 ~) l2 r# n
with (document){/ T, ?% j% j( y+ v. n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ c) U; W& {! r- \" `5 }: D1 {if (iedom){8 `% D$ ~  i  b$ {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 v$ ]" y$ s3 \- i* s( d7 `; @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. a. B9 h  h; Y( I; U7 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% i% s9 ]. Q  R& f* lwrite('</div>')2 M! l: a/ }5 n! t1 {: r
}; [" W* A3 V3 ~# o
else if (document.layers){( w# L" R: [' w1 l: ?% d& i3 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) s' p9 }8 G5 U# W" S  ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& ^& H7 W1 t/ _0 q, jwrite('</ilayer>')3 z/ d+ W( Q; Q
}
, @# g2 q( }% l6 Ddocument.write('</td></table>')8 H" f% }. s  T8 }, Z, o' W
}
* S4 g. C! h4 T; L$ E1 J. f}& g. ^0 Q) X1 f) \) K( g
</script>

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