返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 w& }: S# f; ?- w7 O5 K$ V+ a* C
var marqueewidth=300
* n/ K# b3 o8 \/ d* k2 d/ E2 [) }//高度" W3 o0 Y' b! r; `' p4 N
var marqueeheight=25, e, }9 F5 q9 I& z' Q  I9 q
//速度(1-10)$ A9 z' J# H# f* R; D
var marqueespeed=3
" u  x. A$ ]" \$ S% K  j//背景颜色& T. Z" d& Z& f' J: ]. k1 s
var marqueebgcolor="#FFFFFF"
8 i' l2 @/ s" f& V# ?3 i7 a: }//是否能暂停 (0=no. 1=yes)?
" i3 m% W% x1 v8 i' ^% ]' svar pauseit=15 Y0 q" D6 R* A% C6 e8 k

5 F5 f/ t7 [8 i  g//修改显示内容) I; m( J( K! h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  W. G. s# O8 j" G
6 E! O5 r! c# E( a: |$ \# j4 a2 V. Z, A6 a9 v
////下面不需改变////////////7 b1 K$ S% d! H) \4 @0 u% V
3 Q& `, i, c( d, E$ G# p0 G2 K: H7 I) U" `
var copyspeed=marqueespeed
8 N3 d) l% y1 N1 Hvar pausespeed=(pauseit==0)? copyspeed: 0
" Z/ O. ?/ h! w" R; y1 Yvar iedom=document.all||document.getElementById
3 H& C5 k$ o  K4 q9 vif (iedom)" D! \! t' A. v$ v9 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ t2 S5 e( ?. ^var actualwidth=''
  i7 k2 F# m2 H, D! V7 }2 d; Qvar cross_marquee, ns_marquee
' I6 j" `% g1 W) d$ @$ \( i$ h1 ~# m  \1 e
function populate(){: x: r, Z% `* W% A
if (iedom){$ P; Z& j- `4 D5 }. h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 b$ ^5 m) V( B
cross_marquee.style.left=marqueewidth+8+ C' r. b) ?8 a
cross_marquee.innerHTML=marqueecontent: L  Z9 L+ U& i3 i$ m8 d3 \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' Y* Q) ]- H! ?, u" L& q) @( |8 y0 a}
' t4 G. F7 F  X2 |* j/ [else if (document.layers){
# S0 u  X1 d6 C. Vns_marquee=document.ns_marquee.document.ns_marquee2
8 b, S: u, m" Lns_marquee.left=marqueewidth+8
; E" F3 U6 `* Z1 e0 @1 D% E2 R& Z) vns_marquee.document.write(marqueecontent)
# t. P: G* F+ B1 Lns_marquee.document.close(): G$ x  B0 ?- }. [" f# H8 N# U
actualwidth=ns_marquee.document.width, S1 C& I2 o: }, w+ n7 i" J0 G: v% C+ u
}
+ @0 k% i0 h) Mlefttime=setInterval("scrollmarquee()",20)1 I; g: I9 r- I* D+ u9 x
}
+ a: v4 Y5 d; c8 w, e2 x  h# `window.onload=populate
3 h+ U) L7 C( g; b6 n
* D7 B7 K; c# t5 Ifunction scrollmarquee(){
# v- [  p0 [* s. K3 e: h/ P" R9 V% `if (iedom){+ h+ K8 Z: n2 h, j7 ?2 U' u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- M* e% m, J9 H1 Z4 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# ?/ b0 |8 b) N2 t5 ?$ l; Z
else; U$ k" U& k% j5 B3 a8 R( W
cross_marquee.style.left=marqueewidth+8" m" y* a( j& @3 r; s, A

* e  J+ O; }& \) q! b}
( s# y# ]# r0 F7 Y6 @8 D5 m( ~9 selse if (document.layers){' X- T# k1 n! l+ g7 q1 F2 u. s1 j
if (ns_marquee.left>(actualwidth*(-1)+8))
/ h# d2 u$ O! q  ^; L8 e+ tns_marquee.left-=copyspeed
' V7 U0 W: P- d% delse! z# J8 K2 Q- {$ Z% A
ns_marquee.left=marqueewidth+8
7 z" ^& v* W. q4 I- i* Z6 f}
& c+ M5 U( B0 n/ ]+ i}! `0 Y8 a4 Y* [$ K. F

$ n2 X& N8 b) l% Lif (iedom||document.layers){
9 v( e8 i5 M( B8 \with (document){
! p: U3 h  l& B6 M1 o% P/ A0 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 Y0 ~1 L, g- S1 F6 J/ m1 Nif (iedom){' D  x! T! z* W! t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# h3 m/ x5 D9 j6 u8 ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 s* G' \& J- p+ q& ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! p: t% l" u3 K! p
write('</div>')
  A6 e7 F# ?& o# B  G}# t. N" R/ ~. |7 i  Z! P( R
else if (document.layers){
- y- M! ?2 G( m8 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 m4 b5 D- K; {  d6 m# \+ kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  q4 a; Z1 Y* y7 W3 W9 ?- y5 [write('</ilayer>')$ V" s8 z$ J5 m
}
* }6 i/ g' `1 P& Z( ?document.write('</td></table>')1 ]( z) B9 @# C! L. {
}
7 y2 t* D0 {4 N& o0 D5 a- U' l$ d}5 t, g* ~# o+ r# s
</script>

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