返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* T$ I8 ^8 O9 |* h% Y2 u0 Ovar marqueewidth=300
; F& O# i- Z5 i9 A4 B//高度; j( e9 n$ @+ O$ Q& A7 T% E9 P( A6 a2 [
var marqueeheight=25, c4 x) y% F- x' k9 k0 {
//速度(1-10)
: {* Z  O; L) avar marqueespeed=3
1 G; z+ A$ L7 S6 i" M5 A, h//背景颜色1 }  t6 I4 W7 r1 \# F: t2 `# O
var marqueebgcolor="#FFFFFF"
$ H2 K3 v+ X2 y8 g6 \0 g9 N//是否能暂停 (0=no. 1=yes)?
, K+ k, s9 ?7 |4 f* Ovar pauseit=1
. Z" x: {2 T" q3 B/ m) q
; Q5 k& S4 k4 x. g, ?6 w//修改显示内容
8 I* O! J( U- {- j0 xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& h3 m0 H: y( E+ [6 k( X. G' K0 O: R1 x
! Y& N4 r9 @6 ?7 o
////下面不需改变////////////! Z! ^  L( U# V1 i

# [& E5 O3 L9 @0 b0 `var copyspeed=marqueespeed
0 C6 ]1 M+ k$ _3 ~% I2 ~$ bvar pausespeed=(pauseit==0)? copyspeed: 0
- w+ K  n- X8 E& ?5 W8 [2 jvar iedom=document.all||document.getElementById0 f# d: b7 y5 Z: G/ d
if (iedom): N/ `; r  W5 l: F, h4 m6 ?) U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) t% X* c' V. g, F% rvar actualwidth=''  \* j; c, m! R8 y4 |# N! ~* G
var cross_marquee, ns_marquee6 Z" {1 Q$ l. e3 a2 i$ J1 i
  @) ~! }: G$ P  T/ j9 J! V4 a
function populate(){
0 o% D4 T9 l- u( Hif (iedom){
: P& v1 n6 A+ D; f5 f+ Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; x6 i, e6 ^4 x6 B: ^cross_marquee.style.left=marqueewidth+8" H6 C' k* `7 D
cross_marquee.innerHTML=marqueecontent
( G7 H7 D4 A  D: l' S  Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* F  _  F/ R! S8 [}. h' T7 G% c$ ^' K
else if (document.layers){4 d8 X: c2 @- i3 M/ Z
ns_marquee=document.ns_marquee.document.ns_marquee2# o  x8 u8 e! S$ H
ns_marquee.left=marqueewidth+8' _: x1 t" `4 }3 a/ A( B
ns_marquee.document.write(marqueecontent)
$ U4 d+ U* s# ^0 h9 S7 o9 k& D/ ^2 a" ens_marquee.document.close()
* N. ?1 z* J( A/ _2 C% r8 p9 d/ M% Pactualwidth=ns_marquee.document.width% U; Y9 O, {' e: O* [+ w0 T
}5 J2 c" _4 A6 P4 h; X- D: Z; K
lefttime=setInterval("scrollmarquee()",20)) Q1 ?. S) ]' u, p0 G" }
}
# E- `' ?: {' E" O, [& d4 Xwindow.onload=populate& {, F, p: n* U# e& \2 @

5 i3 S$ _3 D- N: Z4 k; c8 B# x( kfunction scrollmarquee(){
( O% v- h$ x9 M+ `' B7 {if (iedom){
+ h1 m7 D  k+ f1 O. Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# ~, p. o: p" ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 C& p: A0 L8 i  v9 Y
else+ k% f6 n. b" ]: p" G
cross_marquee.style.left=marqueewidth+8) i! Z. T2 \- Y3 K7 P0 `

2 F9 `- h! N1 T6 x}' {* N, D/ `# ]0 h2 C+ M3 u
else if (document.layers){
: ?: c6 A% c" q: }if (ns_marquee.left>(actualwidth*(-1)+8))
$ u! R. L( {7 ]& F5 ^ns_marquee.left-=copyspeed( e$ S0 W4 R, D" {! B4 _! I, z0 b5 R
else
7 h: o% q' ^6 i3 e1 u) Gns_marquee.left=marqueewidth+8  J& w, a: U# z* t
}
; J* |1 I; D! ~8 J/ y- t  C9 ~7 `}
7 c& L! ]2 w7 W1 Y! K( ?# w3 _# K" D
if (iedom||document.layers){1 D. S7 y, x6 \* W
with (document){6 p0 k+ h4 G" q- `: P% ]/ C: f) ?2 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 x5 k) }5 C8 `% B" Z. uif (iedom){3 W) Z' j- I( M" d: O) f; ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 D" {* x; ^' I  `" |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); v2 C9 o& m3 W/ A2 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 {. I0 `  G8 w, T4 gwrite('</div>')2 o& w* e/ H% j, R
}! b  N& d4 t0 V# }4 C
else if (document.layers){: o8 G+ ]9 |# e% C' N" b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% D9 `, F6 I1 I5 D) C* ~; g$ nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 Z, C+ K) b7 q$ i3 M7 owrite('</ilayer>')
5 A2 w! Z' t, Y8 V. o, a  `}; z0 H& {3 t1 [9 s
document.write('</td></table>')
4 c$ S- Y1 r$ T5 e% C  C& k, f8 t4 F$ Q}- {0 L1 ]- c1 `5 _
}" }( w: G" m! L
</script>

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