返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 \0 W$ v4 ?, M
var marqueewidth=300
7 N, D; c/ N! u8 y. @//高度
4 k! x4 a! y  u* _var marqueeheight=259 z5 `- c7 d( L
//速度(1-10)8 S* y# m2 i# R- @6 R
var marqueespeed=3
- }& b9 ?. ?: Z; p//背景颜色+ G4 k$ M/ Q! ~% n4 K/ t4 w" H
var marqueebgcolor="#FFFFFF"
3 n' ^8 u  {: |3 {" U1 {8 h; g//是否能暂停 (0=no. 1=yes)?+ _. `: r& c" _- P, z- L# P/ `0 i
var pauseit=1
" }' C4 E3 W: Q% ]2 t) T' E9 u' g. i6 H
//修改显示内容
3 ~3 ~' x3 v& I8 q- bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ {( b1 q, v  o- ~2 @
) o. K$ b6 ^+ P9 O$ v  g
% m; h3 G  B- G# Y$ {8 J
////下面不需改变////////////  a5 ]+ Y, ^4 s7 A- p$ b" u

7 Z( [" a- }- m+ J, T6 ~1 lvar copyspeed=marqueespeed
4 {, D$ f+ J) \; D5 V$ ~- ?var pausespeed=(pauseit==0)? copyspeed: 0
9 g9 H+ |4 z; Avar iedom=document.all||document.getElementById
9 [; q9 T) q. b1 F" R5 j4 I$ tif (iedom)
7 i5 d( v, o6 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; m% |1 w# Q3 i% ?" `- Wvar actualwidth=''! l: c0 S# q$ p' ~: ^; ]
var cross_marquee, ns_marquee' F8 N* n- m' V& ]% a0 O- b

8 l( _3 [8 k2 U; }! |function populate(){6 ?" i3 z' I' m+ F: [5 t
if (iedom){
$ \# P* s2 S2 I" L# W4 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 o- d7 a( M: T# E- i" ~) Vcross_marquee.style.left=marqueewidth+8. {% b5 Q7 _# R2 `
cross_marquee.innerHTML=marqueecontent
( P9 L( m2 W! oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. N# G5 W" m" r4 {% C* r}& d1 `$ i9 T8 ~
else if (document.layers){
7 ^3 K" c. W8 }1 Ins_marquee=document.ns_marquee.document.ns_marquee2
; C) x# O8 j4 s, r( `ns_marquee.left=marqueewidth+84 A8 t( b7 W* O. J9 h4 {
ns_marquee.document.write(marqueecontent)
+ a  \: I0 `3 }6 ?6 _ns_marquee.document.close()
9 K. ], P; v3 n1 ^* A6 iactualwidth=ns_marquee.document.width- G+ U- y9 D+ y2 H- z) B2 r; j
}$ F# F4 [; Y+ u. b# ?2 q( l: [
lefttime=setInterval("scrollmarquee()",20)# l) j7 B1 h5 w9 L: b7 S2 g
}8 E# @( c9 l2 B; [
window.onload=populate- l1 ?. ^) l8 {4 n9 R) W9 Q

! {7 k& M: |: `7 Y1 x' o# xfunction scrollmarquee(){& `! U3 V/ K- R: l' D6 D' W/ a6 o5 ]
if (iedom){# e6 b$ n7 e* `) g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& h! e, o* g( r3 |$ R- |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 g. m( A, [) C5 T8 G) g( J
else  R0 s+ k$ N* @* ^# i, v1 }/ Z& V
cross_marquee.style.left=marqueewidth+8
- V3 p' N4 Y7 V0 R
% D# ?8 d/ ]9 ]  s. V+ }}
8 n0 @! p& k5 }5 helse if (document.layers){
: {2 }$ ]. `" ?if (ns_marquee.left>(actualwidth*(-1)+8))
( Z" h& K7 ~$ @/ o# qns_marquee.left-=copyspeed
6 H- r0 L" Z6 p$ d5 f& P) Qelse
7 q6 r" m% Z% ]" I( H  Bns_marquee.left=marqueewidth+8, ?' K" Z/ u1 P
}& F' J7 V- T0 L0 _. [
}
/ k/ A" J/ E" i3 j7 {3 n3 o" ]+ m
$ T4 A0 o: t5 Z2 [if (iedom||document.layers){
  S' o- }% E+ Mwith (document){* K5 K& k8 a; L# c$ G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 v" g' D7 d: |+ s" n0 N
if (iedom){; p' E7 d' H2 ~) @5 u* t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. B# [* m; W4 N  M2 L: q2 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- B4 U: y/ {. y3 I; v. ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 s8 w; \& T0 ?, @write('</div>')& ?- F. I9 Z7 u& d
}
+ \5 r, P; c$ t+ x2 z; [- D9 Qelse if (document.layers){0 t- A" Y8 K- \/ @5 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ ^# r  I) G; L- M( A, F( i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' D2 L4 D7 e! E. ]8 x: ^
write('</ilayer>')( L3 Q5 y9 }* N& F
}5 S, P9 |1 Z8 r- t
document.write('</td></table>')
: O+ f% d4 \: `( Y: B4 }( ~}
. ~* j/ ]- f4 s2 Z}0 r  d$ e% X* d/ T) e, x! {2 ~$ \
</script>

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