Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度" N. l! Y. k3 K
var marqueewidth=300
" k* S+ k- \' g6 {3 {//高度
, F* C7 O$ ?! I  Svar marqueeheight=25
+ g' z5 h% d- n) k0 _0 G; U//速度(1-10)
+ Z- H1 ?2 L2 ]0 c. P6 nvar marqueespeed=36 [" L3 V( F5 x
//背景颜色) o7 X, s3 z; N( W
var marqueebgcolor="#FFFFFF"
# {% V" W% n; l# |//是否能暂停 (0=no. 1=yes)?
, S+ N/ h$ |3 u9 Evar pauseit=1
! n9 M) n% O3 ^( u+ r- H2 Z; M' c2 r2 C
//修改显示内容, |; [" r! |* d5 p. h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 M6 [# c8 V) L, r. o6 Q4 J3 t' T$ ]  }3 ^3 s+ A: k3 \0 R3 j0 u

: f3 d: W: r4 t8 m////下面不需改变////////////
4 I2 |' S. f* L+ w) H! O
" t) Y! H9 n( b8 y7 x$ o* Jvar copyspeed=marqueespeed! M3 ~! z5 E# j& R3 ?8 n/ W; V
var pausespeed=(pauseit==0)? copyspeed: 0* a( H" b( m( D- m
var iedom=document.all||document.getElementById' T7 |: z! L1 u. c! M& m
if (iedom)
* K! c; j+ I7 N9 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ L/ y. d% c3 I5 b+ W; Wvar actualwidth='', I1 x( g4 X1 h4 m
var cross_marquee, ns_marquee
7 ]# F8 C  C. e
+ @4 r+ U4 h8 n) @function populate(){
5 \1 p# a1 q( Qif (iedom){3 E# u$ s, F& e3 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 B) O, ^7 ], F' k& T8 g1 \  L$ Q. bcross_marquee.style.left=marqueewidth+8
6 ~/ c  B! M1 j$ t+ ]cross_marquee.innerHTML=marqueecontent4 k9 w8 u( t9 n, i+ ~3 y0 p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 o7 F& C7 ^( D5 o; n
}
2 d8 u  \- ]3 O, `, F  j9 s. delse if (document.layers){
! \# i5 W; `7 V& H2 Nns_marquee=document.ns_marquee.document.ns_marquee21 }* S' {. w6 t% e1 A
ns_marquee.left=marqueewidth+8
8 B4 |$ p+ d1 d' s$ k( Wns_marquee.document.write(marqueecontent)
( `( E& V9 Q8 S7 [$ bns_marquee.document.close()
9 c6 J( D* W( T7 D0 |- jactualwidth=ns_marquee.document.width5 F5 A/ H# _$ l. u* ~/ v
}0 V/ Z- x/ y. i1 v! J
lefttime=setInterval("scrollmarquee()",20)8 K  m; r- ~7 a) W* x7 [9 Z6 T6 {
}
9 k/ O3 w' x* s; `; |& lwindow.onload=populate( p4 I1 T& e. g, b7 |- y

2 r% S" w) K# G. zfunction scrollmarquee(){
* R2 M1 B  @9 F# e) h6 O; ]if (iedom){! i9 \3 i8 u# d5 T' f! [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% A0 P5 ?' ?+ i. K' [1 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& u, A) |% w1 X' ?+ G
else
+ A8 q' O) z) z2 ncross_marquee.style.left=marqueewidth+8
7 `5 V2 n6 {) a* `# u! f0 e4 F/ p  z) ~; ^- D- l) t$ g& V  N
}2 f  h) A" j7 F
else if (document.layers){, @  ~3 Z; ]9 w
if (ns_marquee.left>(actualwidth*(-1)+8))# ^. Y/ _5 q9 u$ B
ns_marquee.left-=copyspeed5 u" L4 W; Y/ N4 S( H) G
else  x5 u( M' X7 u8 Q
ns_marquee.left=marqueewidth+8
' o0 X2 n# f# j" U: C9 `}
; ~% Q* i: J' ~4 B3 j}
! P( Y# ~0 K% V$ K- g! |+ |2 s! c7 f5 Y
if (iedom||document.layers){* g$ {$ Y8 B7 g2 g, t
with (document){' u( }5 j2 \' H/ I4 D( A$ Y, f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. H$ o: l3 Z0 t# \% ~if (iedom){
' p. _6 _- l' e, m: ^! jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 }1 ?& a9 r; Y7 v2 _! z* Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* j- ]2 S6 B: T5 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); `+ m' a" L9 N( Z' \& W0 P9 I7 q
write('</div>')6 X5 ~, y3 {$ ]/ Z! @
}' [# K- ~6 p% v; U! g, _
else if (document.layers){: w% b0 m1 W2 B1 J* e* |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& U) {/ J2 H9 v1 g4 a/ M+ b3 u' Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). H' ?" `1 Y- P$ [: Y! b
write('</ilayer>')
; K+ B% a8 u# p; t; U}& K4 v  Q$ [* X, Y
document.write('</td></table>')% ]* _* f* _$ C% S1 j, Y$ G  F
}
+ E5 E" Y$ R5 t, L/ q2 n- d( Z  ~}
) G( ]. d; C. @, K</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2