返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ U& y% f4 ^, [4 `var marqueewidth=300& e2 b' \3 h- B; A/ a3 T
//高度% m( Y2 ^* o1 \, j; I7 o7 H
var marqueeheight=25
  @3 W3 F4 O: c0 M" `9 m//速度(1-10)7 u8 y2 D7 Y- E
var marqueespeed=3# q- o2 ?8 S4 [! ]  ]( ]8 M
//背景颜色
% X, ?6 c* h( r( n( t. `+ t: Mvar marqueebgcolor="#FFFFFF"# R1 w2 g  Z% o. B' Z5 Q$ H
//是否能暂停 (0=no. 1=yes)?
6 u" v: e2 I) z  Evar pauseit=1
1 I$ l, I$ x; @
# ^3 M) S% m* V, T//修改显示内容8 O$ G. b; K  R& M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( z9 |  f0 y7 W; [% ]9 D
: j: B9 r  U8 y. ~- i! A3 |% M% }: n" ~$ o
////下面不需改变////////////
+ q/ Z% A! K9 q! n9 a: u4 ^- e$ d: T% I
var copyspeed=marqueespeed
" h" D2 {8 n+ n& s+ A4 cvar pausespeed=(pauseit==0)? copyspeed: 0( T1 N0 V1 B- m, D1 D- j# y
var iedom=document.all||document.getElementById
# W" W( Y8 X1 v5 r* Yif (iedom)
2 t  H4 g; `4 z) o6 u/ ~/ X3 \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ |: h& P0 `/ `9 p' y0 @9 i0 k3 |9 Fvar actualwidth=''
" p3 \7 m# [9 j2 o( G9 O0 Wvar cross_marquee, ns_marquee* T, N# h5 R  `' F( B% T
& c- ?! p) c, K
function populate(){
) ]* M* b8 a# l7 D+ e) L( Qif (iedom){
4 n# Z" X8 I3 _* m% Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. {/ P6 J# A" a9 P$ R0 M, G2 _cross_marquee.style.left=marqueewidth+8- B* {, M- Y6 g, j1 _8 o
cross_marquee.innerHTML=marqueecontent" T& O1 ]% j4 O0 C  L+ L7 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. w0 i& f6 C3 ~3 n
}
% D& L: t& k  Z9 belse if (document.layers){- A4 G1 k! h( C% Z% J6 n/ H7 u
ns_marquee=document.ns_marquee.document.ns_marquee2) k# g' y* [# H7 z$ {
ns_marquee.left=marqueewidth+8
6 U) i: ^' s* k! |ns_marquee.document.write(marqueecontent)# K/ A0 {5 `9 a6 f4 I( d, \
ns_marquee.document.close()
) n; j8 ^0 F9 wactualwidth=ns_marquee.document.width" {! Y8 A  f2 B- m
}% P2 p8 s6 U! r: }/ Q$ k! X( H# I. N
lefttime=setInterval("scrollmarquee()",20)" \+ \* Y+ ]0 f% B& g' s; J9 |& A3 V
}
5 C5 w& N( q7 g6 C% j" m4 x* s) jwindow.onload=populate4 c9 U  L0 j" ^1 i! Z
$ d/ Y9 v( T5 \- x( L
function scrollmarquee(){# H4 d1 I! ?! |0 }- e/ q
if (iedom){
- t) L( E# i  u3 O5 n6 S% }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 k9 o( `( u8 [7 p  D8 ]2 x; ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 G9 H0 j* D$ S) Z- d' Y
else- H) C' q' z6 S
cross_marquee.style.left=marqueewidth+8: Z0 c! D, X4 b2 K* p% X. K: F! U
# v8 W4 }1 c- h, I/ U, D
}0 G% Q) ]' o0 `& c+ v6 t  K
else if (document.layers){( X! e# e9 d( p8 u$ G
if (ns_marquee.left>(actualwidth*(-1)+8))) P3 L1 k# R3 u  x, m
ns_marquee.left-=copyspeed
9 L+ p  H3 f( s& H, n: W$ u% qelse; U  c" R, h8 i3 r1 }4 y8 Z
ns_marquee.left=marqueewidth+8
0 Z( Q/ ?$ H7 _9 D}$ z; T, B9 D! w- _2 Q- m3 ]
}
1 z" t) J9 n: i/ J! y7 P0 F/ B( w9 p3 K
if (iedom||document.layers){$ R9 O( ]5 w: @  R, r
with (document){
' [7 h& b; Z- F  G7 h# U, v% Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ e1 F4 E" d$ k; G  Z0 M
if (iedom){
1 b5 m1 a( H- Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. e9 [" R( f( u5 H) I2 vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) K. k5 ^) A. G; B4 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: j, _# e. X3 v) ewrite('</div>')/ o! r" L; m2 E8 G- G7 N8 ^
}
( f' ^% o/ P1 f: o3 |else if (document.layers){
! g) i5 I9 w5 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- @8 V- o& [& D3 s) [: j8 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* q' P. j, p' F' X0 y7 l8 ~0 kwrite('</ilayer>')
) |. [! Q1 d" [7 d}! H: x$ k% ]* W7 ~& h% @
document.write('</td></table>')3 V+ N: g4 d- v4 I. U- f7 w7 v. Q2 ?
}2 Q- [* a/ q5 x0 I4 x
}
; I& m/ {6 U" _) f1 b</script>

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