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

|
网页之跑马灯文字特效
//修改宽度+ I* D! a# E" G9 M" U
var marqueewidth=3007 z5 s" }4 n+ `7 R+ j: ?1 L
//高度
5 a6 z6 S, J" U2 m( tvar marqueeheight=25
2 O G ]- f' t/ A5 e//速度(1-10)* I. r9 _2 V7 s P; K6 C E9 G
var marqueespeed=3. q4 _0 ]6 o! @ C
//背景颜色
! t) q- o* S2 z, s% v: P) r$ T! qvar marqueebgcolor="#FFFFFF"/ ]& y) Z- ^1 ?& L
//是否能暂停 (0=no. 1=yes)?
. @2 K- F- X/ [8 L# j1 t j3 I V2 Hvar pauseit=1
) t, ~2 R3 _% [7 ~" T: H% ?# }2 D# A
//修改显示内容) k6 |8 h4 {: C1 G) |% A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ @, J8 f7 f6 k& o9 G [0 u, h# L. r
! T1 T) `% m- z" e( H/ E////下面不需改变////////////& f/ a* M/ Y5 T
( G! d6 O) U- S* q9 ?3 V( v
var copyspeed=marqueespeed
9 V. F3 P% W( i: A2 s" r7 Ivar pausespeed=(pauseit==0)? copyspeed: 0. H" Y% v+ v* H0 }2 ], y
var iedom=document.all||document.getElementById
4 N5 n7 [% Z$ b, h" z7 Cif (iedom)* n( B! j" D/ L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" k) ~1 L s! ^; a; [9 s' b
var actualwidth=''
+ A9 j+ U3 M# c1 x `- p1 wvar cross_marquee, ns_marquee9 Z. I" B7 T; L& A$ b" Z
* [8 K( e/ u* h) q3 ^: E" b2 i: h8 T
function populate(){5 ?, a0 O' }9 P5 W
if (iedom){5 `$ R) w; o5 X# N7 C2 r; d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* v' A9 }( l1 s& C" l0 T
cross_marquee.style.left=marqueewidth+8
* n6 c+ i. Z( \: m7 across_marquee.innerHTML=marqueecontent( U$ q) R9 P, x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ~0 I# K, w9 `4 n}& E" L$ A' ^& ~3 p* N
else if (document.layers){6 M. M* r2 z8 j+ h" ~
ns_marquee=document.ns_marquee.document.ns_marquee22 N1 N7 @9 Q' s q2 e
ns_marquee.left=marqueewidth+8
! L% L4 J: U+ H Cns_marquee.document.write(marqueecontent)
- o5 a+ S# ?' ]. b2 n. v4 V9 `ns_marquee.document.close()7 t: W; o9 `* W" T( }
actualwidth=ns_marquee.document.width
% o; `1 i3 i# F; _} X2 v; F3 C% R3 U; t! ^
lefttime=setInterval("scrollmarquee()",20)
* t( b2 b; e$ `+ J3 I4 H}
0 t9 b+ h6 P6 O! C2 ?window.onload=populate
N+ M# K- \- C3 [/ q9 h+ L2 w. p0 t+ b/ m, ]$ I
function scrollmarquee(){
! E5 k5 A* p" v( g0 \, g. L( M3 s$ Cif (iedom){
# S/ v% i! L' yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 S: J9 H9 E2 |+ c0 B* L# b& J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% o+ L9 N8 p1 v- t! v0 T/ l0 velse
) c( n% Z% B8 m$ Icross_marquee.style.left=marqueewidth+8# ]: U7 x1 ^. i6 d' G
3 P2 ^6 u$ Z$ L" Q( H* Q3 q2 Q}
; Y, ~. c$ F' l* N8 jelse if (document.layers){
: F$ `# I6 @1 U% M- J/ Fif (ns_marquee.left>(actualwidth*(-1)+8))6 s& F% ^+ G1 a I+ m
ns_marquee.left-=copyspeed
* W! C% h. Y' F8 [+ [; J) {else
' o) d9 J6 v: K G2 R1 Bns_marquee.left=marqueewidth+81 u' M% b& \4 C4 S! E
}
9 e/ f' V7 c. D1 V' f/ ?, Q}4 ]+ B& j" Z3 k5 \
7 `5 N) ] s. `1 i# B4 r4 S
if (iedom||document.layers){
2 h* d& D! Y6 H: x& t. A2 l8 ~- \with (document){8 m" {& ?$ S; A. r/ t( t, R6 S9 x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) X+ k; a2 @& z0 G4 y. e" } [
if (iedom){
4 a) @/ ^: P* T7 y+ Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ g) s4 i& u& A, H5 j* hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): u1 ]+ M% ]7 \1 n2 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' q, i: ]! E+ W" p! g
write('</div>')
* u8 r9 u i% T* B; n3 x}
: M& w( s" I8 r) `$ N5 y) jelse if (document.layers){
" \) X9 ?2 U4 b/ kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' c6 X: F! E+ c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# e% c4 E7 P! w* z
write('</ilayer>')' y+ R* W/ H3 K) D# Y
}
8 }' W$ `8 h3 W: R& ? z, `document.write('</td></table>')% f" N9 U9 I% d3 Z& }* w- q
}
% W$ q. Y+ Q3 ^/ |}
0 Z# o) B6 D; Z; \3 D3 s</script> |
|