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

|
网页之跑马灯文字特效
//修改宽度
% m$ a$ k+ b* p4 \var marqueewidth=3009 M1 \9 x+ @2 H% N' Y1 x
//高度
0 ]! D' a; V# e- V' y. yvar marqueeheight=25 Z: h; r8 G" E6 m8 R
//速度(1-10)% F- X& P/ M! x! O' [1 q4 e4 a
var marqueespeed=3
$ X% F) S( c+ I5 z) u% h0 k! ?//背景颜色& r- P g. e6 {% I. {) V: o
var marqueebgcolor="#FFFFFF"
* k' r) K( _7 t+ |2 @//是否能暂停 (0=no. 1=yes)?
4 i# [4 Y: [1 ?$ k. l) L: g4 @% I9 mvar pauseit=1
5 d0 F; j. A% h0 w6 u
/ C* n+ q' k6 ^//修改显示内容4 r2 j; e% i2 z/ K# } K; G" E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': F% h4 r- y/ D( S
6 R2 R% Y# }' }" \$ H+ @! ~' C, x. l
B& L( h4 `2 x6 e' l' _. a
////下面不需改变////////////
/ `9 @" C6 j- V: G- D
/ M- X+ Q9 S& n/ Bvar copyspeed=marqueespeed- y- _& k- R" _& q4 k1 Y6 m
var pausespeed=(pauseit==0)? copyspeed: 09 @& ]6 N2 S- w& s/ U0 u# l
var iedom=document.all||document.getElementById/ c- U9 d+ K) c, R7 m* |4 U
if (iedom)$ w# c# S" D' c. n! E; j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* D$ L% [' X6 G. zvar actualwidth='', S% u) {1 L) L3 ?
var cross_marquee, ns_marquee
' J) ^3 y2 C" a( S
8 O, M2 _ z% S& N) Bfunction populate(){
& m" `7 B( h* J+ k; Rif (iedom){
$ q' J/ B+ x8 ` P! |0 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 \- ~; q6 H- P
cross_marquee.style.left=marqueewidth+8! D8 U& `' B% x. I, Q
cross_marquee.innerHTML=marqueecontent# A& J Q5 y3 B: I& P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 N6 u5 ]- @) l' u, c* L' L
}
3 r4 \1 ~: ?" j# C; a% B' U' belse if (document.layers){
9 N( Y. _# M% B5 sns_marquee=document.ns_marquee.document.ns_marquee2
) M* ?# T3 u& f8 E Q) Ons_marquee.left=marqueewidth+8
3 k7 t+ E( R6 Z1 P1 B/ Nns_marquee.document.write(marqueecontent)
1 ~4 a: B( {3 ]! i% d1 U: `ns_marquee.document.close()
b2 ^9 l! S% `% T& Kactualwidth=ns_marquee.document.width# }; \: Q1 u; s6 V7 m
}% c0 ~: D8 ?3 B
lefttime=setInterval("scrollmarquee()",20)4 h5 c$ [8 x% D+ d7 \
}
( `! G* f0 s* p+ Y2 |; D& Cwindow.onload=populate
3 j* }/ z6 f0 ?+ m$ x) R" s% }$ L4 L, W1 [
function scrollmarquee(){* q3 v0 B0 G0 B. f3 ^5 B6 _- r
if (iedom){+ J$ c, S7 X. n& M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! P* D, Z+ S& e; \! d) wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 p% X5 v% f) [& |& G" ^6 D1 Y! B: \else$ {/ }( L% c( s3 u
cross_marquee.style.left=marqueewidth+8
* l# n( s1 Z: p, Y4 H1 Q. ^
1 |3 Y7 n1 U$ p9 N}
) w0 B B2 Z' }" K' relse if (document.layers){
& A7 K* L& a9 @if (ns_marquee.left>(actualwidth*(-1)+8))
' m. l9 [0 Q: n3 V! a1 N! `ns_marquee.left-=copyspeed
+ J: Q6 o2 N1 l& f3 ]else4 N. ^. s. t r$ n& i
ns_marquee.left=marqueewidth+8
" r9 ?1 S) O# Y; A* P2 J}/ Q) l# V( l4 S8 _0 p2 v$ n- p) y$ ^
}
6 e) V2 R2 P& F0 Y4 f0 J, v) }* @7 d, B( |% q2 C9 A( Z) }
if (iedom||document.layers){# F$ [! z9 M* \% U8 `8 T
with (document){4 M0 x$ V. Y. T7 R4 ]: }6 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); _2 g- ~* O# E0 [
if (iedom){1 u5 ?) W3 F# N+ _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* C- Y; _9 i5 _/ l9 g8 z6 b- bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( h, ]% o2 \2 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: X, S& q1 g! }$ e/ gwrite('</div>')
# I7 H# l9 l: _( j; W' I4 a5 ^% d8 X}, a/ H# Q# G' O( y$ b! @
else if (document.layers){- K" [5 W4 [: x; s4 o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 q) {: D- R5 l- c/ V) a! nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: |! S5 Y6 P, N' E" y! Mwrite('</ilayer>')9 w0 R: d+ T V- d$ }
}
% V* V# s0 l j) c5 x1 ddocument.write('</td></table>')+ q2 h8 N$ c% r1 U2 ]7 @( m3 v
}5 f; o) y) ~9 t' P/ @
}& k& Y/ ?8 o0 o' C
</script> |
|