返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% c$ A9 d+ s; ^* s8 i2 S' Z6 dvar marqueewidth=3003 q, h' ~& a" P& T% Q/ O7 G1 B! Q
//高度* c0 G  ^3 x) Y" T, W1 n3 N
var marqueeheight=25
  U4 U0 S+ |2 E5 q//速度(1-10)
/ T! N/ e4 D$ s  ~& }+ kvar marqueespeed=3, E5 i0 F; i0 u( @3 @; d# V, n9 |; b% t
//背景颜色( ~5 Z9 B( w. M9 c; F
var marqueebgcolor="#FFFFFF"
9 H- m( N9 }& X( y4 v9 D8 ]//是否能暂停 (0=no. 1=yes)?
& E4 b6 c, Q8 x6 M. V' vvar pauseit=1- Q( I3 J  c3 W9 R6 G( H

  J7 R/ s+ p, j//修改显示内容
/ _5 l5 t: F8 avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. `. ]" q! @  E! ~# v0 u0 G3 T5 Z
, d, s) u6 t2 k, J  M. l" x# X! x2 ^- x6 m
////下面不需改变////////////% C/ F  u# f" t+ n# N  u
( p( O$ U$ Q- f6 s, V
var copyspeed=marqueespeed
8 }7 d5 d& ]2 i$ }var pausespeed=(pauseit==0)? copyspeed: 0
3 J$ l8 d! e5 Q1 }* L7 B2 X4 ]var iedom=document.all||document.getElementById
( I9 |3 M* t9 N+ sif (iedom)! }/ r) n7 ~3 o4 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: |- P! w( t# W% @) J6 bvar actualwidth=''" R, @! B4 A, I( p, N- l, c3 h. L4 Y
var cross_marquee, ns_marquee& J( `: `, T5 @( f
$ Z4 j: n0 _' d; G
function populate(){
% @1 F; I# u( s1 Uif (iedom){8 L2 c% }/ d% x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  o$ B" Q! B) d9 h" l" Fcross_marquee.style.left=marqueewidth+8( ]6 l, X: k) Z1 ^/ b/ C4 v! v% v
cross_marquee.innerHTML=marqueecontent
" e' v4 G4 C9 p$ Z# factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 L5 ^9 z3 N3 C2 w2 ^}5 E7 a& C. \1 }: j& S
else if (document.layers){! Q- z7 I; i3 D& P0 M) {$ ]; c
ns_marquee=document.ns_marquee.document.ns_marquee2
% |, b5 d8 R1 o1 _ns_marquee.left=marqueewidth+8; ]6 Z8 @: y1 t' |- t- t
ns_marquee.document.write(marqueecontent)
$ K6 u3 [/ [! bns_marquee.document.close()
6 Q0 H9 `2 o- A# S  G8 e2 S4 _actualwidth=ns_marquee.document.width
% F7 m8 Z! A1 g) E8 f7 L; U}
  S0 c' ~! i' r0 l" m8 I! W7 a6 Y( ^. Jlefttime=setInterval("scrollmarquee()",20)
5 l6 V# t3 Y- n9 [6 @$ U' l, k}8 N3 ^- E% K. Q5 _  `
window.onload=populate/ v5 q/ J& g! h: s/ e

! ~, v! @# f) L8 H0 X5 Yfunction scrollmarquee(){- |6 o: g. F' R) C9 J0 q! M1 o
if (iedom){9 c; t( r( u; r, C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 t/ Z0 _4 N* t  v1 `$ T5 c$ h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 P5 q2 V; r6 D  {+ ~$ u
else
" q9 l+ Z- g. ^0 y1 M' wcross_marquee.style.left=marqueewidth+8% F2 H" h6 f. `! J% f! G( ~$ P/ L

1 n/ T! t; P) l5 M}+ Y6 ?1 o" R! S2 |0 G
else if (document.layers){7 M% h9 s: [6 h( Z, o! ]
if (ns_marquee.left>(actualwidth*(-1)+8))1 G& F" ?" m$ q0 ]. `) [
ns_marquee.left-=copyspeed
4 k: T# P  l: U, O6 I. Belse
' P( e& g  c' X. S7 H$ E( _6 j# j: Vns_marquee.left=marqueewidth+8
+ h4 A6 ^5 H5 Q2 i$ m. ]2 i}
1 b& B' l/ h6 ]/ w}. j: I( M3 B) @
4 T* i& l# z/ [" V0 V
if (iedom||document.layers){
) M6 u' [5 p0 {. `with (document){2 E. \  n7 ^. ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). A: ?3 @1 |5 t4 Q& E. b8 v. d
if (iedom){
+ g0 A' `0 |9 q' Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# }6 Q: n+ s6 y0 b* {" H2 vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& l9 q% {: Z. u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): Y: l; ~. f0 m! x
write('</div>')
' j! K2 i4 ~& n6 {4 K/ W2 Z/ x}; L7 G. ~' m  ^5 y) T  O7 l
else if (document.layers){
6 _5 r1 F, C$ E9 Q5 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 g( Q' F; }& O" W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) [0 }: K4 X6 a$ m0 s1 F$ f, |: lwrite('</ilayer>')% d* T% H" h' J
}
5 t0 }. Y3 f) t+ jdocument.write('</td></table>')1 q: ?% n* H( P: K+ a
}5 d/ Y( o: @0 t  U4 v/ L
}# c) J3 h$ h2 L0 S
</script>

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