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

|
网页之跑马灯文字特效
//修改宽度
+ W Z2 [6 w- o$ W4 U4 q: y2 {3 E u$ ovar marqueewidth=3006 W% V {: H+ t6 S% R0 V
//高度) g# f* k! Q- w( n3 n
var marqueeheight=25
( s2 U5 X! j- m& D& y1 Z2 o//速度(1-10)$ M* Z% V9 c8 V8 a9 w$ y
var marqueespeed=3
$ P+ Y' X5 i' I. t3 ^//背景颜色# g: l% S' w0 p1 u" V9 m( {6 g0 D
var marqueebgcolor="#FFFFFF") [/ }4 D* y; M1 E7 H
//是否能暂停 (0=no. 1=yes)?
& e0 ]' B+ ~. {5 W+ T* {$ @/ wvar pauseit=1
, {9 e' q# V4 f' ?* Z+ L6 I3 x
8 V( l( d& @. ?, U% p9 e7 K0 j6 w5 O//修改显示内容1 o9 i1 F: c' `6 [9 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ N! b, ]8 q. l. g2 Q/ _
, y( t) W5 k, X# j9 l# Y, m. R% r8 b2 Y7 `- L4 O% B
////下面不需改变////////////
W5 N: K! |8 ~6 s
+ P* t: n. A; _2 H! w+ Cvar copyspeed=marqueespeed$ v- r# |4 |0 M$ z
var pausespeed=(pauseit==0)? copyspeed: 0
1 H# ^ H6 J% g, kvar iedom=document.all||document.getElementById
5 ` u* }) z/ |7 Pif (iedom)
`" S! c& a! n2 l3 O P& _* z6 K+ e, Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 h$ j; r( Z. H9 X: ?; P2 O+ `" b1 f4 i
var actualwidth=''
" F& ~3 o. W+ f2 T, dvar cross_marquee, ns_marquee7 T3 i S1 t7 [7 j
, _+ J/ R8 n) X/ G( I& X
function populate(){
' f4 e: Z: \5 N9 p0 x" kif (iedom){
+ C& A. M8 x) `- c( z7 _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 q1 ^. F `/ }( ^5 Vcross_marquee.style.left=marqueewidth+84 L& j5 S; z4 B( J z- j
cross_marquee.innerHTML=marqueecontent+ l- @' a+ z4 X" t3 \" R; s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) P# F. ?0 z0 E3 S
}
: d8 |+ M @. F' E" H2 zelse if (document.layers){9 h2 m/ ~( B8 t' l+ `0 t
ns_marquee=document.ns_marquee.document.ns_marquee2/ h: u: ]* G' M, r6 H' _
ns_marquee.left=marqueewidth+8
7 g1 j% R3 ?& ?2 H3 Ins_marquee.document.write(marqueecontent)
( k8 O9 x3 `& c% _0 ~# f+ Fns_marquee.document.close()
% q+ X3 c2 w8 ~* z/ o# ?/ x1 p6 Hactualwidth=ns_marquee.document.width
9 z( Z N9 C8 S4 V- a4 W3 L4 J}
2 t0 P* [; g0 H/ H9 i7 i; b, qlefttime=setInterval("scrollmarquee()",20)# a& V. v5 ?0 [# F, m
}2 ^; E B ]4 a9 F1 Q% G
window.onload=populate+ Y( Q! e# O- {; g5 ~
9 S( M0 }: c" ]' efunction scrollmarquee(){- [- U) F' y7 {0 m4 s) c& P
if (iedom){/ K( g! E/ p. T$ R+ Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 z/ K p' ?( U# pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, z/ p. \( G. D8 M' E/ oelse
7 L( F5 s4 ]5 F0 `0 d. k0 v, vcross_marquee.style.left=marqueewidth+8
3 G6 [. l. X( c( v' L6 N2 A& Y! T. A/ p6 I+ R9 _: ~/ \) H
}
! E* {/ e" I5 Zelse if (document.layers){) s, z* c5 k# C, {
if (ns_marquee.left>(actualwidth*(-1)+8)) l# K" T# Z. q o# M/ q+ } |
ns_marquee.left-=copyspeed+ p+ Z$ B: s# t0 i4 t
else8 Y, T1 Y! A0 T! m
ns_marquee.left=marqueewidth+8! S& e( d4 {* j% g: u. h8 ]
}
8 e3 J8 v3 r6 F/ _}
0 N6 R: x' q' G+ R2 v/ ~. Q$ S k/ u% _; E2 L/ A
if (iedom||document.layers){
3 d* |& ~ T$ _6 V2 Awith (document){
8 U0 p7 S2 ?1 D" n" wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 v2 R7 ]2 p! d- q( Iif (iedom){
$ B2 O6 G- w0 C' ?6 y% l/ Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 g2 ~$ m# M5 |" P2 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" P( l0 h& V% w" i# D* x. x- hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" o0 R. [/ l# @, W- jwrite('</div>'); h% y6 y* z5 r( h
}
3 K5 z/ J! d% c% ^5 w( o: [else if (document.layers){
( a) h( L5 ^; M/ U* dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* V2 z4 `' H* h: i$ c0 Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: o6 Z7 E' t/ h* \: B" Xwrite('</ilayer>'), H3 o( p9 w! g& |7 o6 ^
}: o. V: S2 A! I9 w N% G: w
document.write('</td></table>')0 _5 l5 @" o9 X
}
% Z; R h4 [' ~1 E3 I8 a! V}
$ w% P3 w$ W) ^0 ?4 S7 ~, T</script> |
|