Board logo

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

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

//修改宽度4 x& j5 V! i# s" g0 W' Z- z
var marqueewidth=300
/ o! K% _3 T6 d/ `  t& O$ s8 L//高度' N" Y$ L2 O& b& N
var marqueeheight=25
1 K) {2 x3 b2 f3 V0 I//速度(1-10)
$ ^6 X9 ]" s$ I# y$ r' \3 Ovar marqueespeed=3
* q. q: ]% L8 E- t0 d! n//背景颜色
0 M0 x. u/ n( E6 F, ^% {8 qvar marqueebgcolor="#FFFFFF"
( I- s, ^3 b1 d. Q! w9 x4 v/ ?, A//是否能暂停 (0=no. 1=yes)?
0 n, t- T+ a) u& u2 p7 L) I; Ovar pauseit=1
+ U( f! Z# V, I% Q
+ v8 w; R- }7 K- c2 M5 N6 x' j//修改显示内容
0 M$ z( I; r1 O2 x+ K1 Y* cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% m: ]& F, }: q. m
& [+ Y8 }2 _+ D, Y
+ b( V5 M1 ^$ b  O& m////下面不需改变////////////
8 E( P. @& w. Y9 n( Z6 G/ M$ Q& h- Z- r( y5 b. m; i
var copyspeed=marqueespeed
" Y  y" N/ G9 e0 |; ^; F% bvar pausespeed=(pauseit==0)? copyspeed: 0: `9 K7 h' l' L) Q4 [( |
var iedom=document.all||document.getElementById: r5 Y! U* C" A6 H4 C. u/ q$ O
if (iedom)
: I/ x# P. g1 T; Z" H7 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ K& M8 Y5 p# R  ]7 h: V( A  S( ^var actualwidth=''
/ z. L# d# `8 h- a& W7 P6 G" e, ~var cross_marquee, ns_marquee0 d6 [: p1 F) P' b. f) z

4 f( S! s' h" G7 nfunction populate(){8 |4 O% [9 V/ p5 x0 E8 d9 W
if (iedom){
2 g8 W' j; X. t% d  ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 C+ M; I! u' T* t9 c3 j0 [cross_marquee.style.left=marqueewidth+8  h3 k2 W& [* ?! h9 t  t
cross_marquee.innerHTML=marqueecontent
4 T5 J' a. E( U* Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& V0 R4 z5 D2 y  P3 R; A9 M}
, q9 P/ T7 y- B4 z/ Ielse if (document.layers){
6 Z( c) O+ q  B7 z; c- mns_marquee=document.ns_marquee.document.ns_marquee2
+ B" |. f8 ^8 Mns_marquee.left=marqueewidth+8
& K5 _' H/ b- S0 o6 r8 g, j: A. xns_marquee.document.write(marqueecontent)# Y5 P  }6 }- n/ b" s$ e
ns_marquee.document.close()
: Y0 J, ^# z' K( q; O$ O2 K% Yactualwidth=ns_marquee.document.width
) Q2 T3 V& \5 K# \; x}
4 i1 S/ p. h( K' |. ?% _& hlefttime=setInterval("scrollmarquee()",20)
) ]) m9 p1 a" }8 u, w}
) J1 D' X9 X  |0 v+ P1 _window.onload=populate0 p+ {# V$ {2 A: s* T  x

& E+ H; C7 e% P+ |# r* ifunction scrollmarquee(){, U; V" z9 ?$ m2 d
if (iedom){
1 t4 f' \3 b" ?+ y( sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" V6 j; W# V& p- |2 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! j4 ^# _1 V! \: P1 J2 n, j1 S9 X
else
! Z* [( C; E: g5 g+ ?cross_marquee.style.left=marqueewidth+8
7 y8 a+ r6 s# M5 g/ c
' E' e" x) W, o! w& p}
+ x; g& R8 Z$ Z% G/ Q& Qelse if (document.layers){
' G! `% n* ^5 V' X4 v+ U' xif (ns_marquee.left>(actualwidth*(-1)+8))
) v5 b$ m0 y7 I* x5 ~% a0 Hns_marquee.left-=copyspeed1 F1 {( j; `8 Q& ?( d( L) u" ~& z
else( X( F3 v* G( q( a  d! n
ns_marquee.left=marqueewidth+8, l6 a# F; B2 A
}
$ [. J, E- G# V. j}! t: L' E  h# O% v+ R- O
9 c7 D7 w  H. p1 Z1 d' @
if (iedom||document.layers){4 ~& r; h( N$ d) K
with (document){
9 ?1 c4 r% o8 `8 ]+ z  I6 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 J4 ?( ~) H  D/ l9 nif (iedom){! _1 l+ Z* |) ^: w1 [0 S: y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 Q+ `( [/ n( Z- u$ @7 x$ y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ z2 c: L6 H% R! ]9 I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- y0 [+ Q/ ~2 u' [% ?: P* _write('</div>')
/ y- q' C! L: u4 [' L! W}
% |3 R6 A/ }$ u: v; L+ Jelse if (document.layers){2 C5 I% B! F4 Z0 ]0 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 @  S& E5 k- [: H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: c* E$ q7 A0 M+ @# @0 M+ ?* Ewrite('</ilayer>')
/ R7 Y0 O  Q  Q8 b}: ^: Q# `) K) q, W# e, U
document.write('</td></table>')3 M& i! x: w9 B" Y1 V; X; i
}5 {' C6 F2 Y9 J6 i
}; x) `5 G6 v5 P1 P: T4 a5 O
</script>




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