Board logo

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

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

//修改宽度
4 U! e# D% S: R  t  g7 v2 }var marqueewidth=300
' v4 t4 |# l6 e//高度
. _  _) t' K) j- \5 d& dvar marqueeheight=254 _, I- m% N" [8 X
//速度(1-10)5 C( J0 _5 R' _7 T$ \
var marqueespeed=3
% U5 p( i2 o, X% m/ h( n# f: q//背景颜色- M  _& E1 X& D: g: m& @; `
var marqueebgcolor="#FFFFFF"
: e$ l6 k2 z& y( C( n9 q" P//是否能暂停 (0=no. 1=yes)?5 ?' d' q* L, w
var pauseit=1
4 o& a& p: w1 ]# b4 q& {, B6 Y% K) w0 x& E8 H
//修改显示内容! Q- V: V" N. S+ g- G& l1 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( s; w; {. M5 K5 l; u

' _+ U$ h" A0 d5 r$ ^) [
7 U* ]8 ]" }: h" T  _+ e) \, r////下面不需改变////////////
. C' B. A/ K1 e5 N) c$ a( R# N% e/ k: n! A
var copyspeed=marqueespeed9 T' r; |6 \; i5 K" ^5 T( F. S$ M
var pausespeed=(pauseit==0)? copyspeed: 0  d" l" @1 d' h% h" i0 n% C  @
var iedom=document.all||document.getElementById' W, B9 _5 Q. [7 M5 g6 W
if (iedom)# H% [% k" P5 |* S; ]+ D( i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! x! Y9 k) k4 hvar actualwidth=''! N' P' L0 D3 {1 L) i3 n
var cross_marquee, ns_marquee
4 B8 E" p+ a7 a/ f$ Y3 `3 z/ l$ p" z5 S# X0 l& R: |
function populate(){2 x' o: t% V" }
if (iedom){: ?5 F1 }/ c- D$ C$ d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 h! y7 S" q) w2 S+ e! v- d" Scross_marquee.style.left=marqueewidth+8) ?" n1 B: v5 s2 X' g( S
cross_marquee.innerHTML=marqueecontent
( o; t' L. K8 |0 oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 a/ w4 K$ p  I* S7 I5 {6 S+ _
}; ]: k: K4 L; X2 z8 t
else if (document.layers){$ {! Y! Q) b8 ]  e  [! x/ L
ns_marquee=document.ns_marquee.document.ns_marquee20 ]1 ^, ?$ l& s, `4 m
ns_marquee.left=marqueewidth+8
4 `( t: d0 X/ o8 C+ b0 tns_marquee.document.write(marqueecontent)8 T2 V! b7 H- Z9 o5 \9 K2 r
ns_marquee.document.close()
0 Y& u" n% m5 O$ gactualwidth=ns_marquee.document.width8 Y) s. R5 k& J
}- F% M5 x9 h. A! S! p
lefttime=setInterval("scrollmarquee()",20)0 v8 G1 Y8 A$ o! V, ^0 B2 ]7 l9 I
}
8 A% r- [; ?! S# v- q! ~3 l8 Iwindow.onload=populate+ b# D. @% E2 R! A* r' V: X' H

- w9 E. v: u0 H  G2 I; q* s/ tfunction scrollmarquee(){
) h/ s! y6 d3 dif (iedom){
  V6 N' N4 W" R! Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( f3 R/ Y% |- O3 u% w2 ^8 W, ~$ P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 U! J8 s, h/ @  |  ?* Relse
: b: F, k7 I( a4 H. gcross_marquee.style.left=marqueewidth+8. _& r1 v+ {5 J* r$ ~& M

; ^* s/ ?+ X! b9 }2 ~}# G; B% Y; N5 V6 i" E: N, V
else if (document.layers){3 z7 n7 W, x2 N, ?
if (ns_marquee.left>(actualwidth*(-1)+8)). K8 T2 Z4 P# B
ns_marquee.left-=copyspeed; N- J0 w! Q% A, Z! G8 `" B
else
' G# @& W1 K0 Z( V. zns_marquee.left=marqueewidth+8
$ d0 ?: Y0 |7 l8 u! {  ]- x. h}( J1 z( U% b% ?: h" G1 u
}7 }; B$ w4 B; ^2 s6 H. M7 f
( W9 l, i, ]9 m
if (iedom||document.layers){
7 z: [  n- f' ?8 S; Q% S4 ]% G1 Zwith (document){$ {' W6 j/ J- V2 ?' Q+ K7 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" w: Z' {6 ^7 @- U) ?6 p5 C8 Bif (iedom){
$ a- r0 N6 z7 }2 H; s/ F1 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 f0 [) b; j8 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) G1 q' ^2 V$ L- g& z/ S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* o# b. r( `  Z9 B6 l4 b
write('</div>')3 f: _% C& Z# x5 d5 t& ]' L, m
}! i- i% q7 p$ u! @+ a& w# A" L
else if (document.layers){6 G  N" T8 x3 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  e) y0 r# u: P. u8 |. ~5 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% A) T: j$ a1 H  U" k4 Z) b: N7 d+ |
write('</ilayer>')
( Z" U, R. u/ D9 w. u4 Y* a0 j}
5 l$ V: J- K+ n; R! `- N, udocument.write('</td></table>')5 s. `) e! [6 c! n- S
}
* m" N$ X5 w1 Z}3 i7 g: u2 n; i# }
</script>




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