|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度; Z6 X# _; t6 ~8 ^7 m, e# m' @7 U
var marqueewidth=3003 @0 i3 e" m" B3 g
//高度, ?* G& [6 d! z" e: x+ i8 X" c
var marqueeheight=25
) F# W W" Z' c n2 F//速度(1-10)- `0 t- D0 k) u; I0 @: Y7 R# A3 N
var marqueespeed=34 [+ {3 v7 g1 ^2 b9 {* ^
//背景颜色2 y& t# F! }% B$ J% g# e# Z
var marqueebgcolor="#FFFFFF": f6 W0 Y( Z% p/ P& [
//是否能暂停 (0=no. 1=yes)? _# _; z% u! Y! J: \5 P
var pauseit=1
0 Z; T$ l! c1 V3 g( A1 a
8 J" P" M& R/ s- M2 f//修改显示内容
4 s) `% Y2 N# b8 X2 g- ?9 N4 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 m4 \7 Z' T- ~
. [; ~. i9 x9 M- e0 B. ]+ V3 t+ y
. ?7 ?8 J9 e0 u* p3 ]3 n////下面不需改变////////////# G* F3 P `+ \: W. o! g# N0 u a4 E
! o9 B+ A: t2 j; F0 v& y
var copyspeed=marqueespeed% K+ T- {4 G( m3 k
var pausespeed=(pauseit==0)? copyspeed: 0
$ K5 ^: C+ o1 a. Rvar iedom=document.all||document.getElementById* n9 v* G' u' i$ L! X4 ?
if (iedom), t8 B. M& ?/ c8 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); C. f' j h% Q8 ]6 s7 I
var actualwidth=''# g% s% A% l: m
var cross_marquee, ns_marquee
7 e4 \9 g" w9 L6 S- N/ G# f0 Y4 l" Y2 r; b0 l* k
function populate(){
9 y, k. A: O$ mif (iedom){
. [0 F6 |0 k. i: d- y- ^4 m Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! r) s- G% T$ }7 b+ Z: [6 jcross_marquee.style.left=marqueewidth+82 k. E" x& k7 h9 s
cross_marquee.innerHTML=marqueecontent, |/ ~& _3 D- c7 F% `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 [/ M0 `! N# ^$ O}4 X; g" M1 u+ h' ?: f
else if (document.layers){
9 ^5 t1 _2 J7 e) {5 Q% lns_marquee=document.ns_marquee.document.ns_marquee29 J9 s) A" ]# x7 o- ]! Y
ns_marquee.left=marqueewidth+8
/ V0 p& P; J. M6 |: D; J2 D* Tns_marquee.document.write(marqueecontent)) b& F& R5 S; A' A
ns_marquee.document.close()
8 {, b. J7 r G% p! q1 O# j% ~actualwidth=ns_marquee.document.width
# m" f% \- u. J2 A} f0 F( ^2 E3 R1 l
lefttime=setInterval("scrollmarquee()",20)
- v/ C# }: m! K8 [* y}
4 B6 q Q2 s' R: t& Bwindow.onload=populate
* ]" w" }* K( k' a5 V1 N' B$ a1 K8 |% K
function scrollmarquee(){
* S5 ?: M/ f7 zif (iedom){4 z" P" h2 |. c$ i+ p6 e) y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- {- {& q( n8 b* h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* B! Z, \' \* N. {else
2 b6 d4 M3 k1 D k. u" u, C" k( Ecross_marquee.style.left=marqueewidth+8
% t5 y: A$ P/ |" T) C, e( V; U5 V! w
}
; b9 b/ X( { F# X. }3 z. ^( z9 telse if (document.layers){
. v' P/ [5 R* O- a9 a2 O3 eif (ns_marquee.left>(actualwidth*(-1)+8))% Z4 g0 x9 w9 U2 E
ns_marquee.left-=copyspeed8 t, @ x9 ?( `5 p* p5 ]
else
, _" V* A7 ]: vns_marquee.left=marqueewidth+8
2 d. O- \* M# q. b; H}
- n1 C' z. f7 ~5 ?( w: j}
2 o9 t& r' V4 y" b5 G r
! m% q3 T( `5 `9 U! ?if (iedom||document.layers){. Z9 W0 @) U# d. ~# O, w; r
with (document){
7 ?8 Y+ f: ]& X: p1 ]' D+ g5 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
\( Q- F ?3 r" ]. f9 ?$ t5 @+ rif (iedom){6 e+ ]& z3 r( I6 F% X0 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" e2 l$ ]4 A3 y7 q2 z& hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 ]7 T% M6 O4 t% L9 S+ |) h7 |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ p4 c. ~8 n3 @6 s8 W1 B+ h8 Pwrite('</div>')
. q5 q* h8 h6 U+ f: i5 S2 z}
8 q8 t! \! z4 l4 @5 Aelse if (document.layers){# _, h+ u, M3 x9 t T3 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; Y# E0 a5 U0 k5 f2 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 V. m/ i1 A2 P6 j
write('</ilayer>')4 w+ o/ M4 i$ D3 o) A
}
+ e0 _0 P( h6 B! W- R: ~document.write('</td></table>')
/ |; m+ G2 m' M3 c}
& w7 e3 u1 b! O" ^# l}
2 W5 _8 e& f- T5 y [! B! v7 I</script> |
|