返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! D3 l" |7 g$ L2 D8 t  u( Lvar marqueewidth=300
6 M7 C1 n+ i* I5 F$ a//高度
: g" T& _* B+ ^7 c  x4 Yvar marqueeheight=25
& e7 o: ~! l, E/ E//速度(1-10)
; w! j+ J2 U" G4 L$ \) Evar marqueespeed=38 {! z' i  J& }& h7 |# c6 j
//背景颜色
4 |5 C4 r& _7 o& f: cvar marqueebgcolor="#FFFFFF"4 g. d5 C# t7 h" P! k: o# T
//是否能暂停 (0=no. 1=yes)?& b1 \2 O& Y9 M( F& y+ ?
var pauseit=1! i! U+ I8 v' e% V  g# N
. X5 a, ]3 I+ O! A& W. p: H" Q  l
//修改显示内容9 N2 K5 v, V; n4 M, Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* _! K8 Q! r- C( A
, W4 n. G- O' F# R# X5 ^" _
" v& V0 f; o" U" I////下面不需改变////////////
1 i* S+ P. G( x0 k9 h% _& d7 s3 r+ R& ^
var copyspeed=marqueespeed! b! j) F8 u3 J" k: m/ X" f! O
var pausespeed=(pauseit==0)? copyspeed: 0  E+ S9 ~, D! D! O+ q; ^! F- q) w
var iedom=document.all||document.getElementById
# A' l2 m- n: |if (iedom)0 i; D% P0 w" t+ Q" M5 {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! i9 n3 p9 G1 g& ?$ b8 g8 z: n3 A6 ^
var actualwidth=''
6 M! `$ v  z4 U6 o3 g- Q# fvar cross_marquee, ns_marquee
0 {0 u. M- C4 b0 S$ g
  r* G% Z/ ?# n# W! B: H) B7 Bfunction populate(){' \# W; g8 x1 [! @) G
if (iedom){# b# E9 J7 m7 G3 w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% r9 `1 @+ ?: J! Ccross_marquee.style.left=marqueewidth+8/ s' P, E; v: `" P9 }( C
cross_marquee.innerHTML=marqueecontent
- o0 E/ _( R, W6 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 t' j, ^% w' W}
  j: P% j) w: j$ g3 aelse if (document.layers){
$ p* w/ c7 w- \& q1 K4 bns_marquee=document.ns_marquee.document.ns_marquee2
) {; S; O& }9 U- U) x2 c* s8 Pns_marquee.left=marqueewidth+8; h0 K) x& a7 f3 Z& E
ns_marquee.document.write(marqueecontent)
2 j5 c& h: T% @. Nns_marquee.document.close(). {8 n0 C6 F; O
actualwidth=ns_marquee.document.width
& I& C2 C$ ?8 L9 ?}
* d& `% J! W, a) ~! Zlefttime=setInterval("scrollmarquee()",20)6 e$ K: x! E9 j& V1 F. c1 @! m& g
}! K1 `4 W+ y7 I
window.onload=populate6 P% r$ B9 |0 T7 j8 q7 c! S

* g3 a- J. D& V8 [7 G; p* xfunction scrollmarquee(){
+ ]8 J' |/ Z4 Y' _if (iedom){
8 N6 q: `* I. G$ b, Y, G+ X  lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 p& ~6 a: \+ f1 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) C& W; x4 L+ r; m* N
else
! Z5 ]- W7 F+ w5 Dcross_marquee.style.left=marqueewidth+84 ~/ k) [6 J' U( X' F$ p2 f2 \# t

7 z3 y  ~  T- V1 K0 m- ?}/ n( @- T% b2 v6 e  K6 }8 P
else if (document.layers){5 \# k1 B( f8 y) L+ m$ ^+ w6 f
if (ns_marquee.left>(actualwidth*(-1)+8))* j# ?, e6 I2 o: w1 K! i
ns_marquee.left-=copyspeed( m" w6 X8 ?1 t0 M
else/ h- N& w3 l' Z% q; J( p
ns_marquee.left=marqueewidth+8
  u+ b/ G7 r9 u! G% e) e' i, f. Z}7 }3 p5 T% R6 c2 W$ W5 F
}
9 [! W! ~! @- y0 y, X  ]5 }$ q; t5 _+ t
if (iedom||document.layers){* G- i. U/ J+ J) t0 a! p
with (document){0 A: e) z6 F9 {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 O/ u+ {) N2 @' @$ Pif (iedom){
8 `# r4 |7 h6 K9 k. pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& Y5 r# e/ W: W( A+ Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 s% u2 t* y# r. o" d5 ]$ k; c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" V! d; o: [" z) `# P% B7 w' Mwrite('</div>')0 \  C, u2 b  e" D# r5 K! d% q
}+ \* V( o+ {8 a; e) ~0 G
else if (document.layers){; I; K% Z9 L, s6 v2 a5 o- I, R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. x: `$ @( S$ s) V+ Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); t+ _$ T9 T  I: g5 \2 d
write('</ilayer>'), k, U0 O: H9 y* [% x
}
5 w& A- ^1 X  G& J( [document.write('</td></table>')
/ ]* W* W/ @4 f, c4 q* m/ O4 n& l}' r: U: b6 e2 n. `1 m- w
}
1 M7 Y0 |) u  i6 V3 o/ C</script>

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