Board logo

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

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

//修改宽度8 X5 n3 x1 [3 C' Y
var marqueewidth=3003 k7 J: V- ^. W7 O
//高度6 c" `3 w: T, I! \
var marqueeheight=25# O( l. \  S) K/ Q; V2 }8 r8 B/ M$ U
//速度(1-10)) a! \, t$ O7 E" J
var marqueespeed=3/ E2 g2 A3 [1 f6 z+ X
//背景颜色  W" R8 ~! @4 t0 M9 j7 u
var marqueebgcolor="#FFFFFF". l% e) ^( }6 Q( J
//是否能暂停 (0=no. 1=yes)?
( ~0 A6 w( W6 B* s  yvar pauseit=1* ?/ `% o. T; I5 J5 F( O$ @9 j& D# s
# C  B% z* I& J0 O7 Q0 K) K" W' A
//修改显示内容8 e# L- `. A+ C  L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 A: r4 `( g: y0 W" I+ q

8 P( Y2 d0 H1 y2 t3 t2 `6 G) j4 N1 f! }5 m+ r4 m( {
////下面不需改变////////////
9 |; F$ W7 ~1 P4 W/ w8 P
1 g1 G$ Y1 }, X0 w5 Dvar copyspeed=marqueespeed0 K# _7 |5 U9 w: p9 r
var pausespeed=(pauseit==0)? copyspeed: 0- c" J: f5 D* |# @1 \: ~8 H3 r3 k
var iedom=document.all||document.getElementById0 t' j& w9 Z. T( z, ?$ r2 f, L. b
if (iedom)& _" t7 W9 c6 u! O6 E( d3 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' B1 n% d0 ^% c& q) X
var actualwidth=''  r+ D, ?8 X/ q' w% D2 ^
var cross_marquee, ns_marquee# T' B+ e' A  g* E8 |* L* U& b
3 G1 C+ k( X$ D7 \; C1 i0 E4 X
function populate(){: L7 W0 c; r. p* k0 C
if (iedom){
  W" m; G3 A+ `' \& ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. M$ M; F+ R  @0 }$ X
cross_marquee.style.left=marqueewidth+8
! {& H) a6 [* }" i7 k) I1 gcross_marquee.innerHTML=marqueecontent
% T% g1 U, j2 x- dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 ^9 l" \0 k! z  e3 W/ @- x
}
8 V! E" J5 v  w2 j3 velse if (document.layers){* A3 v+ J; B9 p  K4 N, N  ?* U
ns_marquee=document.ns_marquee.document.ns_marquee2; h+ I  q+ ]# y& c( Y, F
ns_marquee.left=marqueewidth+8- L/ I6 u- n; D( n
ns_marquee.document.write(marqueecontent)
3 I3 H/ v8 Q. M6 w  I5 s2 }ns_marquee.document.close()
0 o5 ]( \# L8 cactualwidth=ns_marquee.document.width
+ A/ M6 _# {' D: v3 {( |8 E# X}
8 @5 N- N- `) }lefttime=setInterval("scrollmarquee()",20)
- ~' c4 w- K4 w3 S- a/ y}
' K- L1 `  q$ L% Kwindow.onload=populate
; o% I4 n9 b; _- P& |& j4 P0 x) \6 b/ j1 A6 W2 |0 I" X5 Q8 ]
function scrollmarquee(){
" d7 M. v# b1 g* |) vif (iedom){
; B* z$ D" x5 k4 l  H. K# c8 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" {, X3 ~+ }5 t+ s' O4 l1 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* i9 v$ J- X1 n6 j
else3 x# z$ n: c' |1 G  H, l8 G1 q4 P
cross_marquee.style.left=marqueewidth+88 P+ r! M& c- Y) A! w

% k6 E' K* Z# Q  |( h/ j}
! X4 t% J  n1 b& ^/ P5 J' N8 z. d+ l. aelse if (document.layers){
+ y, _# t4 l8 Y( Z$ v: g3 gif (ns_marquee.left>(actualwidth*(-1)+8))! Q1 @" D. H8 V
ns_marquee.left-=copyspeed
( y2 K3 P% f- i; d; D$ D, Jelse
7 Y6 r# F; H& N/ D$ @- ~9 r$ n  Ens_marquee.left=marqueewidth+8- v: ^+ @+ V# v4 M+ y! J, w
}
, r- P( R( L8 ]5 h, s- J' ?}
/ `4 {( P/ I" T* Q2 U. A5 }; P% `2 a: P- y6 C. E
if (iedom||document.layers){9 v8 L, _2 F% z7 m  ~
with (document){9 _6 L6 C" |7 o  }# T) j, o" D! q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ E+ z1 m7 {- N- }if (iedom){* Y( A) W* d/ {% U( a+ e. e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ Y" _  t6 ?& y* L# A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! {  r1 L+ l2 q3 S1 r0 y# o/ k& O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 Y5 A4 }' O1 J8 ?0 X' G) Vwrite('</div>')
+ g+ o) D% X! e/ U9 i# K( [$ Q}
3 G& V( F9 l2 e# y- A- T2 belse if (document.layers){# i7 R, b& F6 Y9 z( W/ T+ E& j8 y# z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 F; S' j7 t* I2 U" b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. F9 z/ }( F; V8 R& v3 s- `0 Kwrite('</ilayer>')2 a! V( ]9 q" n2 n( N
}
, @! G7 P; T0 J- y. E3 ldocument.write('</td></table>')0 H* ~3 o* X+ N
}' U$ c: y, w1 s  M% h
}
1 N# k; D- @; ^. A2 I</script>




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