Board logo

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

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

//修改宽度; G: f7 v; W; X$ M& n
var marqueewidth=300
  |6 b  a, h& S: X0 V& }//高度! J, q, B" n- m5 t% H: j" i
var marqueeheight=25
" p6 ^4 U/ k$ ^/ a; b  b6 x//速度(1-10)
; f+ S, [2 B" S% a5 Dvar marqueespeed=30 `$ B5 U$ a& j" J9 M( C+ C+ h, X
//背景颜色
4 k3 S; O* ^% `1 d( u- tvar marqueebgcolor="#FFFFFF"" w0 t- I' Q& x6 h3 N  A
//是否能暂停 (0=no. 1=yes)?6 h1 b" w: F" U) x+ V
var pauseit=1# z( g$ K2 A" ?  F$ _4 l6 s
; _7 q1 t) D/ T# U  Z
//修改显示内容& U  Y- ?: @  K* C: G( b+ N8 V! o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 M% M# {8 d5 u4 f" d& U1 i# U, q/ [- m$ `9 Y' p8 a0 _
4 m6 z$ @  [" }* a
////下面不需改变////////////
3 b2 v2 D. D1 ?" b. ~
# x* q2 D. S# b4 K/ Bvar copyspeed=marqueespeed. h9 O% w4 f% R
var pausespeed=(pauseit==0)? copyspeed: 03 m4 d( R! B8 l+ H6 d& R% B! T
var iedom=document.all||document.getElementById4 W% T+ Z" J5 r
if (iedom)% `0 Y8 Q* x" o: `; W! b5 {' |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): n% ~( i9 {( s& C3 ?- {( d2 h
var actualwidth=''
. m- H; ]* Z# Z6 w& m5 ^var cross_marquee, ns_marquee/ y# Z5 w4 p4 ?% W+ X+ u2 C4 k/ |

! g' v- j) g/ J1 h8 D* N, D, C9 Pfunction populate(){$ t, v3 w$ }. h) W2 {  M$ ~
if (iedom){' |0 j2 i6 ?/ m9 U) L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# X! C! A+ Z  l+ ocross_marquee.style.left=marqueewidth+89 ?, D  G% d: ^+ h# j& B$ D4 e' D
cross_marquee.innerHTML=marqueecontent
# g0 i2 [( _1 r( Y+ cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; _4 [- z7 `* v. K1 c- l$ M9 m, E) X
}$ d( }- q0 p" ]& e# U; u
else if (document.layers){: M1 L( e" P' F
ns_marquee=document.ns_marquee.document.ns_marquee2
2 z4 v0 y2 O4 ]* Jns_marquee.left=marqueewidth+8
, v/ ^; ?) a# u5 _) @2 Pns_marquee.document.write(marqueecontent)
0 W8 p- C& D% P. ?2 N; _/ ]8 m9 ^* Hns_marquee.document.close()# z0 a" |6 r; T# P: w$ p9 }2 ^7 @
actualwidth=ns_marquee.document.width
( K/ w! W. J: Q3 K' y+ h}+ c$ b) p- [, Y' s7 ^5 J
lefttime=setInterval("scrollmarquee()",20)' |& A0 E) T$ X0 H
}
) g0 G# q% O3 \% E+ |/ y& ^window.onload=populate$ |' W0 ^: C1 Q
9 N: I* p( ~9 _, P8 z: |( I) ~
function scrollmarquee(){% |! j! v4 Q! i6 Q$ e. N2 n! Z
if (iedom){9 x5 a! }/ h' ^4 T& N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 [; B" a/ S/ y( P3 y  m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* s: S: N% X0 g2 S: belse6 T5 O/ w$ K8 [, s
cross_marquee.style.left=marqueewidth+82 B( P2 D/ j8 @$ @8 h3 \

6 P6 q( d; _" k( I}
6 W/ d& V/ x0 c! T* d+ H: i+ Relse if (document.layers){
0 z- e( Y; {2 tif (ns_marquee.left>(actualwidth*(-1)+8))' Y- I% I# [8 f
ns_marquee.left-=copyspeed
+ q: w9 w6 n3 I8 K! B( M2 |1 Jelse
' W- A2 p: W4 b- hns_marquee.left=marqueewidth+8# r- q, |" A; p7 l% I% W- @
}- |5 {* Y& y7 o$ I) U* U" ]: {& x# N* ^
}
! G* x2 z4 o' E/ m8 p: _( o* R- [1 y; O* j
if (iedom||document.layers){( M& B- G# }. G% {* V3 C$ E( w9 o
with (document){
; q3 a! d& g$ X3 B) rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- O/ G9 V" C+ @3 Vif (iedom){3 e4 Z2 a. `6 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 X, f$ e% _* P7 Y' w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! a7 m8 T$ _! U+ \7 S9 twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 ^2 t6 U7 k& Vwrite('</div>')! j6 n% [5 w/ P0 C; y9 G
}
/ G- z6 k- ?- v/ {. R- qelse if (document.layers){0 y) i# }, r% m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% ?; Z3 f& ^# _( y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 R. @5 C1 m" i  X# h) c9 ~
write('</ilayer>')! M9 d, ]( K7 Y  M2 @
}
2 G: o) @" F& u; edocument.write('</td></table>')( y2 K# r& H" Z5 G+ e2 ?4 Z
}
# }3 a. S/ G3 g- Q}
+ f9 p3 u1 x( m4 H9 K; w</script>




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