返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 h* p9 M( x& hvar marqueewidth=3002 m! }* o9 E% D& S- |! \5 {. H
//高度
+ Q% ?  J- e* w' N7 d- `6 Avar marqueeheight=258 t8 d8 F7 j( q3 B5 i  R
//速度(1-10)% s; y2 ?/ k. D4 Y9 r/ Z( Y6 s! Z
var marqueespeed=30 I# S5 X/ m! d
//背景颜色
# e% n" o. @* ^6 D2 M& i& p3 I- wvar marqueebgcolor="#FFFFFF"
" T5 I5 ~* m6 i& u& ]& C( b: N//是否能暂停 (0=no. 1=yes)?! `  c2 o1 h* ]
var pauseit=12 y/ g7 r+ t$ h* p% B
. G7 c0 v4 E, P# V9 I% K) j# ?
//修改显示内容# o) B6 X. @6 E* c$ B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') b) U8 t2 t0 b, x9 Z! q4 _$ b

' H4 r) }/ R  n4 ]. Q! p' o; H9 H& d) c. x6 T
////下面不需改变////////////; w) u  z& ]+ c, X% ?% [

( I% d* Y9 o, U; ~" ~/ }" x! evar copyspeed=marqueespeed9 w) [/ {6 k1 v: L! A0 \
var pausespeed=(pauseit==0)? copyspeed: 0+ |0 g# e3 A3 Y1 _
var iedom=document.all||document.getElementById) v& Q0 V5 B. r+ B8 E/ d
if (iedom)
$ ]+ z2 o0 i# V1 V7 R) rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 M5 E7 a; _# z3 g2 V8 u8 u
var actualwidth=''8 _; U3 y, s5 F4 X, ^
var cross_marquee, ns_marquee
9 b1 Q6 {$ v, S, M9 t; x: x# G. c# x0 [. S; B0 g
function populate(){
: x( V* R& ~/ I8 yif (iedom){. j" x) H5 `! p: m9 O/ x' ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! b+ F' {% c$ }' N3 G  J4 y
cross_marquee.style.left=marqueewidth+8- C* s1 a7 b2 v
cross_marquee.innerHTML=marqueecontent
/ a( W, q0 d. X3 j, f7 W" O( r) Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 d' _& O: }9 T! C6 h4 a}
- ]0 Z5 c% s7 @else if (document.layers){
, D8 {8 W. U* D# E2 b3 x% nns_marquee=document.ns_marquee.document.ns_marquee20 G5 w7 {, O; g$ W7 X& v
ns_marquee.left=marqueewidth+8: T- g2 t4 z: J1 h$ ^) ?; }
ns_marquee.document.write(marqueecontent)6 w6 {, u; p3 j% |- w- }
ns_marquee.document.close()! g# j" P5 a; m# h) Q6 G4 u6 [" ^3 ]
actualwidth=ns_marquee.document.width
8 a5 T4 I3 C9 P9 a* P% J5 K$ L! e  C}
- Q% i# Q1 Y! F7 m. q% R- slefttime=setInterval("scrollmarquee()",20)
, {& a8 ?  Y7 ]1 w0 l* N}8 ~8 ?2 O' z6 {4 t5 h4 z
window.onload=populate$ ^+ Y# v8 h( @, C; |; P+ h1 l
  c' l2 d; L% _. I8 J- e
function scrollmarquee(){4 L. N  Z8 D1 l: m: I
if (iedom){
7 a4 u7 g& t/ Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 B7 }' }. @: ~: X9 Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 U! S) i5 ]' x$ R7 l0 w4 Z+ Eelse. t- O4 F0 c; l' L6 Y0 g. w0 M6 }/ D6 \: B
cross_marquee.style.left=marqueewidth+8
0 a7 I4 v2 l6 ]" A8 ?- O- ]2 |( b( J
6 [) U4 T- V% G% r& m3 ]8 p}
4 J$ _+ B- f2 r. L) `  i" Uelse if (document.layers){. `7 l; [, r6 j" x* E2 `
if (ns_marquee.left>(actualwidth*(-1)+8))* Z9 L/ L8 \6 r& B( F$ E
ns_marquee.left-=copyspeed: }# F7 \3 M7 Z0 q$ o
else+ _8 O$ c1 V( Y  @  X' s4 Q
ns_marquee.left=marqueewidth+8+ c1 A: z* U2 a: c$ {# n( r+ J
}/ W: s: w2 a- x
}
5 J" V' R1 l. I% N! @4 Z! \) }- C# L) q* x8 s$ E0 u
if (iedom||document.layers){
1 ^8 H) [) O1 _( i8 X/ Lwith (document){' y& _: e. r: I) d- c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), O8 M7 ?3 }( l% s; f0 @% G. \
if (iedom){4 ]# e. X* r$ J6 ]/ J3 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 E0 x% C& ]  d' Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# H9 C' |7 s7 v$ Z. x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 }$ g' ~+ c# N/ Z) N" O+ Uwrite('</div>')) t% C6 [( c9 q5 d7 n* q1 G  ~
}
# a0 l4 Y; r' Y& I, |4 d& qelse if (document.layers){  t% N1 U( \* P, K$ ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. G* K+ E0 _. m( Z4 A. Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% j3 O+ ]1 n  c1 \6 {+ Wwrite('</ilayer>')3 _* ^3 a; U. m
}
7 Z& {& r' I( M8 b2 [document.write('</td></table>')9 Q/ z8 h, a1 V$ g5 Z% L4 M; L, G
}
0 j" @2 t8 n# I1 k# r, ?* m}
/ C9 f- W, ~- a3 I& t; _) g0 |  _7 |</script>

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