返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 M) ?% l; C# L6 o" J- N
var marqueewidth=300
1 t, q4 X: @: s3 t; h# R7 r* X//高度1 S6 [( O) @* ^4 @3 _
var marqueeheight=25
, g4 D. m2 Z2 w5 {1 S( p//速度(1-10)
9 e& J! D$ N# ?& z9 G, Zvar marqueespeed=3' U$ c" W1 X/ g1 e! w/ E2 f0 }  K! {
//背景颜色! _: e* Q( r/ H( H0 j, S
var marqueebgcolor="#FFFFFF"
; @" g. n' d. m//是否能暂停 (0=no. 1=yes)?6 h2 g0 H. h  e+ H) q
var pauseit=1
% y2 F+ `. ], r9 r& X9 J; @8 k1 G5 y5 Q: I5 T8 B
//修改显示内容
6 c" ?1 a, n" T' L& |0 v3 R$ Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' q9 J- j( ~+ h* S+ u9 `
" j8 ?3 M' P, X3 g: N$ J7 t* A( m6 y: X, o9 G0 C0 B5 z- u. P
////下面不需改变////////////
/ p" z3 M2 U' X. O1 `7 e- W5 ]# }; ?6 X+ ]0 L) A$ k4 I6 H
var copyspeed=marqueespeed
1 G1 f5 }! ?& c8 h+ svar pausespeed=(pauseit==0)? copyspeed: 00 m9 ]) u$ @4 g( x+ Q- b% j
var iedom=document.all||document.getElementById
- {: r8 Y7 C* L* r: rif (iedom)4 f/ A; p: n& M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 r2 E: S* j; ^3 j5 P. p& @5 D, N' r3 N
var actualwidth=''4 N  @5 ?# v6 Z, o' H& y, n% ^) n
var cross_marquee, ns_marquee3 r8 w) N. H5 n
% n6 C2 [$ u3 U; a
function populate(){
: m. T/ p7 V( L! [if (iedom){
; H1 @, H* s1 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; K8 _7 }! a; s* y; s$ W
cross_marquee.style.left=marqueewidth+8
( w" @( |, T8 F* x  N: ncross_marquee.innerHTML=marqueecontent+ M8 ?3 O; U3 a2 F/ ?; z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ A- i! {! S1 t6 ]; F. c  Y
}
/ R5 Z# o# G! {  _' r1 Z+ d. Melse if (document.layers){' w5 B$ `+ |& J) C" O7 r( Y" o8 w
ns_marquee=document.ns_marquee.document.ns_marquee2# ~1 w7 E, [. m* }  n; Z# q
ns_marquee.left=marqueewidth+8
9 i! \% B' v& |$ Z( R+ Rns_marquee.document.write(marqueecontent): b( |. c; e5 o+ G& z) I
ns_marquee.document.close()$ o, a' A- I* J# `/ ?2 q: J% r
actualwidth=ns_marquee.document.width5 f& r5 ^/ X6 Z0 H5 I
}9 v1 c- U0 a# O3 ?5 G
lefttime=setInterval("scrollmarquee()",20)
& ?$ |7 E# r* S& e; T9 e3 Q+ D; D}1 @- c7 k5 W4 e* a) T- ]/ W, n
window.onload=populate8 z7 V; s& v' C* ~

0 v& M$ }6 z8 l8 xfunction scrollmarquee(){. C! e5 ]8 E* z+ ~1 d3 M
if (iedom){5 d+ n* N0 }7 H1 x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), Y9 H7 s0 I1 \9 G/ Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 d% X& r+ W1 l( y% I. ]else
% {7 @8 R  l6 \! ]; y& icross_marquee.style.left=marqueewidth+8
. Q9 Z- T" j+ S" g
3 m4 |4 ?( C0 Q( C}
: K* l0 \8 f  _5 s) Belse if (document.layers){
" {: d! e" P! jif (ns_marquee.left>(actualwidth*(-1)+8))
5 E* Y! e/ F5 j% E6 r! ons_marquee.left-=copyspeed
: N, v7 {2 H( p( q& ?" G$ ielse0 P' q& q  l* U0 b! H' [
ns_marquee.left=marqueewidth+8
: f+ }* k9 v" e# @( O+ E# K}3 t& k9 g1 V' W0 l, x) I5 G- ^
}7 m+ ~+ C5 h4 H0 D: Z
& ?, m8 p6 }* P0 D
if (iedom||document.layers){& n" _0 B7 M' U) O4 `* {) I7 z0 L
with (document){# x) P$ m" D( N/ Q" o: k* i3 C. {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* ?+ F- l, W; V4 U
if (iedom){
; x' `# `: w# B# h- _4 l+ N( U% nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 o* P8 r% D. G" F# Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 [8 {9 ]' N4 n1 O% Z8 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ m% r2 W0 f- R7 U; f& o- l* S
write('</div>')
2 `6 @  S, m4 A5 c}
# V4 |% i/ p$ C+ v& W( Selse if (document.layers){
6 Y4 K+ |1 k6 o8 h/ jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 w; P: D8 n: I- U, Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ r3 R5 H4 R0 r) x5 }write('</ilayer>')$ n6 b  x- s! [+ R  J6 J# a# B4 \
}
' I7 o* M9 Q& P! _3 Cdocument.write('</td></table>')
5 l  R' r5 L* P4 ?: J9 n}: g. n6 V4 o5 c. B% P8 A
}- B5 t9 M: C! P2 H) |
</script>

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