|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
* g5 O9 _& n! ^! r, N" }( P/ u; avar marqueewidth=3000 }* s5 G7 ^) _! m
//高度
' U6 y, ^1 V$ a' Bvar marqueeheight=25; q# R; U2 Z* p4 x9 o
//速度(1-10). j+ s$ P* @7 W4 x* N0 S* {
var marqueespeed=3
% b! r3 o) y% X* L5 x//背景颜色7 f: n0 `2 I2 ^1 ]& O
var marqueebgcolor="#FFFFFF"
2 |; i0 j6 u9 l0 C- N//是否能暂停 (0=no. 1=yes)?5 S1 Q; @- k$ |) o# }7 E
var pauseit=1
3 o" P4 r8 q% ?, _9 y! h2 x# c0 I& ?* o; P6 D! ^% T+ H
//修改显示内容8 S) c! Y$ X: _4 s* U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 [# a( T P1 A- R$ V1 e0 T0 [' E5 R* T9 f6 H7 N
& P$ ^" R+ D8 y5 @* q////下面不需改变////////////
& p- _$ g2 H2 e/ j8 \8 Z" q" [) q9 b$ e8 J* F
var copyspeed=marqueespeed8 G* P) y) T( P' V. e
var pausespeed=(pauseit==0)? copyspeed: 0
q4 h0 v% a+ ?- l, z5 S& ?var iedom=document.all||document.getElementById
& k. z9 C8 k: [6 zif (iedom)
8 Z+ e3 K3 l, ^: ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ p3 i" W" z; d m/ L5 F3 z- V6 r
var actualwidth=''! P) L5 Y6 v) |1 X8 [$ `# E
var cross_marquee, ns_marquee9 h6 I$ o; ?; `+ [( m
- ?* x/ \ w3 N yfunction populate(){8 \' d1 M. x+ T0 l
if (iedom){
3 y7 Z+ b3 v+ B3 S- h# fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 u2 O- [! v: b/ _' s# a T9 g9 @
cross_marquee.style.left=marqueewidth+8
& Z9 X4 R& d) Ucross_marquee.innerHTML=marqueecontent
( I- p7 Q2 j# O1 pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 k, K2 l8 y: e# g7 ?. S6 j}
/ l5 u0 A; p: Z9 ~- P# p, E5 Melse if (document.layers){) e: a" j$ u( P; H1 i$ c. V, k
ns_marquee=document.ns_marquee.document.ns_marquee2, H( d* q: d% h$ o. K/ R. o
ns_marquee.left=marqueewidth+8
5 u& Q' L9 \0 x7 uns_marquee.document.write(marqueecontent)* M: @. D# S- m1 L
ns_marquee.document.close(), Q; _0 Q; T8 A7 j6 w. K
actualwidth=ns_marquee.document.width# x9 s: r6 C. g" ?
}; e0 p# l- Q5 P! G
lefttime=setInterval("scrollmarquee()",20)/ Y! v i9 \: r: x8 f) _5 c( N
}
. ?/ r& }5 z- O3 `" X M jwindow.onload=populate
" C5 v: d& s ~+ m% n0 H" C( e
" E8 I, ~4 b( qfunction scrollmarquee(){6 s1 _. @4 d$ L; y2 v6 l
if (iedom){: P9 S. b2 }( w, k& f: [' v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- H* q4 [3 N9 j# \; }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ K/ G' O. k% r5 U, N' ~" nelse G8 j6 h+ x& K
cross_marquee.style.left=marqueewidth+88 z d' K* U& S: |
, i, v, S$ h8 Z; c; v
}
2 A9 L, g: G K# ~else if (document.layers){5 s4 V5 h5 j" C. t) s
if (ns_marquee.left>(actualwidth*(-1)+8))
7 U; u( |4 w" R8 l& ?" u6 Y* kns_marquee.left-=copyspeed
4 w$ P5 c/ Y! N- ^, ]2 S; Relse1 S- X7 y5 I! W) T
ns_marquee.left=marqueewidth+8
' |' r5 b0 \2 J+ G}2 n0 u$ C3 I# [1 O: ?4 S2 M/ n
}
' h" X" ?- O4 o% p* `- i$ b
( Z% F! w1 z I4 r1 k# e) }if (iedom||document.layers){5 s4 y1 @2 C1 S6 j* G+ w
with (document){. S. `: H- O4 X3 y: | o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" C, x( s2 A! a7 X: v' s
if (iedom){
4 E# w& j, N- D+ _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 p, |& r, b$ o4 j; Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ^7 Z' R u8 A/ t2 Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' ~1 U9 U# l! qwrite('</div>')
% S% M" ]8 \. `3 v3 K% F* t}& [; I2 M7 O/ @
else if (document.layers){# [6 y. X# ^; d. L1 V3 e- n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 E& T5 F7 d# }# P' v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( u, W) i8 T7 ]' Z2 uwrite('</ilayer>')" {$ B- H4 c: M" C* }( z6 X6 _* s
}
& |9 H; D5 q5 z( m0 g% Bdocument.write('</td></table>')
v9 ~- R9 t% |! N& D6 I}! K2 p2 G# B, d! Y/ O" L+ v
}
2 @7 d6 q ~" Y1 l</script> |
|