返回列表 发帖

网页之跑马灯文字特效

//修改宽度, [( L6 t2 z6 x+ T3 C
var marqueewidth=300
, W/ y' H: l' D  @1 K* }$ o//高度/ Z6 P0 `8 ?6 T2 c- @
var marqueeheight=25+ t, F2 W' A6 F! D  H7 T; E
//速度(1-10)0 x; l8 Y- p3 O% r6 o) V
var marqueespeed=3
( ]9 }$ d9 c5 S//背景颜色% L0 r" I& {: t) S. c
var marqueebgcolor="#FFFFFF"5 |" l+ k' w7 z/ G$ }' Z* \! T
//是否能暂停 (0=no. 1=yes)?
4 v; i/ S. {) ~- ^8 @var pauseit=18 q. |+ U. m- E0 K3 E

# I) L$ j* I1 ?//修改显示内容) _- W. x* R+ X, }  x5 G1 c! a5 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 m5 d" F0 ^; _; P  R4 ^  W+ l/ ^8 G& }

. E( x; N: D! t3 N! ]////下面不需改变////////////; x8 @( K- F# F; q+ q. O1 W
+ r9 ?. \/ a1 @. i2 t
var copyspeed=marqueespeed
9 J; l, p" |; x6 \+ g1 tvar pausespeed=(pauseit==0)? copyspeed: 0
, E) X) w2 z! g+ cvar iedom=document.all||document.getElementById
3 u  q* a9 Z4 O; |9 L# e/ Fif (iedom)" H( O* Z+ p$ c, H9 {6 i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), M* Z' V. e  ?! U
var actualwidth=''
9 H$ U4 w- D2 ?7 w  [- X) x) L0 h% b% Svar cross_marquee, ns_marquee( ]  j- Q& `9 u, O) j8 h: x
) n# _( F! Z$ \' I0 b
function populate(){
: J2 ~' }: @. P8 G, hif (iedom){6 b8 I' }& Y5 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 a. T, Q0 {4 C( n- s5 R
cross_marquee.style.left=marqueewidth+80 C* ^: e1 K+ H! @
cross_marquee.innerHTML=marqueecontent
& E& n: d1 `. T! D: I# [5 o$ qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& E% s0 B% \6 X' p}
1 u; c# @. `" |8 `& x$ jelse if (document.layers){
0 x8 V! g$ u+ U; A' \5 {ns_marquee=document.ns_marquee.document.ns_marquee2. a7 L5 V6 d: V5 j# x7 e% K
ns_marquee.left=marqueewidth+8
$ v1 w: o2 e% ]( T- xns_marquee.document.write(marqueecontent)
* `* E1 j, h& J! q( l4 Gns_marquee.document.close()# \$ d0 u9 c  E3 n( u* n
actualwidth=ns_marquee.document.width. g6 O6 n0 q. q# f# u% Y7 b
}8 K" u* b0 z& {! L
lefttime=setInterval("scrollmarquee()",20)
& d9 L) a7 ?  v}
. ]/ W% U+ G' j  Iwindow.onload=populate
6 F5 b9 l& D8 l, A( k3 k9 D+ w3 ^& b9 t) ^- Q3 ~" w& e
function scrollmarquee(){
. l6 b" |( ]: f9 w  {if (iedom){
. p1 J: V7 r. B7 ?* |9 C% f/ Y8 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); n9 O% _+ ^5 g7 o  c- C8 G6 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 q+ \! `7 s' c( X. b/ Q# m$ _else' B1 |! B: c  o. t
cross_marquee.style.left=marqueewidth+8: p5 p1 h  {4 }, R

% e  l( H2 M7 r! ]# R1 N}
1 j& E% X! D. e$ q9 t/ n$ o) ]# ielse if (document.layers){
6 l% d) ^6 o" a4 P# Qif (ns_marquee.left>(actualwidth*(-1)+8))9 |6 Y6 |% k% @/ M
ns_marquee.left-=copyspeed5 b# f( f% P& Y! [. }" M
else
/ }' n" b; [  E$ Z& hns_marquee.left=marqueewidth+8& h5 N& ^. [" I3 G
}
% i: m9 C; v9 v" d) [4 U- Y1 C4 ?}8 v# b1 C# z* g/ ?$ Z

7 H3 }- a) Y% Uif (iedom||document.layers){
0 d4 M; {# M4 g/ a4 Z$ [, X( O0 Gwith (document){
. s0 h' m. U+ J) sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ y1 s3 x" \# }) p0 kif (iedom){2 k" g" T$ L% z, [4 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! W* x0 y( ]0 F: O' r% c4 r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- [1 Z) t4 K) ?/ f& m3 [- Z! @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# ]1 t8 g( C2 O6 s$ y! {write('</div>')9 E+ r: O, D' G) a/ A4 t$ C- L! }0 o
}% f. c5 ]: A# j8 K. |( s4 [% M2 G! E
else if (document.layers){' [+ A& ^+ J3 i/ z5 X- M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* m" J& Y, p* x6 T% @, `+ t! E1 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) Y; c! }& h! B, c9 T# p$ n
write('</ilayer>')
6 k- n( F2 M7 X  {+ V0 |& Y}9 Y0 I2 ]% I: Q- f4 t+ T# F8 X
document.write('</td></table>')
" w" n/ V1 }* }- k" M}$ }4 D+ Z' `% x" v
}+ A. q1 W; t3 m, T) V% e
</script>

返回列表
【捌玖网络】已经运行: