返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 W4 c3 B8 n* L. \
var marqueewidth=300
: V- v# e& x- l& y% p: t, k  l//高度; N- t! t$ @7 t; @
var marqueeheight=25. j1 w% _8 Q2 B, {7 e+ G& R! R
//速度(1-10)
9 @0 e1 n% x7 ^% Ivar marqueespeed=3
3 d: |! [* G. ~5 E) c//背景颜色
0 U3 v/ a9 Q6 S% U- [! Pvar marqueebgcolor="#FFFFFF"
9 [" \) N; D5 z' E//是否能暂停 (0=no. 1=yes)?
  m; T- a- O0 y, u- C; }* d( _- dvar pauseit=1, }0 |4 G) `' z6 t) B- l; L
( y& q; v) Z- \' G. A0 l3 `+ N
//修改显示内容1 o+ b: N1 }* k4 M. Y# x( G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& A" `% P. o4 y

( ?( L) m9 h! f, N) z! S3 E6 M' N* O4 `
////下面不需改变////////////1 i2 z7 w! c5 n3 Z) l: H& W
+ p7 ^; H6 A5 I5 j1 a) u
var copyspeed=marqueespeed6 }4 \8 y* k; C" r' `+ o
var pausespeed=(pauseit==0)? copyspeed: 0
1 B+ f4 E0 f+ c6 ^3 N9 Jvar iedom=document.all||document.getElementById
9 s% ~% \% ^* Fif (iedom), F7 d* o6 O3 |) D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  F3 r) d( w% D( W( mvar actualwidth=''
  C3 ^) s& Q$ Q3 B  J5 Qvar cross_marquee, ns_marquee
4 d: Y( Z* q4 b/ R8 h
4 N$ T$ i0 B+ [8 _1 d: afunction populate(){
1 w  x7 z/ D, n! i" Wif (iedom){& O0 Q, G% B5 q$ X, b1 q" G- C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 O7 d; |9 G& c2 @/ q# D' a/ Lcross_marquee.style.left=marqueewidth+86 \2 }/ n0 y4 i: Q% }
cross_marquee.innerHTML=marqueecontent9 x2 P3 M/ i5 @$ F# b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" v, O3 }; j: |) }
}
  R' k9 @2 ]6 Eelse if (document.layers){
& T. {' D( ]9 q2 l$ U% hns_marquee=document.ns_marquee.document.ns_marquee2
/ J5 j9 h8 s4 c' O$ Nns_marquee.left=marqueewidth+8: ]* F5 U! a! A5 g/ i* L0 r
ns_marquee.document.write(marqueecontent)
, e/ R0 ?1 b& u+ D% hns_marquee.document.close()$ U" J' T) _- ^( c- q5 C; n% R
actualwidth=ns_marquee.document.width5 |6 x: u/ y, W
}
+ ]# D1 w6 v  r* ^* Dlefttime=setInterval("scrollmarquee()",20)
1 }3 Q' D/ m8 p: a. N}" U( b# t7 u, Z0 n2 r. |$ S
window.onload=populate- P" Z3 x3 u. l9 t. G$ ^1 h

# y' t! L1 h1 J# v* H8 S8 nfunction scrollmarquee(){
4 `8 `) @* a% J  l0 H3 k: @if (iedom){7 t- z0 z' ?+ N8 |0 M0 X0 B; F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) N! N. G: e2 k- ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ p, \3 B* |1 w; h# D" ^
else
/ ~: `/ W& S: z5 ~: [cross_marquee.style.left=marqueewidth+8
  O6 V* b8 N$ k1 X, z& ^
: S) T2 ~, W* ?1 g- ^/ a}
7 s/ M6 n& [0 q$ x" E) Qelse if (document.layers){3 J: {% p% r# }- n3 J( N+ i6 o
if (ns_marquee.left>(actualwidth*(-1)+8))* b6 c" z% Y) s
ns_marquee.left-=copyspeed
2 G& N. z  p4 e  ielse
! p- W5 o+ p: {9 N0 C9 ^) s5 Uns_marquee.left=marqueewidth+8. D; Q3 V* q& q& ]4 M" O
}$ h6 c  d, `- v0 _5 V8 ?: d
}
7 D9 q5 |1 D. r+ B) Y
" t" d2 k& R3 y, cif (iedom||document.layers){0 Z& `3 x% |7 Z! |: v  |
with (document){3 n3 D- T% X  |5 _9 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 |- m9 M( |& hif (iedom){
) z  Y* g# d% ~! c- }9 {% p/ e3 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 l  ~2 O! R( J' j: G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% |& B; z. J8 X1 ~, Q; b: Y: S; ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* V: Z* D2 k; y1 [* pwrite('</div>')% b: E! D& g( m
}! A% y5 v, l: z3 y  H0 |7 g; }
else if (document.layers){
9 F1 x1 ?/ @) R, ^& ^" b2 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ B/ g5 c6 R- s! b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  s! i3 T* i- P$ r/ m/ v$ ywrite('</ilayer>')
8 I; j- U  j- L; l}# {0 s9 T' {3 W& W( {
document.write('</td></table>')# c& d) t- U2 P. P6 }
}
9 a4 {7 s/ R6 ~. R: P}
- m1 P; _' R6 ]1 W& G2 l</script>

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