获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 D& O0 }& x! H" {2 z+ S' l5 Hvar marqueewidth=3009 {1 J1 e- r+ M0 h+ J% a: u
//高度
- h% r$ G& w3 \- a) n3 ?var marqueeheight=25
- H' e! m/ g6 C7 i7 x//速度(1-10); }, B" ?% D- O6 @6 Q" Z7 ?& F( s1 k
var marqueespeed=3
0 {8 c, `% X( X9 M0 z# L//背景颜色9 G' h+ O2 L9 Y1 M
var marqueebgcolor="#FFFFFF", J0 G+ u. ?) Y0 S( `
//是否能暂停 (0=no. 1=yes)?
  \, Q' p; B5 A7 E8 ^$ Kvar pauseit=1
6 F( ^, b8 u( A- U  B- C' N' @( A2 i4 k1 F% S
//修改显示内容
: }* n2 M& p7 {7 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 l9 x$ g5 q2 Z' J( @- p! V

% H0 L! ~+ i" U# U6 s+ t/ T* ?& V# a
////下面不需改变////////////
: t, m) y- c4 p8 H7 P* f! {- i/ q- y" E; u
var copyspeed=marqueespeed
1 S2 z6 F6 i4 r$ o- nvar pausespeed=(pauseit==0)? copyspeed: 0& \+ v2 X1 X* B  v- l* h: h
var iedom=document.all||document.getElementById
! o4 t, l- }: P$ p4 ^if (iedom)
5 B+ B& @% e$ N' a) L' g2 _$ rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, Y9 X6 [! i4 }' uvar actualwidth=''
1 `: H. j0 D& Z1 D, l6 H  [( E" \; E* vvar cross_marquee, ns_marquee* l3 @# ]; v/ u7 ?2 F

( a8 ?( ~- t3 ]7 @function populate(){
. n* s& {  c9 z# \: ~  O( b- xif (iedom){2 n  ?  S" Q- x1 a+ j7 g% {5 f% d8 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, w1 y, f: E. y: G7 kcross_marquee.style.left=marqueewidth+84 f) g* C! n) ]$ w$ c/ y9 |% k
cross_marquee.innerHTML=marqueecontent
% M: }* _9 s% g* l/ ?0 N+ \$ gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. V. r, n5 ~. h- C# e: \" [}2 C( r. f% D, H# q
else if (document.layers){$ c$ N) B( M% H9 [4 d' x! W
ns_marquee=document.ns_marquee.document.ns_marquee2: g+ K7 P2 |; `" U1 w
ns_marquee.left=marqueewidth+8& n) E7 q* V: y
ns_marquee.document.write(marqueecontent)2 V- r/ O8 ?3 \+ Z7 U; X
ns_marquee.document.close()( b/ F+ m! Q! }; w/ \6 i# Z
actualwidth=ns_marquee.document.width
- g0 A4 j$ A4 ~}, B1 v9 a2 S/ l' u/ Z( ?9 ^& h
lefttime=setInterval("scrollmarquee()",20)
9 l: I0 ]+ N6 [5 L( t, k}
# g# k3 `, h$ ?. e& twindow.onload=populate9 ]' J  ]! u+ \  Q4 K
  d% t8 G0 p- D: T  E
function scrollmarquee(){
, U+ `% I9 Z: B( F6 y# l" fif (iedom){; ^  \& P! G6 `# k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): W; G: z% E* q8 {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ B) T% p" `* K- z- X. x# W6 S
else5 f( `# Z2 e8 F# t6 r
cross_marquee.style.left=marqueewidth+8
' V2 s! J  V, m! A  }7 [
7 ~" Y' z9 P8 G$ X' K0 k% {) L}2 D$ W1 k6 y6 Z3 |$ I$ d& `
else if (document.layers){
7 v2 X; N2 w/ h( }% Yif (ns_marquee.left>(actualwidth*(-1)+8))
! c3 _/ T7 j' c: I* l" ^ns_marquee.left-=copyspeed
0 `4 \- N* D% O' K" A; b. o3 qelse, U$ O* R: L, y1 s$ h) D9 W
ns_marquee.left=marqueewidth+8
2 l% ]2 P8 V. B- }}9 s2 O& [6 j" l; R& G
}& `1 R# ^2 `. i. |# ~0 k
" ?, u/ R7 {. U4 J7 k4 V! ]
if (iedom||document.layers){# R# o% u) y5 U$ h( i
with (document){
& d- p  T! x, P1 `- g" ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' `" V% w; C3 Q7 o) z0 fif (iedom){
! f9 V! z9 o  y+ R5 h- Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' O( x1 y9 V! r3 K9 H/ m( twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  n" O! H8 ?  O! Y- Z2 O. i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' [: \4 T& H. m" |$ N9 K
write('</div>')) ^- e" V2 C- r% W4 b
}) B9 t7 h$ o& d) o7 I* T
else if (document.layers){
" X+ k/ ~6 j0 u; p5 T- I. wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( w/ v, G$ L8 j( m# T1 [# uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 Q) D; N% P/ k( Z# pwrite('</ilayer>')2 r5 z" p3 ~  u/ q$ t3 G5 m
}
+ r. t0 q! \: H) adocument.write('</td></table>')
' n) U: [! u, D1 Z! h; j) r- a}
, g9 ]) U8 v- m* L}
6 E$ j2 g, q4 h1 ^9 N</script>

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