返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 [' W* C; [+ m' evar marqueewidth=300
6 }: [  d# [5 x4 I" {+ V//高度
) C- t! u3 G4 F, O8 a' O; Ivar marqueeheight=25
( ?5 g* r/ P$ k/ ^, e//速度(1-10)
7 X. K* X  m! F) I! Evar marqueespeed=3
+ Y, F6 s- k2 L( \, F" ~//背景颜色
/ ^; }# R8 ~) V1 l& a* I$ ]7 mvar marqueebgcolor="#FFFFFF"
) y8 x- ^, ~! A* U//是否能暂停 (0=no. 1=yes)?2 d  s  B1 M* J
var pauseit=1
' n' X, C5 v: k5 A. n
+ _4 k. Y+ ~/ H1 b2 ]/ \//修改显示内容: u2 _5 R, v, J; M- W3 g. e. K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. L2 x3 ]: d  j# |
% M4 C0 c: f, @2 R( j9 r( ?, j) `6 P7 Q6 u
3 @# @6 n* t6 _( X1 {0 d
////下面不需改变////////////3 \% i+ l* b" D# b' A9 a$ P

- ?, j5 l; [* H; V! Z. Fvar copyspeed=marqueespeed
3 d/ W. ~1 v6 `, s# Y* m6 lvar pausespeed=(pauseit==0)? copyspeed: 04 S) u1 z" Z3 @. m) M! g
var iedom=document.all||document.getElementById
9 X6 _# `0 l/ j. f. ^if (iedom)
, o2 l0 g: Y2 c( p* s- m0 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* w; _: S6 a/ [0 A6 Evar actualwidth=''
9 c3 p4 g- y9 i2 k$ }var cross_marquee, ns_marquee
4 ~  H! Z! ]/ m; a, ^( X' \" H( T, c1 ~2 p, X
function populate(){
2 G& e: Z* F* i/ P% K4 m9 o! x, iif (iedom){0 A7 Y7 o- G1 s6 Q  Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! {5 k* @4 S/ z( t! p
cross_marquee.style.left=marqueewidth+8
7 S3 s. J8 Q* U2 q! Mcross_marquee.innerHTML=marqueecontent7 ~% E5 r' p0 \( ^( ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: c  ]( o  y6 [0 F6 J7 a
}5 M3 F  \! O% P% y* X
else if (document.layers){9 t; @3 a5 C; H9 Y' g, p0 X1 M
ns_marquee=document.ns_marquee.document.ns_marquee23 R5 S7 @% H$ z( ^
ns_marquee.left=marqueewidth+8
4 k7 ]& {  j$ ^2 w# D2 I9 ?ns_marquee.document.write(marqueecontent)
2 Q! l5 r. }/ @) Mns_marquee.document.close()
4 P# |7 b$ [' D' V! dactualwidth=ns_marquee.document.width
. o( p* r# Y: ?}
# @! I# t, H8 _lefttime=setInterval("scrollmarquee()",20)7 J9 d" ^$ `% c* T5 y5 I# s. A
}
' V' ~3 m4 v4 `. swindow.onload=populate
1 p; b( P8 q8 t6 ]0 ?" L& x+ q1 _2 }. Z# O% B* @( K( Y' e8 J, T6 @
function scrollmarquee(){
7 c5 f! W; k- F" Q1 y+ F8 oif (iedom){% v+ y' P3 J. Q) D+ ~7 s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- ?8 B2 h/ p) J+ R7 S, vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! H4 P- d. L  \! |( A7 z4 F6 I
else
( U" M1 j7 t% a0 Rcross_marquee.style.left=marqueewidth+8
1 A5 m1 o8 z( j. G# D5 d8 A+ R% X9 N
}2 M3 I; u+ C, G; t, w& M
else if (document.layers){, J% C. w8 `3 i+ P) j
if (ns_marquee.left>(actualwidth*(-1)+8))' U3 O+ ~! [6 z# K) W
ns_marquee.left-=copyspeed
2 @7 Q$ i& T$ jelse
( r# Y# T( _" Cns_marquee.left=marqueewidth+80 V# U( V* r" j' Z4 V
}
) z% r, z: _3 Z8 P6 G7 Z2 p+ f2 G}1 |& L3 L+ B% w  `. C4 o! U7 P% I
# U4 H7 d& y/ k+ ^8 G0 Y" y
if (iedom||document.layers){9 ?" K$ Y7 y/ z' Q2 n5 M, b
with (document){, i2 @$ Z  P0 A: P( P1 J% j5 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ E# \* W- l/ N3 eif (iedom){
# P1 O5 k- b7 y& _. ^% D" a0 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" o& h" ]2 w* Z- Z) X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 P+ Y% C: R6 }. W" K- n. _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 i4 S: u9 U# T8 [write('</div>')$ x) |# U' q  M5 Q; t
}' j+ @4 i2 Z" t5 m, k3 C
else if (document.layers){
2 }  H1 P) U5 T( Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 g- e- z. J6 Y. J: |  ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& [2 }$ S- w( f" t7 w: k
write('</ilayer>')3 S" e2 C0 k' `  {# a
}
7 x. a$ A4 T' y  vdocument.write('</td></table>')* E% [7 k2 j" d) S* G! h  }
}
3 t6 C4 N$ ^& z. V* Y) B- _}3 }( R, X* F3 W9 P: }( z( Y) K, F
</script>

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