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

|
网页之跑马灯文字特效
//修改宽度
3 Y1 t7 r7 C* E0 j. Vvar marqueewidth=300$ G+ S8 p+ p+ x
//高度
$ T2 x2 n+ ~/ S. d$ @4 L, jvar marqueeheight=25
" k" Q- X- G- V. R4 k7 }//速度(1-10)
7 V; w4 {1 h' [9 cvar marqueespeed=3
: }1 I0 N S; `//背景颜色
$ o( n; }( Z; V7 z! s! Y1 n. c! Cvar marqueebgcolor="#FFFFFF"
- U H; S/ z# n. b. b( n" d//是否能暂停 (0=no. 1=yes)?
* x. Q' O1 D/ p" kvar pauseit=1+ o7 O- q8 ^) ?, q" J, D0 u& C3 ?
1 E, Q9 h5 Q' s0 Q9 U9 s
//修改显示内容
; ?# e! z# R I9 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 K, l* U; X( @$ H' h, o8 }4 i
% g" N3 s- B. ~8 C
5 S. l+ s' d. h( z
////下面不需改变////////////) ^# V7 d* p. m
! W- p2 u. i. ovar copyspeed=marqueespeed, I0 U; ^, Y. G0 c
var pausespeed=(pauseit==0)? copyspeed: 0
3 {8 T) |& f. W+ T+ F. e& r7 F, K3 a& tvar iedom=document.all||document.getElementById
* N, x9 l% h r$ T/ S1 Z4 `if (iedom): E' G0 U# o( p: X4 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); y- p# n- z J/ X0 o7 y! O
var actualwidth=''' V# @& o" b/ g. x2 @
var cross_marquee, ns_marquee- p$ l. J4 e2 @9 x' _% t" X' y
% f: S! l# \% ?0 b8 H( X1 D% wfunction populate(){: r1 V; n s- n
if (iedom){3 I! w/ }, P5 A7 T, y5 G# X& A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 V8 U+ K7 q" }* k) y- x2 S8 Ycross_marquee.style.left=marqueewidth+8! Q5 `- f4 F9 i3 X; a x+ T* R, a- @- Q
cross_marquee.innerHTML=marqueecontent
2 R' N' S& F% t' x. t* s: uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
P! V: m5 P, e1 K}1 F' H4 _- Y8 g
else if (document.layers){
: q$ I) c$ t7 ~0 l6 f! ]3 ?ns_marquee=document.ns_marquee.document.ns_marquee2
/ |& W% D# q3 n4 D$ Dns_marquee.left=marqueewidth+82 ~- o3 n; s3 ^
ns_marquee.document.write(marqueecontent)
) k( w% C+ G0 ^% kns_marquee.document.close()4 [1 O- N, q0 {# I1 n+ u1 T/ Q
actualwidth=ns_marquee.document.width9 E% k& b8 t5 ]! Q+ q; `0 u0 N
}5 {% _% p% Z- n4 \
lefttime=setInterval("scrollmarquee()",20)
5 Y$ D; I+ ?. u0 V+ A}# J" | A; k( r d+ R
window.onload=populate' I8 B1 X+ N6 B' M7 N( S' _
, @2 v3 m3 t1 i; Q" Y
function scrollmarquee(){
# w. [+ x U8 _7 P; I7 ]; hif (iedom){. F4 J' ?* r! E; u2 d5 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ f5 x* G- D4 [$ N& S8 r3 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* M# z, L. q. E& @% ^* }
else
8 ]8 b3 P$ P/ M7 t7 {cross_marquee.style.left=marqueewidth+89 F' P( c4 ~0 n4 u
{$ Y X# N; V0 B}
9 R: M, i/ B2 e& relse if (document.layers){1 r1 l; G; s' o& b8 o7 q
if (ns_marquee.left>(actualwidth*(-1)+8))9 W, L' u' C, ?" M% H
ns_marquee.left-=copyspeed
, a3 o1 T- R% M% y) w5 v7 {else
. n( S4 G5 x% U# @1 x/ ?ns_marquee.left=marqueewidth+8
- d0 {3 T4 }2 U5 o- {}1 m: B- O3 p$ Q m
}
# r+ R6 Q* u; ~6 M4 a2 ?% [* v% H
if (iedom||document.layers){. s" }( W6 B9 m) ]9 d
with (document){" g/ C/ n( a S0 L3 |0 H; ]2 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 q$ `: }! g/ g9 R, [if (iedom){- S) W) ~. A" w5 J0 K7 G8 Y" k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( x( w7 q! [- jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, ^0 Z: B- Z, |4 Y$ u# i2 Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): ] g% u$ E+ u9 J' p
write('</div>')
9 a J0 g3 i+ J- s& H! ^5 ]}
* C! h6 P& \1 i, U: R0 X4 A2 aelse if (document.layers){
' \" E# q# ~% X+ O) @' qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 u! P, _" i8 {2 S: gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* X7 {/ w$ J& Nwrite('</ilayer>')! R* ?: D8 b" W" b. V
}% j) p- D& X) R: f) _& `
document.write('</td></table>')0 Y7 i/ S; b; \8 Q. v( z
}2 X0 s5 y+ C# N
}1 ]$ S6 n9 W9 I
</script> |
|