获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ {5 e+ q2 c2 K2 `9 F7 p/ u+ J
var marqueewidth=300
2 L0 W, T  |# X9 r9 h% t. d//高度" p9 @" Q- ?9 f/ S6 E) ?5 _- f
var marqueeheight=25
3 v0 G2 E  _8 N2 Q( B8 u2 Y//速度(1-10)6 ~( Y# R1 e- b; e' t
var marqueespeed=3! Z8 S* ?: Q1 P3 F" I
//背景颜色! r# n6 c+ j* @. i0 \7 F/ b' E6 r
var marqueebgcolor="#FFFFFF"9 l* U/ Q0 t6 W( B* B( _. R
//是否能暂停 (0=no. 1=yes)?) Z0 h$ [. \2 ?  I$ b; L+ T1 Y
var pauseit=1" [# c! O6 |9 }. H' h

; K3 I/ n: j$ Z) h//修改显示内容
. B7 S/ h' M0 ~: p; B7 E- dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 [4 L. r+ U  ~% h5 S, L2 j' @) K( b. L5 b; n1 h; f5 v

/ y; ?1 G+ @6 `# }8 ~' @; K3 t8 n/ s////下面不需改变////////////0 d5 ?! N. m5 H4 ?; J* q

- s. F4 @* F2 a7 k, j+ wvar copyspeed=marqueespeed' j7 ]2 B& y& L
var pausespeed=(pauseit==0)? copyspeed: 0$ `. w/ A' x/ H
var iedom=document.all||document.getElementById
- _9 e% B# C: D0 V8 c% Aif (iedom)
1 G) J- _( x) A# K& Z0 d  ~" }, F: \! @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! A5 C9 k: K: ^2 |- l) f1 a. V
var actualwidth=''
+ k1 T) ?" V8 _, j3 Y! w0 vvar cross_marquee, ns_marquee
" R" r1 P! v. B+ c6 N& U. J' M% O5 D; \$ M6 g
function populate(){
( z5 ~5 \% ^1 K2 w3 Nif (iedom){
1 ?7 o" T, o$ G' m. ?$ I& `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 m8 C, A* L  B( j( K4 E5 o2 E3 Zcross_marquee.style.left=marqueewidth+88 R: V- W% b( A, G7 I9 U0 w
cross_marquee.innerHTML=marqueecontent
) `& g% K$ O$ z* k& Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ Y/ J1 e3 Z$ o3 `" D
}
" s$ r# g1 O8 melse if (document.layers){
  x7 e6 D: Q7 Qns_marquee=document.ns_marquee.document.ns_marquee2, M3 X0 r' e! l1 I4 r9 X
ns_marquee.left=marqueewidth+8
4 ?& e8 H/ ?; K' N  Xns_marquee.document.write(marqueecontent)
$ j8 B5 E& }  A+ I% [ns_marquee.document.close()6 u2 C$ L* X1 k4 |
actualwidth=ns_marquee.document.width
5 E+ m8 e1 D9 W: w# ]}
8 g2 ?  |% R+ q: n& U& b9 U" l5 Blefttime=setInterval("scrollmarquee()",20)
& C1 A3 {( b* H+ h4 \}5 J" r) U7 m8 u: g' R3 u3 P; `5 U/ z
window.onload=populate1 E& {4 G2 o5 _1 `7 c4 f0 h5 f
/ ?/ _; j) @2 j2 t; s
function scrollmarquee(){# i( w5 S1 d+ _$ ~* Z
if (iedom){
6 R# c% O. R0 ]: A1 J: v2 b# Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ L1 i  D: y3 w9 Z! ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 ^4 }2 b7 o; W
else3 t- o' R1 @* O2 C9 n
cross_marquee.style.left=marqueewidth+8: h/ ?$ ^8 d; v% r( R- q" `; `* J
1 o1 `1 z7 H& l( H
}
+ `; A4 P2 A6 A$ P+ Gelse if (document.layers){
8 ~; B" [8 f* S( {4 v6 ~; g4 i3 Mif (ns_marquee.left>(actualwidth*(-1)+8))
* H/ S6 F) I  g3 Q* ]6 lns_marquee.left-=copyspeed$ I8 I. B+ K' U+ c
else
5 y2 m7 p' I6 L4 Bns_marquee.left=marqueewidth+8
* f. ^3 |( I' x" e- y}
/ v5 ^2 s7 x& {2 J) z+ j}" P" P" t1 w8 ^1 l; i- ]$ q4 d
0 p9 z6 Q: T1 F1 `8 q- q# {( o) u
if (iedom||document.layers){
2 i% u) \5 R6 m1 k. ^% [with (document){
8 w& L$ `) U0 n3 \4 U* h/ tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 ?+ O$ O; \( S
if (iedom){5 I: q: D' j/ r1 i, C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% @4 q" Z2 a1 Z3 E: g/ ]- p* R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ h1 M* H' j! X1 a! Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 V$ Q; I6 p5 p9 k! G! v
write('</div>')
+ F& [0 p5 o: \. G4 s5 ]- x}
6 Z- v. F0 _4 R( w! f2 b. {6 Melse if (document.layers){
2 Q2 r; o0 y3 G1 w( z3 T1 twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 ~1 c$ d# K$ x6 J% l. H) i9 `& Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) i  J- K' i# m' }: D: M# C1 lwrite('</ilayer>')
5 ]3 C9 _: t& t- P( {0 m+ i9 _}
/ }1 g+ g7 P* K3 x/ }0 [& o7 c+ [document.write('</td></table>')/ {+ p! ?4 c9 d( R3 Q- ]
}1 H" j. t, Z; G+ L$ ?: z; P1 l
}6 h. M2 j9 _- v6 m' p
</script>

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