返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; b+ s/ k" c: o" `var marqueewidth=300
6 Z3 K- A5 b, {( L. U5 Z, }//高度
8 Q* Q  Z4 E. x( A' ]1 V; Fvar marqueeheight=254 A$ c0 r7 n3 C
//速度(1-10)
3 D; G4 }6 b1 U. w, Tvar marqueespeed=3
7 k) V7 e3 W  k" `2 N//背景颜色$ w1 k/ F9 M. w" c. S
var marqueebgcolor="#FFFFFF". i6 W% p6 c2 Y: \& A' S6 w
//是否能暂停 (0=no. 1=yes)?) b% f: Q1 L. T( L9 h
var pauseit=1
9 h) j$ N6 q" H( P' k. Z0 [& s; ~) Z0 @5 L
//修改显示内容
: w4 I4 A. i; b7 P; O9 R2 l  {: b/ `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': m  o, A. v$ p- R& B: b$ ]

6 D6 S4 A& I- W5 ^: f/ A6 t0 H
8 F7 X) X2 i# M; ^! L5 z////下面不需改变////////////% q/ Z& j: k7 r7 _8 ]1 n, p
0 v8 T* W, w; |5 b- p
var copyspeed=marqueespeed
$ }  w" A0 g2 V: |3 R; Avar pausespeed=(pauseit==0)? copyspeed: 04 u2 z% {; f3 G9 z$ ~
var iedom=document.all||document.getElementById
% s( N% S1 i0 B. ^0 L$ Qif (iedom). c9 F# R1 I# Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 I0 d$ L- E# hvar actualwidth=''
  o$ f8 B0 D# F5 hvar cross_marquee, ns_marquee# M* D0 r2 \- D

0 C- C2 G6 t$ O) Z2 mfunction populate(){
7 s1 Q0 }5 c' P7 T8 Vif (iedom){  p. l3 j$ v8 H, o$ i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 j+ M6 w4 M0 X9 g, l3 B
cross_marquee.style.left=marqueewidth+8
: k5 h6 Y9 r  `5 f5 x) scross_marquee.innerHTML=marqueecontent
  ^9 }  s: d1 u+ J; N" Y$ Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 U! [- G$ A8 ^6 m3 ?8 ]" |1 |% b3 D}
. A8 s7 H6 e2 J6 p7 F1 l* Pelse if (document.layers){- g8 T2 J+ y- ]) U5 |
ns_marquee=document.ns_marquee.document.ns_marquee24 A% E$ b' D* x; n7 i; M9 q$ R6 b
ns_marquee.left=marqueewidth+8: S& ^& [, Z! L# I) \  b
ns_marquee.document.write(marqueecontent)9 S* P1 Y# B2 m# E0 h
ns_marquee.document.close()
. s% j) b0 l8 Z" Uactualwidth=ns_marquee.document.width
; A! d; j7 a0 a2 W# ^}% D& _& e$ i5 P0 _) _8 d
lefttime=setInterval("scrollmarquee()",20)
( z9 }+ E1 G! t! S7 E7 |* z}
1 B3 Z/ `4 d4 D8 w) s. Hwindow.onload=populate  ]4 I. }* Q% i4 @- Y/ Y: j

9 V2 U# i1 }: k" g! R+ Wfunction scrollmarquee(){% X  a) _4 H9 f1 R9 o
if (iedom){' g1 P, s4 e  N# M: g$ W' i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 l3 X3 [1 U& {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" U2 T) o# O6 y' eelse
3 i3 ~) u: c  [! L4 ^cross_marquee.style.left=marqueewidth+88 g) ]  a5 t5 {. I" R
+ P: W# G8 ^3 x$ M( b
}+ t, a7 W3 D; Y3 U
else if (document.layers){! j0 ?2 b7 g# P3 v+ I
if (ns_marquee.left>(actualwidth*(-1)+8))" K* a( Z) B- B4 g
ns_marquee.left-=copyspeed, K: L0 |) {+ n
else
: X2 X" f: q; U3 v0 g# B! }$ sns_marquee.left=marqueewidth+8
( ?  M6 _: d9 w# b}
8 [" c' I: J# ]. C3 |3 H  O: A; \5 a}" _; J8 ?; {2 F" V& e2 X5 v
4 z) w, h$ x/ l- E( x8 D; [/ h; C
if (iedom||document.layers){5 Z# _0 h* {" e/ V2 c
with (document){2 o( Z! L% `6 s" C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ x& B( ~' W7 b3 s& V, e/ L
if (iedom){
0 D2 y& N2 _5 h- F5 s. S; {. Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# W2 _' f' ?! |6 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; T$ d0 v1 m# O. qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ `3 A$ f: H3 C" ]
write('</div>')
$ H) d9 a; r1 F, ]1 G$ ]% e}
% k; h2 k0 @9 d1 f/ p- {: ^0 N$ telse if (document.layers){
' {0 O% c* p4 [, Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! e+ V* S' u$ o! R4 Y7 ~( \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ E) b) e8 w# h' G, b( n
write('</ilayer>')
* R% l% B  N7 Y3 W+ }' e}
, s5 K# K- X0 m7 p0 fdocument.write('</td></table>')
1 p, W" e! K7 I5 j7 @  x' q- K}! q4 [% r* O! f+ n9 u
}8 O7 n0 G2 V/ m5 S6 r8 T  q7 u
</script>

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