返回列表 发帖

网页之跑马灯文字特效

//修改宽度& u% V) k+ W/ N' S: }
var marqueewidth=3005 k# s2 N- j2 M
//高度
6 Z/ z; p$ I( C5 I  g: Lvar marqueeheight=25
. B3 H, F/ H% @" y* Z8 _! Z//速度(1-10)4 p! ]8 o# R* O9 Z
var marqueespeed=3; T% _6 C* F4 q) d
//背景颜色- D. P5 i( O  Y5 i3 K) r
var marqueebgcolor="#FFFFFF"
  a; h" i) o1 c$ i6 A* g//是否能暂停 (0=no. 1=yes)?
2 T7 L0 r6 q: z$ ivar pauseit=1) D' {2 x* z, y( o

( `- j! ~9 i0 o3 [) ^5 V//修改显示内容
* @, \7 Q* n5 E& Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* h. h8 k' [# U2 L; n8 `* F9 v

! m4 r! Y6 F8 T; G0 E
5 {. p0 p* O4 Y7 I. }  f+ `& b////下面不需改变////////////3 A' A8 s( b- Z, x
9 [- |/ Q$ g, u+ ^. j$ b, j
var copyspeed=marqueespeed
, z; `6 }% [9 g2 @4 E! z1 H. `1 k7 Rvar pausespeed=(pauseit==0)? copyspeed: 0
! a7 `/ J7 @& pvar iedom=document.all||document.getElementById
2 Q7 e3 _( ]$ z( @) m, C; w+ mif (iedom)
8 N& m; L7 h) Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 a! X( k! d9 T$ w# S! W6 O. W# Y. D6 ^
var actualwidth=''" H% V: Z3 {4 f
var cross_marquee, ns_marquee
1 X0 w) ^% }7 W- X7 x' x
2 j5 G" L/ @0 a* l/ S6 E/ ?function populate(){/ F) `6 J3 h* y- O; A: f1 `
if (iedom){
" E1 E" j" ?$ R1 \! kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# V+ j; a" {, c9 |/ m( S- [
cross_marquee.style.left=marqueewidth+8
7 F1 b/ w$ L0 z: l. e# qcross_marquee.innerHTML=marqueecontent
& K( I( O0 ^5 ?  ^, j; N) lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) _# {: Y' ^2 b9 f! @! z5 |# F
}6 k7 F9 Q* O' y* f) g  V3 R6 b9 j
else if (document.layers){
% \: Z  ~8 @' Dns_marquee=document.ns_marquee.document.ns_marquee2
  A" L" {+ |' L" D4 Tns_marquee.left=marqueewidth+8
8 _' s) g; k3 \1 R0 uns_marquee.document.write(marqueecontent)+ a. \: {- B! x# p
ns_marquee.document.close()
/ e/ Q: l2 D+ aactualwidth=ns_marquee.document.width
1 _6 q9 d; ~' I+ U5 J, h. d) e& Z}" X' s& ^+ d1 O2 Q7 U
lefttime=setInterval("scrollmarquee()",20)
) F8 \7 {4 U5 [, h# ]& R}
$ a) Z/ P2 K/ \* Iwindow.onload=populate
1 p3 j; M$ l" _- x# H
, t4 g: m7 T: Q1 b0 j& I9 D3 ?function scrollmarquee(){
0 \( }" v( M! ~  @0 qif (iedom){; ?. |. I6 U2 {9 H- k; X. {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% y/ T* N% F. G  `6 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* z8 a, @" P7 k
else
6 i6 m! ?$ N: G0 z3 ], Scross_marquee.style.left=marqueewidth+8, o* K( ]+ ~# u* A; Q

8 d7 z0 n  v: i  O9 [3 G}: l; P* w' v) U  ?2 z3 _- M
else if (document.layers){+ t7 o. h# ^& r  f
if (ns_marquee.left>(actualwidth*(-1)+8))
; q0 h4 \! {, A, s" ~1 m! a1 Mns_marquee.left-=copyspeed
5 D: J1 w4 q; `8 p  Oelse
! L1 G! f3 r+ K8 sns_marquee.left=marqueewidth+8' M; P/ @3 C0 Z. P
}
5 P2 X: o4 h3 t" T+ Q2 _}
: |- P5 l5 k+ B) f9 C
8 c6 p- k/ u) Eif (iedom||document.layers){
: c6 x) z4 |/ B: j# O! @with (document){
0 W) r6 o( Q* Z( P# adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- [* Z+ c4 P' A; F
if (iedom){3 G. k0 r) x1 n- ?7 p7 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): s! _; G+ p8 r! O6 c- X% \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% g& o5 P1 ]( {9 ?! Q  R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ d9 |! q) r& g  B( V% Mwrite('</div>'): E5 F6 S8 u( e5 g% r' M" W4 T
}
# P# L' `1 q* ?else if (document.layers){
3 p: l& K, Z/ F3 |8 u. b9 l. m9 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! T+ B9 a; G0 m4 N7 jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( g/ `4 y" K2 N  S) s4 Pwrite('</ilayer>')
4 J2 h( C( S6 O  p+ I' u! S2 o3 l+ K4 [}4 e# Z2 P/ ^& b6 B0 V% v" ]
document.write('</td></table>')1 f) b( \8 b, z2 q
}3 l2 D' N; G- Z+ k
}
6 ~# ]9 U; `+ M5 w! ^1 e1 M+ n</script>

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