返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 N* K# c3 Y  Q0 [0 wvar marqueewidth=300
; |* u3 \! ^* Q8 V//高度
! A4 f+ |! Q2 k( C; qvar marqueeheight=25/ P- Q" E. {/ v! A5 F# ~7 Y
//速度(1-10)
* X+ w" c; o9 i) Mvar marqueespeed=3
3 V) f3 e  U) ]% J- `' h//背景颜色
& i% B/ W7 r4 y7 Jvar marqueebgcolor="#FFFFFF"
0 g5 P- n# Y5 J! o//是否能暂停 (0=no. 1=yes)?
$ I' L0 h" n$ j! T+ a/ fvar pauseit=14 G( q1 X1 f4 t% T

/ _/ L4 Z) u' j* g; a//修改显示内容: R8 G" w- H+ J5 W5 a! A: a. z$ o$ Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 p8 d6 O( [0 y4 |, F8 X4 O% O& `* r

5 B) {; ~3 E9 K$ `& U/ U////下面不需改变////////////
7 _7 _/ q' F+ [, j" B+ R& ~
& S( O+ l+ I( D7 `5 Xvar copyspeed=marqueespeed. {1 }* H0 u( T- a. B) a
var pausespeed=(pauseit==0)? copyspeed: 0
8 q- w' }" f& e8 _3 zvar iedom=document.all||document.getElementById
0 `7 m( F# ]/ l% a$ q; yif (iedom)  V  X6 q% Y$ r% N  O$ U! B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& N4 P7 C$ o8 Y- ?+ i" P" }8 d  Uvar actualwidth=''
1 j4 [0 H3 Y* ivar cross_marquee, ns_marquee
$ j& j5 ~# l! }9 @: f5 [. U# F1 D! w8 P5 [. d5 s  P
function populate(){
& c8 |1 q5 w9 W3 }% w3 G; eif (iedom){/ C% T. L! N" D. x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: ~, F' c2 z: U
cross_marquee.style.left=marqueewidth+84 A* @) z' \; X! e0 n9 m
cross_marquee.innerHTML=marqueecontent
4 I! T) y& ^1 a& q2 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  R2 v- V+ U, v& B4 J$ L6 W8 i! p
}. R4 I# ]7 [) ?9 K# P! G2 n
else if (document.layers){( v$ |4 d2 f8 s+ ~" ^6 p/ w& D( ?
ns_marquee=document.ns_marquee.document.ns_marquee2
3 o5 E0 r8 u4 ^) t1 j+ N# ]ns_marquee.left=marqueewidth+8* p. s: i5 m# b* V: q) D
ns_marquee.document.write(marqueecontent)6 b: k7 i" k- v+ I) `& [
ns_marquee.document.close()& [1 C1 O/ p5 a$ [
actualwidth=ns_marquee.document.width
# F+ v8 G* E) `- M, x+ ^! F0 @}
% j% L. T! x2 [: {, n, S- l+ R5 Nlefttime=setInterval("scrollmarquee()",20)
6 J$ L( A5 `5 u- O$ {. l}
, m/ V! \1 {7 v: t3 R! r& h1 Dwindow.onload=populate; c2 s5 g5 @, s( }* j1 U% ?9 z
% \; I. v' ^3 n/ v. w1 X
function scrollmarquee(){
; }" [9 h  F8 uif (iedom){4 U9 n+ u5 h* w! n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 f$ }# C8 }0 X! P$ P* Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 S/ x) T( A: [1 o2 Q2 relse
+ ]2 {( @4 E: N! ?7 Q  X1 Jcross_marquee.style.left=marqueewidth+8
! X- U4 g) X# A3 r" e! y+ s# x
. x6 c: O& ^" Y) ], M}
, n+ `$ F3 R# K- g8 H9 X, y8 }3 Jelse if (document.layers){
& K- }5 H# b: d4 oif (ns_marquee.left>(actualwidth*(-1)+8))' X! B. V; v6 m% m4 t* U2 P
ns_marquee.left-=copyspeed
: e( Z' ]8 m6 M0 l0 w. `else
. K* M8 B( c3 j* T7 M- i/ Jns_marquee.left=marqueewidth+8" s1 ~4 Q+ P& \$ L1 r
}6 T9 M; T; n( w& E6 W' X2 W& V
}
5 P7 d. N# h0 r# m0 d
6 i) X$ L- p2 `9 A% l. @7 sif (iedom||document.layers){
8 @* P! X# x. Y) J3 ?; h$ z, hwith (document){" H/ Q. l, y; X! U( c4 X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 }$ J2 f9 i) w- \) a) ?# U% E
if (iedom){
' T- z' J! T; g) R& e( e2 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& x6 R  }+ A# z1 swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( X9 t# t& S; G1 S, h+ f$ fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 U  b2 X, C8 \' L1 b& X' @, ?/ y
write('</div>')
% I; g: q/ i- C& {7 A: v+ Z}5 n8 |0 n) Z$ k2 k& Z
else if (document.layers){
. Z: `' L' N% B7 b, d$ Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 F% [* [" T0 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- H' q: D) j; U6 v7 D( K
write('</ilayer>')8 D' p) z4 T% B! Z& i9 I! h
}, z1 _* a" k! P/ R
document.write('</td></table>')  u- D% O3 e  r2 t1 t( e& V8 ^( @
}
, p" K8 R( g3 q& B& s2 @3 z}: E& G! F8 _* O! f% G0 w* r4 G
</script>

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