返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ {- Z6 [( c  S* J+ Y2 l0 O" Uvar marqueewidth=3007 i1 u. S0 u* W: Q9 Q! ]
//高度
& b/ \$ N- {: \9 ~, gvar marqueeheight=25
& x/ s( ]7 G4 K8 B  u& o//速度(1-10)
* W3 Q2 X1 N' y5 Bvar marqueespeed=34 K. N) C3 H( M. Q5 B
//背景颜色/ m. H0 C! n4 h. D7 C2 Q, g2 l: A
var marqueebgcolor="#FFFFFF"; \- `) R; f$ d5 H; U* G. C
//是否能暂停 (0=no. 1=yes)?
# [  I7 [2 n# ~% B1 Q3 i5 Qvar pauseit=1
% n) G+ Q* x4 R
0 x& k7 C) h) V" i$ ^  I//修改显示内容8 {% X7 e0 q* p. o+ Z% a! g: v8 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 `7 @: X, a' {" [
) Z$ y; R5 b: w9 e. i/ r8 `5 O
7 s+ W2 z9 i( c2 h
////下面不需改变////////////7 s. w0 B; D. S% m. B
3 |) p" |5 G/ A% i% Y: t
var copyspeed=marqueespeed
8 t& |! M7 @2 L- F: d$ Gvar pausespeed=(pauseit==0)? copyspeed: 0
2 |6 Y3 |% N4 f( Hvar iedom=document.all||document.getElementById
3 `" h! q4 a' d# ]% f$ ]3 D/ W0 fif (iedom)
7 t( f# ~8 @8 P, Z, g* z3 b0 u. |) @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 X4 o7 O# ^% \; t  y" a9 q3 lvar actualwidth=''( k, }6 B) r4 f* ]7 m! t8 q
var cross_marquee, ns_marquee2 f( z/ j# u1 [8 m7 V2 q7 w

9 m1 X- K3 n' ~# s! F* e- `' v7 \function populate(){) n  Y& a( ^  X  o7 J  p4 M
if (iedom){' s* x% Y: ?% \+ T, R2 F0 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, p; U8 y7 c) H) s9 A! N
cross_marquee.style.left=marqueewidth+8
" V; D6 h6 D5 M0 hcross_marquee.innerHTML=marqueecontent
6 |5 P) [" U" }5 R: G8 p5 \/ X, iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ ?% B6 N) F' {
}
- w: E+ U5 ]  g$ B6 r9 O" Felse if (document.layers){
4 m0 }( Z. M" p/ Sns_marquee=document.ns_marquee.document.ns_marquee2
3 }! k4 k! g8 Kns_marquee.left=marqueewidth+8$ @. }$ f1 B  m" ^' K4 D
ns_marquee.document.write(marqueecontent)# L; |; c. q( m
ns_marquee.document.close()
6 L2 a, q7 j% ^7 z5 A# aactualwidth=ns_marquee.document.width9 s& i: B, Y7 Z7 G7 J/ l& v3 S
}+ Y" K( M. ^" t6 g0 j. S$ h1 P* j0 K
lefttime=setInterval("scrollmarquee()",20)- w8 s7 G! I4 `- A
}
& B' `0 B; I9 u- ewindow.onload=populate' }6 P2 `2 x3 c) V2 l" C" ]
+ r7 U3 d! J  P& i: f+ {
function scrollmarquee(){
$ ^3 l# l, V2 m' vif (iedom){
4 n6 H$ S$ N. Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! t+ g; K5 Z! {  Q3 E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 s. O( j: g" O1 B% Delse9 T2 @3 u" P( V: i2 t* E* }) D; }# j9 s
cross_marquee.style.left=marqueewidth+8& ?, M0 v) g. h+ }7 [( J

: {# f' Y3 X9 w. Z}1 W/ p3 R. |8 N
else if (document.layers){
: q) S3 T7 ?1 Q- ?7 {. Mif (ns_marquee.left>(actualwidth*(-1)+8))9 V) @$ G* ~  {5 j- S( S5 L
ns_marquee.left-=copyspeed
) C$ x" d! u1 s8 _- Celse7 n  A. y3 [% \
ns_marquee.left=marqueewidth+8
' q# W* t( L4 _$ R) Z" h% T2 y}
5 L! p, Q, {: u! H. V: u2 p8 ?9 p}
: C5 P' M% \1 _' V
( V( o3 }7 P- d8 P! gif (iedom||document.layers){1 C8 z& V. d6 J' ~9 G+ ?
with (document){
. H, O' T- ?( v* v' h* |! J$ bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& ~# C) T2 ^9 R" m; N( Yif (iedom){2 v! v* P  k! T5 t& a  S* A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 s. @" \. }9 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# b: J4 [2 O: {0 O( ]3 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% Y- G8 F) E$ D2 A
write('</div>')
& {" t9 d# L; b# ?, g. B" S}1 K% }+ K$ U/ l* Z9 f8 a
else if (document.layers){
3 v. p3 L' ~% y/ t% _) a1 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 ]0 L, Q( y: E' f2 @5 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 z0 _- y, A+ |$ S' Z, F* H
write('</ilayer>')3 C4 c" Y7 @. C2 G! L4 D, N6 p
}9 n5 f0 ~8 ?* y/ ^
document.write('</td></table>')
1 r4 z8 m  ~5 Q& y. t3 U) E/ G) X}. [' i: h9 k; {/ r+ f) J
}
* n$ _; c9 y+ g! [$ V7 G6 c</script>

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