Board logo

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

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

//修改宽度6 G, O3 ~( ~$ x0 K' {0 D
var marqueewidth=300
: I9 q7 P7 E' b% ~: _//高度5 U& N8 P1 s5 n4 j
var marqueeheight=25; Y. k4 g# W% J2 q7 A! A
//速度(1-10)
( c# A, h- a& \% vvar marqueespeed=3
# _+ B$ M+ k8 O: ^7 d  v+ q% q) F* @//背景颜色( O. x4 O! x- E' e
var marqueebgcolor="#FFFFFF"1 Z5 f; {) G' O% |5 b
//是否能暂停 (0=no. 1=yes)?
3 @; @7 L: O( M. H4 X3 Nvar pauseit=1  k9 X8 K+ x  B( d
" K- P. M5 _+ {: A
//修改显示内容
$ C# N. m  f. Y) Q' w' avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 B! O  u& H7 ?7 k" g0 X) {
# ]& J/ m+ g* N. X% t1 t. v2 L- `* Q# a; D  m

  K  d/ v- |. O6 i0 M////下面不需改变////////////- P- D- ]5 i, N6 \! ]* E
$ J8 `+ S6 E8 l- G, t+ M
var copyspeed=marqueespeed2 {& ~% b' @  e- U, _8 y1 {
var pausespeed=(pauseit==0)? copyspeed: 0
% S" |5 H- w0 I" p/ w0 \0 tvar iedom=document.all||document.getElementById. ?' n5 x" J! F
if (iedom)
3 |- @$ q0 p2 N+ s1 ]. X$ Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& A( X3 j4 h, y, u$ d5 {/ U0 D4 Uvar actualwidth=''
6 S8 u2 m, t7 v! I0 d9 gvar cross_marquee, ns_marquee
7 U* U# i5 w+ z5 y+ `1 L+ k/ {: N) e- j4 }/ ^
function populate(){
, C% u+ y0 J' N$ J: o- g1 Uif (iedom){
. H6 K! [4 i, Y& r) b& a2 u7 [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% u; q: h9 A, _' x$ w$ G# W
cross_marquee.style.left=marqueewidth+8
$ ?; U; J( u9 a) C2 Xcross_marquee.innerHTML=marqueecontent
# I5 o2 x( L* _9 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( t5 G6 z+ O$ ]) P) m}* r5 d, o6 |8 x6 @5 }
else if (document.layers){
1 k* ^: o: y9 I2 p, X% B9 F& o% \ns_marquee=document.ns_marquee.document.ns_marquee25 D8 r! d; R2 F& k+ H1 P
ns_marquee.left=marqueewidth+8$ d* h' J  r$ ^# w5 r* }8 f
ns_marquee.document.write(marqueecontent)5 `) [: F" D) z7 K; Z
ns_marquee.document.close()( O& p$ U$ {# n- q
actualwidth=ns_marquee.document.width
6 @4 r) Y$ F. x/ e  @* _0 w& @}
% `/ @3 T; k, K9 o" m8 \/ v+ clefttime=setInterval("scrollmarquee()",20)
  y3 @( z9 Y( ?) O}
. i% M6 C- B4 g! p( `4 wwindow.onload=populate% u! l7 ^( R: u8 a4 ~; |8 ?$ R

& B3 U0 S* w! ~9 zfunction scrollmarquee(){
5 ]) l+ j" ^8 k4 F# jif (iedom){
# _7 w9 d! `6 S7 o9 K5 Y+ [6 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 N3 l: M! Q9 h0 Z: w% H1 @% L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 E! n+ ]8 L" g% B
else8 V! ?0 d  e% _
cross_marquee.style.left=marqueewidth+8
0 F+ k. h# z* h4 C$ s0 ~
7 `2 P$ P: U' l+ p. o}) N' b  t, J8 M1 Z/ R0 O; Q
else if (document.layers){
, G( g5 g$ N5 C& Q( zif (ns_marquee.left>(actualwidth*(-1)+8))8 _, F3 @5 o0 |1 \
ns_marquee.left-=copyspeed
3 o: o$ p; D) }else  I) |' p% P$ |& l4 O: a
ns_marquee.left=marqueewidth+8( _  `  F3 Q8 o+ B' y
}4 |0 R8 K* f9 e- b- Z/ r
}
' x& D0 B; E& I* \3 r2 R- n# Q  `, `
if (iedom||document.layers){9 P$ G9 q$ F, V1 S- V0 }# S
with (document){; y' e) I2 u& w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' Y7 ^/ [% c5 g1 X- B7 Kif (iedom){
8 i3 W2 B4 G7 J  |2 kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ `8 a, y( C5 A. Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) u# N& H6 i( L1 E) Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 o  U. n2 q  x0 F. z3 J3 c% K) ewrite('</div>')
, f! e7 \1 M/ G' \}+ q) j/ C% i/ |% F% o, n6 J
else if (document.layers){
' ]% Z( C9 i5 E4 I) r4 A. y. Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 V% o6 v' e, v7 s' O. cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' ~0 I7 z& z) D/ m) u- G- g; n
write('</ilayer>')
" a$ \2 a, v6 `7 l, p# V$ O6 V8 t3 S}
6 p6 o, `2 b. I) M' mdocument.write('</td></table>')
  I2 d) M6 h7 B% z}0 x- D, V4 L# _  o
}& [1 X" C6 j% X. `
</script>




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