返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 P" f, v1 F, D' \; Y4 S
var marqueewidth=300
8 A3 |+ g2 o8 {* g2 u1 Y//高度# \. _3 k2 q% y5 @2 H1 z( f
var marqueeheight=25
0 n- J! w$ F7 z//速度(1-10)
8 F) n1 o5 |( ^* r) A6 ]2 f7 Y/ rvar marqueespeed=3
& X& y, K$ k8 J( J1 Q/ ?//背景颜色) Q: a% Y6 ?' {$ t8 o+ |, d
var marqueebgcolor="#FFFFFF"1 a, u6 v2 K5 b, w* O/ |  C
//是否能暂停 (0=no. 1=yes)?* V. p1 L* S6 T7 l/ j% u0 C7 r
var pauseit=11 x5 q& O$ z. R, _- r$ G; W  z

. m# O3 l7 W+ [1 s" r0 J5 r//修改显示内容' w6 q0 C" Y2 z; ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' D& ^; {7 l) J) F( l
5 @( v- f, i3 w" }1 ~2 j
7 B% Y* W# B8 H; ?) G
////下面不需改变////////////. ]5 U" q. k' L4 A

3 \- n+ P4 f/ U0 j* M' z3 x" t& [var copyspeed=marqueespeed. T% ]6 _+ o$ L2 n3 Z
var pausespeed=(pauseit==0)? copyspeed: 0
. ^/ g/ v5 Y6 T% |3 N$ e9 [# xvar iedom=document.all||document.getElementById
( I6 Z9 G1 z% \if (iedom)
" D9 X3 i# X" C+ V! x) c+ xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 `$ G- s) u1 b0 Hvar actualwidth=''3 [' c1 k# P1 s$ ~
var cross_marquee, ns_marquee+ f9 a9 F2 |0 f) l8 j1 g/ K/ \8 c
. U& w+ m, F9 D
function populate(){: _8 o6 o8 D2 C# ?2 b
if (iedom){0 T4 v4 \7 J7 r$ N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* f+ i  L. X. ]7 N' _( \- {- bcross_marquee.style.left=marqueewidth+8, F0 x0 D: C: t4 P) ]' p
cross_marquee.innerHTML=marqueecontent( p  k; P1 N, s$ P+ c- K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 R+ G: s% a+ D1 w/ N}) q& ^9 U" m9 h& b% x
else if (document.layers){6 j9 H& B& j3 }) z- F1 J
ns_marquee=document.ns_marquee.document.ns_marquee2
5 a' @! S# q9 g4 Y6 Bns_marquee.left=marqueewidth+8
- W; {" J# f8 R" i3 Qns_marquee.document.write(marqueecontent)6 \1 \" S* `5 ^2 {6 w
ns_marquee.document.close()6 T2 B/ u3 c" P! b
actualwidth=ns_marquee.document.width
9 m* f, V8 E' T. T& O9 d3 b9 _; Q}' c% z& x: Q0 E' G+ X/ F
lefttime=setInterval("scrollmarquee()",20)
5 w0 g! w2 q  u) Y}
9 x1 K, x9 X" D  o4 Q! c7 `- z0 wwindow.onload=populate# H* I. N" p9 n- w! q3 j1 I8 B

; ?2 P- z- k4 I5 pfunction scrollmarquee(){
* S1 a7 A  \' jif (iedom){
, }9 `' T) k$ O/ g% U2 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ U% h- ^  {4 V) d# z# n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 a% b1 u/ R- }) xelse
! j: ^: c2 P" t- S: a& C2 d% }- vcross_marquee.style.left=marqueewidth+81 w8 U5 W! W+ {

, \8 v( o& f; F; \" v' Y2 t}
. h% j; L: a. M6 D7 T# @* ielse if (document.layers){
3 {, }. U% k' O: B( oif (ns_marquee.left>(actualwidth*(-1)+8))2 s4 s- v9 b8 [$ G; p8 c
ns_marquee.left-=copyspeed
( u+ X& @3 h  m3 x! b! Welse
2 U; ]2 _8 J' b3 b2 zns_marquee.left=marqueewidth+8# l4 d/ ~# c+ n  q& ]
}' Y7 ~  Y' O' u* t
}5 F. Z/ \0 f! \  f; A$ B, v
* l2 ~* i2 m6 s
if (iedom||document.layers){
/ g- t  L1 y* C0 Jwith (document){+ S$ h" U  W  q% L; L6 F8 q; C6 s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# e. @2 S& Y7 l0 I/ L
if (iedom){* [* R* E( P+ X+ a8 M# ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 T- P0 f# W, W0 ?- j1 x5 }9 \/ S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) h1 a6 V' i0 `5 M6 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 ]' i! {6 `+ l" f+ h8 ~) ]write('</div>')7 b# t6 Q+ _9 B8 \
}& M2 {0 L5 J+ g8 h9 v
else if (document.layers){
2 ^: q, n' H* L; D8 Q+ x/ e0 I  Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 N- }5 Y9 O: Y7 e/ r1 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* N  v  S5 j/ K' I; `$ ]write('</ilayer>')
! V# X$ t( l( i" D}
  b. h3 l' K" z! J3 H4 o5 y& K- Jdocument.write('</td></table>')
+ }# U% x+ N4 r6 I) o2 W}
1 d! l  i- |+ _% M: I9 R}
: D0 o% q$ i, L; ?; m# D$ `7 L</script>

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