返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. k$ ~" t, \( jvar marqueewidth=300
. u3 c/ n. Q# V9 e# d//高度0 G: l: N. C% A2 s2 i8 P: S
var marqueeheight=25# \% [8 {/ @; D/ h9 h. q# d
//速度(1-10)
1 }1 C5 U9 f$ N1 y: Y: ^var marqueespeed=3
" x2 d: J% t6 H6 Q9 T# _- o7 Q& U//背景颜色
$ M  d2 _' a. J" cvar marqueebgcolor="#FFFFFF"* g8 G) i! F0 M6 E
//是否能暂停 (0=no. 1=yes)?5 A% c9 {7 {) ~2 f- @2 @3 }
var pauseit=1
9 B, z) J$ E# ^! c+ Z* i) s( x* d, t& d" b
//修改显示内容1 W7 H; {/ @5 j. n- O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' |3 O1 F5 `4 x' \3 b7 [" o& ~) y: B' W" E

7 F  u, X$ Q! [" `0 z////下面不需改变////////////
: N9 t7 f7 w' |( P. H7 q" N
+ b8 D, X3 k% a, X4 M$ Wvar copyspeed=marqueespeed
4 u; y( |4 v1 h! B0 d: l! N  _& ^% \! ]9 Ovar pausespeed=(pauseit==0)? copyspeed: 0/ ^( J. \4 o& A" j4 d: t
var iedom=document.all||document.getElementById5 a7 y! t$ W3 g" ~: v4 @' J, M
if (iedom)4 Z8 k4 n6 E1 a3 _7 a/ s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 r# Z) ?/ P7 y$ w/ ]var actualwidth=''
4 J5 I6 b1 D  U6 B+ jvar cross_marquee, ns_marquee
% n8 x5 |9 |, u& q: ^& R! @: ]7 ^& z4 L: ?7 u; `2 V* s( C
function populate(){
4 {9 r5 C0 t* g% |+ n8 c7 Rif (iedom){
: g3 S4 C# u( E, i: Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ u  v; p: M8 `2 Bcross_marquee.style.left=marqueewidth+8
1 B9 T: {7 Y6 z# d6 a% V7 Wcross_marquee.innerHTML=marqueecontent, Z7 i0 R) V+ s" V& h( V# w' z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( u+ \7 o) |' R  p+ c4 x0 Q+ F1 i
}3 A9 \2 z, M- ~1 q: G
else if (document.layers){
0 t2 G+ r1 b8 v) n/ rns_marquee=document.ns_marquee.document.ns_marquee2
2 L$ U5 t% N$ V6 l" z$ V  @+ a$ ?ns_marquee.left=marqueewidth+8
: K3 t/ A' ?- W% N5 D& uns_marquee.document.write(marqueecontent)3 E$ ?. Q$ f8 X' d* y% y  ]
ns_marquee.document.close()
4 W" @' y* |5 a& H# ]; Eactualwidth=ns_marquee.document.width- q0 _4 u8 s1 x* ^6 S
}
6 Y% I3 C4 [/ klefttime=setInterval("scrollmarquee()",20)* [! m! r+ ]: E5 w7 G
}
6 z2 e! l) ]/ g! dwindow.onload=populate
6 X% Y5 j. n- c
, W( m6 G9 w9 a# ]7 F; Lfunction scrollmarquee(){
  n9 `* V: C0 n. N5 `if (iedom){8 r+ @) v+ ~, A" F! E/ N- V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& q# S. z2 F. e+ w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 E2 k7 S/ v  J& A3 g6 o
else
  \4 b) K3 R7 ~' p. i- q' `cross_marquee.style.left=marqueewidth+8
: q3 X( S$ Y+ J/ y
( Q3 A- x$ ~5 t/ L7 n}
. C4 `; B; l: @" x0 s7 w+ }else if (document.layers){
# L# [( p' ]2 O3 k! o0 }. vif (ns_marquee.left>(actualwidth*(-1)+8))7 E( ^5 N; P2 p
ns_marquee.left-=copyspeed
# U! u" t# f; P# b4 q( ~# x. Helse
. A) E3 h4 K( I8 s4 R- x  N/ Mns_marquee.left=marqueewidth+8! _, j7 f& v) s
}9 X) K; `1 L# ?& m5 R, w
}
; a) o  u5 P! i) `0 x% P" a( \" H8 ~" D
if (iedom||document.layers){6 q4 q8 d# }( ^' N( o; g. P
with (document){
" T( h! i8 P  i5 c; U, Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 d/ d# E2 y' {' G* [if (iedom){
+ y7 m( ^3 ]' p; fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 S) M' s- L0 y4 D) H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 V  K2 {# T4 ]/ pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, o" _: o3 m6 G' Awrite('</div>')# F( x1 n( s9 S  ]. B2 N: n
}- D, Y! c+ W* }7 u' l8 C
else if (document.layers){
4 Y# N; Y" E$ z9 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: p& W3 C3 I. Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 O0 Z5 e: ?, w0 qwrite('</ilayer>')
( G* m, s. L/ J. O5 \$ j}
3 c) o2 m) i; v% `7 {5 j: Ddocument.write('</td></table>')6 z1 S# r8 @9 `, X) d2 i
}
9 {2 J& \$ H6 d- @}
$ K% o  m, H& U</script>

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