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

|
网页之跑马灯文字特效
//修改宽度
' t' ]+ ]7 Q: r7 `/ i, C, J5 gvar marqueewidth=300" c' g H3 N5 s/ S
//高度
/ a& ]! ~4 v' i6 p. Tvar marqueeheight=25
! Y: `, V: z9 o# Q: N/ A4 v//速度(1-10)1 c1 K# x7 M" v7 r9 L% K9 y
var marqueespeed=3. B8 j; v) ^/ s, ?* M; r/ z9 O6 Z4 H8 K
//背景颜色4 S, I: K* o/ Y' \: y: T
var marqueebgcolor="#FFFFFF"
1 d: D% C7 Y0 i8 t% p! H//是否能暂停 (0=no. 1=yes)?
7 c$ C- v' T& H N y; W4 t: yvar pauseit=1
/ N# O: c" k2 F' x" y( X4 L! M4 H2 W, o: d6 E
//修改显示内容' b4 T, x% L. {2 j& ^$ V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) F& j! Y% X# |2 |* s- ]* m/ j8 V, c
+ L$ G9 k! |: R6 E6 K3 K2 l# o
////下面不需改变////////////4 R3 F1 t9 b$ T( w! z# y
) I& v2 Y4 Q0 r% w) S: l- g3 q# [var copyspeed=marqueespeed
( Q1 x% ?7 C2 ?3 N+ Q# tvar pausespeed=(pauseit==0)? copyspeed: 0% [( l. e; o" t% c8 f, h; A" V0 Y. O
var iedom=document.all||document.getElementById# ]( `5 q, ^* P" D) o0 h, E2 r! K! V/ J
if (iedom)* h: M% Q4 w7 _3 S- a" h- T7 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& k, f h: u, {3 }3 T" a. {
var actualwidth=''
( g, X2 H( W9 g" uvar cross_marquee, ns_marquee0 k/ v9 [3 J) p0 i+ l4 b& C1 E
3 ?" E8 {5 \. ]" T* S5 sfunction populate(){5 t) r/ l5 k& o8 c; V' ?
if (iedom){
1 k7 i( p# e4 n. B, fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( w1 J' I5 G N* {; h
cross_marquee.style.left=marqueewidth+8% U, K7 ?& K, w- k& s
cross_marquee.innerHTML=marqueecontent
+ |0 s0 b9 Y! i# o& l/ oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
]7 `* f* u' z5 J}3 X% m. t; c! F/ `
else if (document.layers){1 ]* Y* J0 u; x0 j9 _8 d
ns_marquee=document.ns_marquee.document.ns_marquee2
7 B) Y3 N4 ]& `' v4 |- k5 Vns_marquee.left=marqueewidth+8+ J6 F8 S5 h& J
ns_marquee.document.write(marqueecontent)+ [5 U( p8 ^3 o, F8 ?
ns_marquee.document.close()/ [& P- P& r4 l* Y% V
actualwidth=ns_marquee.document.width1 _6 D! P! @1 Q0 F/ t+ m
} |/ A3 t9 j0 t( ^& B [: y1 H
lefttime=setInterval("scrollmarquee()",20)
* F$ A9 B/ p9 w# r}
9 ~1 b, a! h0 a" G2 ywindow.onload=populate2 I- e0 X! p% G2 F! L1 N. y
. N" B7 j$ l# s+ ?$ M# S& T
function scrollmarquee(){
& F7 [2 T: R: _if (iedom){
+ v5 c1 N) p2 l! qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). S5 e t: o: P( f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 r- x# o, R k% w; V* b M! t, Nelse4 M1 D# U C5 a& D
cross_marquee.style.left=marqueewidth+8; s# N" X* N# H$ d
2 j6 e" K0 y7 K) g) {}
: [4 T0 r8 W7 z' \. |# |( J0 Ielse if (document.layers){2 q- y* P% I- e! G7 {: W5 i
if (ns_marquee.left>(actualwidth*(-1)+8))
2 E$ ~1 o6 |- p- nns_marquee.left-=copyspeed; `" k5 v$ k; ^* n
else& ^( w+ z7 _& x3 ~; W' c8 O- h) U
ns_marquee.left=marqueewidth+87 z% D/ |, ]) S) L, {9 b* p# ]0 g
}
! |, s( B1 f! s# [& g0 A}
8 k* C) L& `9 Z9 y- N# y4 k& d) \* m0 f/ Y8 @
if (iedom||document.layers){/ \, C8 R/ I: b& ~% k. S
with (document){( h& U* V6 `& L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ m$ M3 A7 Z+ ^# \, g
if (iedom){
) n7 U9 s2 o. P7 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 ? b. t6 s; ?4 l3 o8 Y4 ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ x) l/ q( r0 Z: g+ m5 v+ p2 ~3 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ a. M1 ]4 Z4 k
write('</div>')
9 y. E! \' F* v7 m, o2 D; z6 M7 {}
" j$ V$ R9 Q7 T! y0 Q6 Ielse if (document.layers){
& l% A) M$ ~7 F9 z7 v8 _, xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* V0 ], ^$ {, T, o& pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), c( K0 E( {: E! _) |
write('</ilayer>')
% F ]( k* K: c/ |; ?}
( N- k7 h1 x/ E) g: F% a' Idocument.write('</td></table>'), N/ T1 X/ F7 f
}' @' I# e9 ], M4 N% s) j# B$ _! K6 R
}/ _$ [" E! \! m
</script> |
|