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

|
网页之跑马灯文字特效
//修改宽度
! \% q1 x; y9 o3 N7 C3 X) f' Xvar marqueewidth=300
+ w' @! x+ `5 P+ }# r//高度; L, j. ]* `4 h+ x( N; E
var marqueeheight=25: m+ q) c W3 ?$ k8 b% i
//速度(1-10)( J2 }! {6 i7 B$ S# f) c ?
var marqueespeed=34 m& v2 Y% }, C: ?' L+ H
//背景颜色
% |2 ~6 A o2 I7 e9 ^# D9 S0 mvar marqueebgcolor="#FFFFFF"
5 p; B$ @/ H: _5 k//是否能暂停 (0=no. 1=yes)?- u1 `: J8 e8 B
var pauseit=10 H# q0 b+ w3 Q/ ]2 g( X
8 B X" P' t5 X9 ?1 S$ i, _. m, w
//修改显示内容
; c8 c. c+ T9 y3 _* Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* h, g' O9 _! \5 L1 ?/ O t
& c1 @2 y) @) K/ ]! j0 Q! d
- @- A+ s. ~! d4 ]
////下面不需改变////////////
3 d" i% S- p/ m. m: X5 b/ J- o/ K4 F# _& n
var copyspeed=marqueespeed
% {+ B8 {# E, M5 X4 @var pausespeed=(pauseit==0)? copyspeed: 0; y! h6 ~* N) A1 C
var iedom=document.all||document.getElementById
1 |6 E! y P d" D0 Aif (iedom)9 e# A* d! w! |. {8 a& W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') D# h; \+ k( d, y6 f& w; e0 y( V
var actualwidth=''
: b* A5 Y4 f8 k7 {: F: Zvar cross_marquee, ns_marquee/ X' u! M' E4 f: X* k! x* K9 T& T
0 q4 t2 D; ~0 e5 Q) pfunction populate(){( x2 {/ u! L- ?* {
if (iedom){5 N$ z$ I$ V+ V7 B- r: d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; W$ g! d* j8 w. r2 w# r3 Q) R f1 V
cross_marquee.style.left=marqueewidth+82 U5 ~! l( }; L1 D; P+ Y
cross_marquee.innerHTML=marqueecontent
6 a k# A' k: k' W5 ~0 m+ tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% x6 y2 u3 L5 q+ e}( t: u6 _/ O& ?8 s0 N
else if (document.layers){" \7 B8 O* y+ o1 ~) F" n0 h
ns_marquee=document.ns_marquee.document.ns_marquee2
- m d ^( w( r6 rns_marquee.left=marqueewidth+8
. N% l2 V: W5 |/ k! X+ Fns_marquee.document.write(marqueecontent)# j, v/ A9 D* o/ l+ Y$ f' g
ns_marquee.document.close()8 R4 L6 P5 a0 p1 D# l0 g7 \# g
actualwidth=ns_marquee.document.width, X9 I5 n2 g/ ?3 R" @0 D. Y
}9 Q' x: q) B6 m$ b! j
lefttime=setInterval("scrollmarquee()",20)
8 h4 D6 \4 m& R( Y8 Y6 k- l2 U- @}, ], Q4 [( _' d& i9 V* ?5 n. W( k6 t
window.onload=populate
2 v8 M# ?) d* t7 t' Z( F, l. z r3 A, y4 h6 {2 t$ r4 B, O
function scrollmarquee(){
$ Q1 a% Q' R3 Q3 x* eif (iedom){( [, }. D0 H$ Q) @7 J4 W+ z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 t! f! Q: Q# B+ S+ B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 W4 J# {$ S9 i& }6 g/ p2 w3 u4 p
else
; \' W0 U$ P- e1 h; ncross_marquee.style.left=marqueewidth+8
4 u! E5 j0 T/ ^& i) e
1 H8 X. u& N# ]# n6 w}! z5 `- y3 I& z- q/ D) ]
else if (document.layers){
$ g) U7 i4 v8 o! n Xif (ns_marquee.left>(actualwidth*(-1)+8))
; A! L: f# r: }# y! }* Mns_marquee.left-=copyspeed
" X" q0 k9 L2 g( f# C' i! s8 A( delse+ f0 d5 I* ]3 q
ns_marquee.left=marqueewidth+8
\- U. z) [- x* c5 F( m% I/ ~}0 l5 C* l/ ]' ?' y: O6 A a; _
}
* h6 t0 }7 B" H! [( `$ o$ }+ q2 e: `1 n. Q w* s( W
if (iedom||document.layers){
5 a+ w4 I' R# m3 G& O% l5 v) @with (document){& }6 z M4 v( H. G6 i0 F3 ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 @, U8 ^+ n1 B2 S4 eif (iedom){
1 X* j/ [1 O3 U1 z F5 s* {/ iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 p/ D6 ~5 N [: a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ x$ Y1 r" V7 M7 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ D6 D- f$ F; f r
write('</div>')
6 a3 S' Y* Q5 c$ A; \4 R( E5 e}0 I1 S4 S3 i& P8 [4 X* ]0 ^+ E
else if (document.layers){
" O, S _+ f+ O3 _0 `6 j4 W3 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 z K: F) C0 H. T" R6 o2 c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 O+ D4 t% A2 |# Bwrite('</ilayer>')4 S# T T9 W: d3 {$ X( v! I e. d% m
}
) q( B2 T& a' l' H+ c8 W' Odocument.write('</td></table>')
3 k( R5 ^: T$ g. [- l, @}
/ j' g# Z% U. T}( U) v# c/ a' Y! o, W7 j1 i9 \7 k% m
</script> |
|