返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 g  H, D* V* R5 O8 e
var marqueewidth=300! D4 q9 s3 k# Z
//高度* D( q0 @8 Z! c6 ^) I/ j
var marqueeheight=25$ L2 Q( d2 x& B  L4 S+ D5 C
//速度(1-10)1 H9 Q+ e( s- R2 F( R1 o
var marqueespeed=3$ R" C& |( U& M% B1 o5 t1 x$ o
//背景颜色4 k7 a4 O. _* V/ q2 u
var marqueebgcolor="#FFFFFF", V7 X1 G+ a4 Z3 I3 C
//是否能暂停 (0=no. 1=yes)?6 `, g) z& Q1 S" A2 F- F4 ^
var pauseit=1
2 D; [0 n, A( Q- u# e
9 h! g4 \# }/ X; ~8 d1 ~//修改显示内容
. F: y0 |* e3 J& v4 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 H7 g4 A7 g; s9 c3 t7 P
6 s# u6 Q& v% h4 ^  [# u4 Q
* y5 E* Q1 F; c, }2 X/ {9 u
////下面不需改变////////////
3 y- g/ P& _, A( z( t1 L
9 T- [; D! S- v+ Q) x6 B" Avar copyspeed=marqueespeed
; q: J$ E' E/ z& \var pausespeed=(pauseit==0)? copyspeed: 0
  x+ S' H& t( O$ s- \: B3 Xvar iedom=document.all||document.getElementById2 F1 n- X: b' [/ ^" `; a# g. \
if (iedom)
3 e% ]; g: ^1 m$ H( F% o. G5 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* x# ^$ U2 a# f0 P. D9 \var actualwidth=''
, Z5 c$ q& ?0 Z' v9 svar cross_marquee, ns_marquee) f9 ?9 [9 ^" p  E3 b

" H- l% Y1 j; p: y$ K( tfunction populate(){
; T& G6 W, E2 n" `3 Q6 J/ }if (iedom){
3 M9 M7 b+ x* v0 k+ r$ P# J3 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  P1 ^& U* P% @6 @- J9 w; ^# v0 icross_marquee.style.left=marqueewidth+8) n9 R/ g! r. R* Y
cross_marquee.innerHTML=marqueecontent. p5 l1 h) d- b8 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 X# D9 p0 S! |. @}/ l5 B& O* V! P7 l' f' \- P
else if (document.layers){
* ?! @; P; }6 lns_marquee=document.ns_marquee.document.ns_marquee20 G. K  `4 z1 f8 [2 o0 ^( W
ns_marquee.left=marqueewidth+8
: C7 {4 }& F2 p2 jns_marquee.document.write(marqueecontent)
- h, X+ }' G) X! }  w, Cns_marquee.document.close()
5 l% D: x+ W5 O9 M3 hactualwidth=ns_marquee.document.width6 K- ^3 b! c4 f5 i
}
1 `* j. V6 c, Y+ F, s2 ~) Tlefttime=setInterval("scrollmarquee()",20)
5 D* F% ]' L0 `8 Q7 i7 L}1 p& f! N3 l: u2 [% N( h" ^
window.onload=populate
1 t  x$ ?" U& H" f4 d. O3 m- G1 k2 q9 M/ n; O8 D
function scrollmarquee(){. |  `# `( @% Q0 T3 X) }5 Z
if (iedom){
. E# b4 r9 y( e# z. E5 g) a4 }+ Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( U( V" `; I% W7 W5 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) ]0 D! j+ E/ x& [/ x* {
else# x; U0 J" }) u5 |0 W! T
cross_marquee.style.left=marqueewidth+8
2 |( ^4 i" }" U. P/ r$ N# x! t9 B2 g" f% J) K& F
}
; \. ~2 C$ l# B$ jelse if (document.layers){/ S2 E8 z  O+ j1 D9 G$ ]
if (ns_marquee.left>(actualwidth*(-1)+8))( }" `; [  M& D
ns_marquee.left-=copyspeed
% L0 y: E2 }% ~+ {/ belse. r0 f# M& y; m: z/ F+ U
ns_marquee.left=marqueewidth+8
$ V. `' d. f* a" m( \- m2 @}
; K4 {+ l3 A4 h' p# H- R}
) E* j" P+ y5 @5 S6 m
+ a' J1 O* j7 }: D/ ~if (iedom||document.layers){
. s6 A9 D6 j% b3 cwith (document){- m, s4 c3 ?# Y9 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 _; X% `  Z5 m# J2 Y+ c! {' w. mif (iedom){
* |$ z, M- X) g- E! T# _8 cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' \+ B/ E0 \0 r/ ]; E" w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 {( f& k3 W. E, ^* A2 |! W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) i/ x: \/ Z8 O6 d4 M, twrite('</div>')
1 c2 F9 ~9 ~5 e}
$ z( k7 W! l4 X6 L+ T* q$ h5 E( f+ xelse if (document.layers){
# q2 s& o7 J, F6 t% wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ a% _( C# \6 \8 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 `$ I# F, ?" F0 j  W$ x
write('</ilayer>')
; b- V. k6 N+ J3 D3 v8 Z9 c}
$ C- x+ t7 a) W: M7 w7 ydocument.write('</td></table>')* ~; a- L& q: @; L$ W
}: v* p, m: M+ n4 _5 c
}# y0 E7 a3 q6 }4 s& e* E
</script>

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