返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 Z7 z) E! S& j( @; u3 I
var marqueewidth=300
- l; d2 \' [3 M$ g: O+ K. j//高度
6 e( |* z# v2 b5 r! \1 {% }- w- lvar marqueeheight=25( @; s! Y- l( @0 `9 t
//速度(1-10)1 x) x, I0 x( }; @0 m7 H( G
var marqueespeed=3
% [; o- q' t  Y3 N2 ]: n//背景颜色
% ?- B6 |3 C! g+ L5 z7 vvar marqueebgcolor="#FFFFFF"
* U8 F8 M# V# R//是否能暂停 (0=no. 1=yes)?7 w5 [8 s; i& Q7 g7 j* Y' d9 o
var pauseit=1
: i7 H& S1 P- A5 W& F# L6 z
; i- C2 }: E) a, P/ Y//修改显示内容" X8 Q4 a: \- t8 K( l+ A! M$ y5 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% Q+ Y) T2 y# Q. h% d8 [

- D9 U3 Z. K( {7 D! Z0 D( l
  X- G2 V9 s6 S////下面不需改变////////////
3 }2 d& ?2 i; @* q1 D: C  S& ?, j2 i9 E8 Z% o
var copyspeed=marqueespeed
( g6 l, ?  R* u4 N# ?+ U* zvar pausespeed=(pauseit==0)? copyspeed: 0
- m: {. O9 D4 J4 a0 Yvar iedom=document.all||document.getElementById
. y7 q; K- p* Q: f; ]8 z) k5 jif (iedom)
# r$ D1 Z. j2 S1 A6 L. n( [$ hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- t* k: k/ w- |, Z2 Y2 pvar actualwidth=''
& F9 i; ]( O4 F/ Fvar cross_marquee, ns_marquee
* V+ Q3 S( W; o& C, a5 D% `( v7 P8 n: i8 x, Q$ F. G8 q
function populate(){
0 ]% z% U. s: L5 fif (iedom){
; B- v: |( G! pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# n" S1 D" `  ^" [: ], j+ C6 W
cross_marquee.style.left=marqueewidth+84 ~5 b( l4 X. X- H3 w& q
cross_marquee.innerHTML=marqueecontent
" |) |/ {  j  v4 L' zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! ?3 @. C7 c, Z# ]1 Q& ?
}
8 H/ }2 h  e* U- a* welse if (document.layers){# l4 \3 P, y) D0 n) O( F2 @8 [
ns_marquee=document.ns_marquee.document.ns_marquee2  U/ m1 [6 R+ h1 m5 r; y: F
ns_marquee.left=marqueewidth+8
  C$ x: |) u+ {+ `" |ns_marquee.document.write(marqueecontent)3 v2 B7 \2 w/ t9 M2 Z) U
ns_marquee.document.close()( m  ~3 \" j# k
actualwidth=ns_marquee.document.width7 ?1 i3 u" ~. X: I, D% V- w0 y
}
  k( G$ a3 N6 h) B9 d' D# p3 e4 jlefttime=setInterval("scrollmarquee()",20)% f# C1 g- |$ A
}
3 y0 s+ ]0 V, m; f- P+ w1 O" pwindow.onload=populate
( l- V  O, f# X7 l& [9 l$ \+ F8 n
function scrollmarquee(){
5 @7 ?, f: ^9 F4 q* i  o7 |1 S5 dif (iedom){
- q: R1 |- M! f5 A2 g5 T( `% gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* r( G7 {1 N1 b; Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% M( G6 t7 K. ~; e# c0 |5 N# c5 ^' Lelse
$ m* J4 K5 G( V% Pcross_marquee.style.left=marqueewidth+8
0 @" g* ^. ]. x* k: m; w- g. O
' T% B3 e( r: z* f7 p) Z8 K}
% J0 a! I0 ^) Q' jelse if (document.layers){" W$ V! |$ J  ]! Q, ~9 u& M0 {  i6 g
if (ns_marquee.left>(actualwidth*(-1)+8))
8 }/ x/ [. z* y0 k7 F) w7 i* G6 Uns_marquee.left-=copyspeed: \) |% r+ N0 C- ?) V5 _6 [
else
  h; c& y9 O' |5 {; Gns_marquee.left=marqueewidth+8: J. G% D* Y2 d
}
' z3 {( B& Y" |, h}
9 G' M! A, o- x4 y# Q/ d( d8 I3 Y1 i8 J* |. L4 d9 ~
if (iedom||document.layers){' ~# s! O! ~! g; p/ g
with (document){
% v) Q; ^) v' h  ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* C* n6 V& C* t7 l
if (iedom){/ {/ n! g( F1 |, k1 R* f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ z  }% F6 o% `' I' H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). U' H4 M2 X; ]6 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& }2 H; G( \- {8 U( A& M; f  L: C
write('</div>')
& n/ ^2 q3 M) F. |}/ v% p. U1 i; i
else if (document.layers){8 O& J9 A, f6 z. |, e; L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 R) x5 E. z2 A6 I; V% A  F% Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); b" D( H: k( M* c
write('</ilayer>')1 S$ F: A3 S4 z6 q2 ~: C! s
}
; |1 f9 L- c6 C; [. \4 Q. B$ o1 Tdocument.write('</td></table>')8 K; d  F8 U$ ?2 N: a
}/ r3 A$ B5 U- d) |* h, t, h
}
+ O- e7 n% t+ |</script>

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