返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* q2 G: H* K2 V- K7 Bvar marqueewidth=300+ Z- K0 r- |! y7 g7 Q$ a) E* ?
//高度
/ S5 K, z. J( p# w% Yvar marqueeheight=25: p/ ~* n# h+ [5 P; K
//速度(1-10)8 ?. b4 ?# e$ B1 k. T0 e; f
var marqueespeed=39 E6 k# p4 @! Q# m% n  q! ~
//背景颜色- ]- c4 g# w$ t% s% c3 A
var marqueebgcolor="#FFFFFF"( |# A) z9 S- R! z
//是否能暂停 (0=no. 1=yes)?
6 D7 R4 Z. V1 kvar pauseit=14 a' }4 Y8 P5 V) Q
: \9 H, ~) `1 }. _# }
//修改显示内容% U4 _  e# p3 ], _7 d1 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 ~: M" @$ @! l" y- X! L: ~7 ]0 k! W+ c, T) ^
: P4 D2 R. p( M: x
////下面不需改变////////////
' A3 H3 [7 f# k  e- M5 R- _( p9 `. i$ d
var copyspeed=marqueespeed; }- U# y9 s5 R5 e$ n. R' Y8 Z+ k, L
var pausespeed=(pauseit==0)? copyspeed: 0' m5 W+ `7 x$ T. e' W
var iedom=document.all||document.getElementById7 _1 T$ b: L% ~0 Y/ W1 z! |9 x
if (iedom)" r1 w; ~+ c# l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). N3 B4 n9 f: m$ c3 q& B
var actualwidth=''+ W3 v+ O9 n5 W3 X
var cross_marquee, ns_marquee
% u, @5 A! t4 l) V
# n  J6 d) u; hfunction populate(){
" c4 W: S. d" H  R% |  H8 mif (iedom){, b4 c: z& i  e" f+ i1 |; @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 i4 a9 I4 q* vcross_marquee.style.left=marqueewidth+8
+ K- S  @0 K2 D6 g7 ccross_marquee.innerHTML=marqueecontent
( y0 Y9 T3 K! ]2 _, F- sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 c2 W7 ~# o! i: F" \}$ q; s7 \- N3 O1 ^1 E
else if (document.layers){5 U# x! l- Y3 F$ L4 a: R
ns_marquee=document.ns_marquee.document.ns_marquee2; V* Y* ^9 E/ c* T4 ^7 x7 X
ns_marquee.left=marqueewidth+8
) {6 V3 b; b6 `. ?; `  R" Nns_marquee.document.write(marqueecontent)
% s; G4 P+ S0 J, F; C5 T- t' Lns_marquee.document.close()7 k, q. ~8 E2 V3 o$ M; ~- J
actualwidth=ns_marquee.document.width+ j+ Q2 f; b+ }# J1 S1 ]
}" s* k  f5 f" L
lefttime=setInterval("scrollmarquee()",20)
# S5 _5 [2 s. b) I}2 L! e  ]7 w/ w
window.onload=populate* H+ u; X1 T! r* O

% G! L7 P8 |& P$ ~# m) s% jfunction scrollmarquee(){& F2 M4 J: I2 Z" R" X( K7 l9 w/ `2 `
if (iedom){% L6 C1 u$ w9 P. E7 z$ V( g; R5 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' ^& P8 {: j2 P# [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 Q" L+ J5 f4 X! c! x5 selse3 y" e3 ]; O- j: g
cross_marquee.style.left=marqueewidth+8
* O7 j. a5 b' y
9 [! D" Z  R, d5 v0 j$ s}
6 _: u6 k8 Y$ _+ _1 oelse if (document.layers){
+ M1 \+ Q7 @+ o7 W4 o$ sif (ns_marquee.left>(actualwidth*(-1)+8))
/ K6 a  O0 E+ ?  Sns_marquee.left-=copyspeed
/ q2 P8 S9 m) eelse
6 q  U$ P% t* q. [8 a# E% tns_marquee.left=marqueewidth+8
! @: h3 k8 v. M0 i% q$ y) x}
* h1 h% x; S, g/ T1 }}9 d+ U; U& A! P. P

9 ?5 I, B0 F6 J2 N8 v7 R! jif (iedom||document.layers){3 U. V$ J4 H8 k5 l; h
with (document){0 l* z% o2 k! u* ~# k: ?8 k3 j+ S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 Q, H5 F: H! N' t' f" A2 v) e: X
if (iedom){
1 a% p) Q; o! i6 v4 {8 c3 S% h" G+ Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* t. C0 C7 @1 {. k' V+ R# ^# Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ Q0 M) _5 x" n$ F0 Y8 L/ U/ q* ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); U, \$ [# q! N* b
write('</div>')$ f: g( d5 V8 x) K3 n
}' i: |1 u9 n4 a0 G& P1 f1 h* \9 _" T+ C
else if (document.layers){
4 {) E5 C1 u8 Y, ]% mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 G- J; V: @9 Z2 a, c. m: mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). h5 O) j0 K: g8 t( ?
write('</ilayer>')  X% l, K1 ]4 \: Q, Q
}: }$ H) ?7 m+ D) U0 N3 G
document.write('</td></table>')
' \% |$ p. A6 }}' t  w' `5 g2 t$ J  M1 b. m
}
! F! {+ u! i( Y% L; o</script>

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