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

|
网页之跑马灯文字特效
//修改宽度
" O6 A0 `6 y' X4 G! z9 lvar marqueewidth=3005 f, }# G: V) }; i
//高度
& ?# e- m1 R' U; O* lvar marqueeheight=25
9 n- e9 m* T5 s& D: K( W//速度(1-10)
* f& n9 q6 N( G0 }, v3 Ovar marqueespeed=3
6 q/ a6 B4 r6 m8 J//背景颜色8 r8 U, |) \; @ {
var marqueebgcolor="#FFFFFF"9 C# \$ F# G& ]* k$ y
//是否能暂停 (0=no. 1=yes)?
, o0 E" O9 n4 Q5 l# M9 avar pauseit=16 m, E% \ Y( L3 \4 ? [
" A1 \* z7 s" ]. x7 v e
//修改显示内容$ r) a" s6 m- r8 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( [1 S9 i K" A% ]
0 a ?0 y4 X, p, I
: T1 T* M0 o$ O////下面不需改变///////////// F% J4 Y+ A5 o/ y4 `
, J5 @7 c+ F" [var copyspeed=marqueespeed Z) f+ N/ m, C! b- ~$ v s
var pausespeed=(pauseit==0)? copyspeed: 0
: ~, {* ]7 E1 w7 m4 svar iedom=document.all||document.getElementById+ \. I, j: v0 q' v! m9 i
if (iedom)* W7 |/ N& v+ }: s [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% g% W! M R+ ^% `# X* kvar actualwidth=''
: x7 B. G( u) r7 x( t% j* ivar cross_marquee, ns_marquee: o- a* |( \! C/ \: X, {- _# t
3 W8 g @9 C1 a* `' @/ Q* }function populate(){# t; e7 ]) w9 F# i o9 n8 J0 {
if (iedom){- f" g( i/ G& n( S; w) t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* [; d; @$ x. G5 t6 h# A" Y" M6 t5 ^' `cross_marquee.style.left=marqueewidth+8
+ |3 r$ B( R8 |; U4 Z6 Mcross_marquee.innerHTML=marqueecontent
( j1 g6 m5 t% I/ u8 o6 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, u2 E% i; D; x1 w: B
}7 k8 U8 L y+ j
else if (document.layers){
6 l2 a5 ^* X9 n: Ans_marquee=document.ns_marquee.document.ns_marquee2 g5 Z2 Q7 f' P! x1 h ~
ns_marquee.left=marqueewidth+8
7 \' x/ |+ z. N2 @0 ] Fns_marquee.document.write(marqueecontent)$ D& k% A8 X" K ?
ns_marquee.document.close()8 l2 ]. R. p% e4 c1 l
actualwidth=ns_marquee.document.width
& \; L( [1 ]8 |9 p- q}$ m8 F3 j2 ^; p5 b# o: [9 X; V
lefttime=setInterval("scrollmarquee()",20)
, X: [. f: t- y0 T4 Q}
; f/ s$ [; g' P" P9 i, lwindow.onload=populate& U4 o; r/ H5 X
6 C3 ~/ J6 c, D/ A; T6 C
function scrollmarquee(){
& `' c& ^7 H9 I' A' Nif (iedom){
5 i; L3 |' O8 Q& p4 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 E1 ]+ Q) v2 L. ?! q8 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ \7 \$ g+ o/ Z% `2 |8 x
else' x) F: m( E: H! [0 Q
cross_marquee.style.left=marqueewidth+8$ X/ F% a- p7 \1 C+ F, ~+ i- z
' ]# q4 G" p& q
}
1 r9 @' o) F" L7 X. Kelse if (document.layers){7 I& c$ q& V# E0 q* Q; g: q
if (ns_marquee.left>(actualwidth*(-1)+8))/ B2 p0 t# y$ I! m" F+ M+ B
ns_marquee.left-=copyspeed
" d% _4 s0 e* E T- celse
! v* K, O, _: n- C8 V1 Yns_marquee.left=marqueewidth+8
/ _. g; X3 @; a}
a4 `( y n( y}3 G5 G% G# o- }
2 e8 a0 b; F9 I6 j8 C3 @. eif (iedom||document.layers){# e3 ]1 L) I/ k2 D) |5 V# ]( r
with (document){
! J5 S- w) S: [* [1 Y. l, vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 A, c- R, S+ |& e$ Lif (iedom){4 ?5 j) w" E' K5 a5 [- U7 F( V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); ]' U* I7 B7 S# \" f8 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), R Q9 v, M4 K9 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) S* Y/ Y8 U$ ]5 n/ F! ^1 Nwrite('</div>')1 T; f6 ^/ A+ o' v8 w, i8 b
}
9 X( e% X" L# R1 x6 [9 U1 |' \/ Velse if (document.layers){. Z$ Y M2 U' j: \5 _+ S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) N" a! Y! Q! g! R2 p) _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ u5 p6 m. `! w v9 e+ A$ N; R
write('</ilayer>')- i: A) I/ s9 ^+ y' |5 A
}* ^2 }1 v, t! a* x9 U+ g
document.write('</td></table>')
9 }, G) A3 z( H- }8 p}
0 i" _" b( ^1 P; O9 v2 s}
8 j' e$ i/ r% F* i# E" m" P</script> |
|