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

|
网页之跑马灯文字特效
//修改宽度
0 k7 `- s* v. h7 `: o4 bvar marqueewidth=300
( m% `& K0 _8 i. Z/ l% P//高度! H( m L3 r$ Q( Q1 y
var marqueeheight=253 g1 N9 x0 k, E( @7 N* v3 ]6 X
//速度(1-10)
6 E8 q8 H4 n) J2 y/ p. Qvar marqueespeed=3
, U7 I9 I) f2 S$ R//背景颜色2 W0 I0 N6 D* S+ P
var marqueebgcolor="#FFFFFF"
- o% w$ m0 O/ P1 r5 j+ z//是否能暂停 (0=no. 1=yes)?3 O# g! T/ E1 [ z* K, C) u
var pauseit=1
! q3 T6 a8 T' ^
# x, c2 P' O$ m//修改显示内容
# U% W0 _& k$ m* |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; b5 } _) V9 A* n
$ v/ }3 z: x" X5 A/ j
! Y. J$ F- M7 ?, I$ A. f9 y5 d////下面不需改变////////////
" e V I- X4 Z) G& a6 z7 [0 Z9 T, l8 v% `* J/ K
var copyspeed=marqueespeed
4 b2 o4 h( t7 v! `var pausespeed=(pauseit==0)? copyspeed: 0
1 c7 R2 \- U- h4 X; u' nvar iedom=document.all||document.getElementById. N. m8 t" D' Y6 U! p
if (iedom)# C' M0 H0 z' A: D+ b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 }+ s/ r) L" j
var actualwidth=''# Z' c; w! h2 F( K! S- H& ?* a; @; c
var cross_marquee, ns_marquee
: k- L, C0 {) o( i
. H+ B+ T2 C o8 G# }7 f- Dfunction populate(){
5 f. A1 I. t5 {8 g6 ?5 {0 ]if (iedom){. x& Y$ W6 f* ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' W7 L3 q4 n5 mcross_marquee.style.left=marqueewidth+8
4 O( K3 q9 V) @ Y2 C/ Xcross_marquee.innerHTML=marqueecontent
" r5 s7 u% y& c$ O8 T/ @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! m( j1 m9 |- u& G6 Q
}5 [3 n) x8 u% \4 H" [' K
else if (document.layers){( S9 U: d* q- m7 d% F, D1 y
ns_marquee=document.ns_marquee.document.ns_marquee2/ a8 E! u) E: C( d V X
ns_marquee.left=marqueewidth+8. A* j% r' o1 S; \6 p+ T* M& F
ns_marquee.document.write(marqueecontent) O8 `; C* N' [( E2 O4 l3 [, X
ns_marquee.document.close()4 N1 S, w8 z9 i: A" q+ R) j. {: H
actualwidth=ns_marquee.document.width) C" ?% a' g1 v7 [; ?8 O" u
}
, @7 N* i( p( w1 _* m) l% s' Plefttime=setInterval("scrollmarquee()",20)
6 {: N" u9 D- Z3 X& d" d}+ p+ e# [4 I* k ^6 c
window.onload=populate
& ^7 {/ X! \3 z4 P, B, f' Z
* Y2 ]9 I( f% |# S9 e6 U3 ~function scrollmarquee(){/ O# q4 q/ r! W
if (iedom){
, s" X0 f. K% r5 i# N# Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 w( b" j% V( T' o4 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% _4 |7 }5 N' `( `: t* M
else
# T$ Z% c @$ }; X1 Ycross_marquee.style.left=marqueewidth+8/ u( f5 P' z( z+ C7 S
, }# ]$ E: _; O4 ]% R/ H: f7 G}
+ g& I! t- m$ i+ R/ Z2 |. jelse if (document.layers){
7 Y& g \ d/ }# g4 k/ Tif (ns_marquee.left>(actualwidth*(-1)+8))
4 `, j9 k2 W9 l/ L9 g) }ns_marquee.left-=copyspeed
" J* Y) X: E6 k# V* melse; ~6 g) i9 Y& T% W4 q. z
ns_marquee.left=marqueewidth+8
; X; x) c/ e7 B; J4 o}: ?: f$ D$ m5 l3 P9 V
}
$ l4 U) `. a) p8 ^+ \' {6 o# l( w# l: N O
if (iedom||document.layers){
8 J0 r2 n8 x( H* A F3 awith (document){
4 T7 U8 L$ z. ]" z4 L& M7 Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( P6 Z# d/ W9 J, }
if (iedom){
" m& G$ m+ {% i8 i4 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 @3 f0 P+ G; c. k3 f# {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); ]0 O# x; `; D; l# a+ L; p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 f" A; [4 G2 S
write('</div>'); A0 w, X7 T; K" l
}2 { @1 h. r& Q. L, U( h3 N
else if (document.layers){/ j4 E3 u [2 \- Q- u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& y) P2 ?$ r- J% Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); F9 i/ z0 \" U3 A6 h ^4 A
write('</ilayer>')
( d+ t: d+ P1 \- e$ p/ k( s' E}% o2 j$ o! b, ]& j
document.write('</td></table>')3 X1 R. K/ _$ e/ j/ v
}, G; S# C" Z8 \1 F/ D* h
}8 W- |) n* ?8 X
</script> |
|