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

|
网页之跑马灯文字特效
//修改宽度% P& x+ t- O1 v" O; Z
var marqueewidth=300' B% J+ W. `2 J" A
//高度
/ D. W+ `2 _0 K6 N- ]var marqueeheight=25! G0 \. _9 k+ t: @- V
//速度(1-10)
7 q3 N3 {: o1 f, F$ r! yvar marqueespeed=3
5 ~1 S- k* B) H7 m8 [5 h% I//背景颜色
- G+ u+ B5 f2 l# Hvar marqueebgcolor="#FFFFFF"
+ \- I/ ]8 V- j0 j$ H//是否能暂停 (0=no. 1=yes)?
/ D. U+ g0 |/ ]* ?var pauseit=1
2 o2 L3 |1 q; T5 c$ U) t. Q: b7 U5 J" h( V: U' ]
//修改显示内容
a/ T4 X* y0 V, ^. h8 qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- G# K* `& F# |0 a
+ ?% M/ e: O7 |9 w, n
0 H8 M, h N0 Y9 z1 C
////下面不需改变////////////0 \1 L; J/ l. J% N: {
7 E9 F/ I9 Q9 H
var copyspeed=marqueespeed
* X( `0 v% ~, I2 X; D8 Evar pausespeed=(pauseit==0)? copyspeed: 0* `& {* r: J* E- J) z( y5 j
var iedom=document.all||document.getElementById
- t X: u9 z! w5 s( f2 n) u6 zif (iedom)
' c5 D8 j- t. s- U, s5 x E: i* Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 s6 N' O/ Y$ V8 V4 ~
var actualwidth=''
3 } q: e, d- Vvar cross_marquee, ns_marquee6 ?$ _) u+ ]7 |9 u+ Q& l% T
+ P0 y! Z( g+ gfunction populate(){
0 ~: U9 I4 s ~3 X. o) e- Dif (iedom){
0 V3 H+ d, {/ g8 l) Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* X% Z- n- _: \- v1 ~, N' R6 |cross_marquee.style.left=marqueewidth+8, X+ q9 H: `& K8 U& z3 W y
cross_marquee.innerHTML=marqueecontent* ~" s( Z- h9 }$ L+ P" \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 k1 x9 j9 b* f
}6 h) S, L# T( e1 O6 h
else if (document.layers){
4 P9 h8 ?: z9 N3 R3 nns_marquee=document.ns_marquee.document.ns_marquee2& L, q9 _6 I& z, I
ns_marquee.left=marqueewidth+8
) A1 d7 u' `4 mns_marquee.document.write(marqueecontent) _1 M8 x# g. t6 L/ M2 L7 `$ x8 ^
ns_marquee.document.close()
! e. W& b$ j* Dactualwidth=ns_marquee.document.width
8 O& J" j* k' h, f' E2 h+ X}) M! {3 |7 E2 d0 M8 ]
lefttime=setInterval("scrollmarquee()",20)8 @6 ~: r5 r1 U7 f+ E* v
}
2 T2 O$ R5 U: X% G; f+ o0 lwindow.onload=populate1 h# C- g f) U, _* _! h" H
5 T6 ^8 G7 |4 O1 x/ V2 @function scrollmarquee(){
+ J4 s" u# p. V0 I0 q: Nif (iedom){" Y' _2 }6 ?; Z! M1 D4 R, V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# _9 W% U0 k- C& M: L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ _1 H+ Q% X" C7 n
else
/ J& w1 Y0 E1 _" F4 t: bcross_marquee.style.left=marqueewidth+86 F- J7 u) D2 q- B" }
! @, K* c3 A# P a! r# @}
* E* Q7 D5 U# C6 _9 Eelse if (document.layers){
' S# P4 O4 d$ V, O5 Jif (ns_marquee.left>(actualwidth*(-1)+8))2 I& |; }8 K6 P
ns_marquee.left-=copyspeed
* e! k( v5 ?( felse, `" e. L& \9 H: f5 I# f4 K
ns_marquee.left=marqueewidth+8
, O9 L1 t/ B# o$ T}) _. N: r% O* Z; P3 v* ]8 d
}( }' o$ H! ]0 j2 x1 o" v5 k
, j0 M8 l6 V: k) B) D
if (iedom||document.layers){" \4 B: b' V* Q9 @9 F
with (document){
) j; ]1 W) t$ k1 Z# _9 b: K- Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" _" @ X$ N, ?0 R0 Sif (iedom){
+ J1 D- B5 G% `0 b6 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, I6 ]6 G S: xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 b) t2 ]# K- Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- _! _- [. V. A9 h wwrite('</div>'), ~9 r* S7 k1 J, f& @! v
}
) N1 B7 B; X: @5 Relse if (document.layers){: y& x) l: c+ x2 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" A, c( W6 ]3 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 e' G! x7 v9 G* p5 y( Bwrite('</ilayer>')3 l* o6 i- v9 u! W) Z0 w
}% j) E2 Q0 R# x. q8 v% A; L0 }+ T
document.write('</td></table>')
: n* t! i9 B5 {, o! O}% R! G8 R! G3 Z+ q
}" h2 q- d% v* ]3 g& C0 R8 H
</script> |
|