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

|
网页之跑马灯文字特效
//修改宽度% r! H+ G8 x$ n- v* e |8 z7 i
var marqueewidth=300
4 Z1 m" ]! |! M5 n//高度
* c$ y7 U9 ?; \6 Wvar marqueeheight=25
0 Y7 _2 }1 B' R6 m& {8 m//速度(1-10)2 V6 P2 e8 j0 q, Y. ~4 b
var marqueespeed=36 F2 j% J0 q6 m- I; t5 j: o
//背景颜色
1 W" k! O7 ~# r1 g s2 k# `6 o9 lvar marqueebgcolor="#FFFFFF"
0 y1 E6 v! L) _1 x3 c, ^! O3 Q//是否能暂停 (0=no. 1=yes)?
! ~) p6 q5 g" f5 e& H+ ~1 T$ D6 ]3 r) Yvar pauseit=1+ x! s5 ^) n# ]) ^1 w0 v
# d% B- r2 T/ J
//修改显示内容
9 C! ]7 ^9 A2 d" c# T1 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ l4 m" |2 b9 U4 U" m2 ?0 e8 ^+ V# P# C# c( w+ ?* |( j
3 u. O7 j) b4 I; E, f! ]////下面不需改变////////////; k2 _( j& E. T% S! Z2 r* W
1 T0 A/ f& x3 U: H) u
var copyspeed=marqueespeed$ x, E; J4 E s" P1 W
var pausespeed=(pauseit==0)? copyspeed: 0- E4 N# z% E: z
var iedom=document.all||document.getElementById+ Z u ~. T6 e& ^, s: p
if (iedom)7 y3 @" x# @& H2 U& m8 Y' O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! x- d, g4 m4 v+ d$ r" u
var actualwidth=''
0 L7 u% u: T- H# yvar cross_marquee, ns_marquee
( T! T: [* g9 \' b* z' k7 i' Z! G& P. X: E
function populate(){
7 z+ c) p2 p/ ^6 xif (iedom){9 h& i2 @! O* I/ |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ E# Z' s* b; z6 @
cross_marquee.style.left=marqueewidth+8
# f, i9 ?3 R+ B, gcross_marquee.innerHTML=marqueecontent7 [2 e. k4 ~/ D! }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 `* B& d$ R, G# p, P: C
}+ N% Z( y! B8 N7 m& h
else if (document.layers){0 A: s4 c$ L) H- ?$ h. {
ns_marquee=document.ns_marquee.document.ns_marquee2
/ x" z9 y; ~5 T! tns_marquee.left=marqueewidth+8# k0 |' ]( T* `0 h
ns_marquee.document.write(marqueecontent): W+ Q; |2 V) V; {0 G3 t
ns_marquee.document.close(). ~& R4 b& x. Y, U4 X8 [) S0 O
actualwidth=ns_marquee.document.width9 @& k4 \, U: J8 x4 m* P# z* ~4 w
}
1 R* x$ {( v, I& z$ n; Wlefttime=setInterval("scrollmarquee()",20)
& X1 p. p$ N0 `' A$ Z h}
1 x! V# e' G8 T5 \( q; zwindow.onload=populate
6 Z' d# @. f6 [# e/ g! {" v# |6 a
6 v9 L. m3 F5 z% Q3 H6 e0 Q1 O4 Ifunction scrollmarquee(){
! ]& h1 w( `. I$ D8 E; p L1 u# wif (iedom){/ Z* B5 _. O9 U4 M9 L. m" o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. {# G3 ^) I4 p* c6 v: u% gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 d- j! y6 i1 F! G0 n' K, w0 selse
( a* B' I$ E( u; M/ kcross_marquee.style.left=marqueewidth+86 [. c8 s- H. [$ C+ `
_5 u" ?2 L4 m- B2 I$ l5 C- y# _
}" c: f/ n5 Q& v- d# V! @( D* e
else if (document.layers){
1 ]! ^! C: ?0 U% Xif (ns_marquee.left>(actualwidth*(-1)+8))
f4 ^5 X4 c" Cns_marquee.left-=copyspeed
" j$ j8 r- b+ u a- }else7 v! G8 F& C* p$ [
ns_marquee.left=marqueewidth+8
2 M/ l( d$ M' E3 M; B% |}8 V0 Q9 ^' Y; O$ r- n3 m* r0 s
}
- g! Y- J: z: R% i3 {# o5 j4 m1 t0 G9 ?' h R0 ]
if (iedom||document.layers){' w0 H7 [: Z5 d! f1 g+ A* x$ B
with (document){
# E$ Z7 v2 y/ Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 u" f4 y6 L: o: Q5 k! [4 N: u6 _
if (iedom){4 H9 s: p% a9 J9 P* u! ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* a/ j! q @6 h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 f+ u, Y! k, y# y. l3 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! i& N# \% B/ Y6 D" r6 Wwrite('</div>')
+ v, y' P: r* X4 e P}! O8 t* I7 q" l& s
else if (document.layers){
& w0 q) v8 v' ^1 v) dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): _! X) c: C, f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" q1 m {9 \' r. ^6 x. E+ cwrite('</ilayer>')
* O# P5 f9 r1 C. T9 v$ h}2 [, [7 v3 v+ K8 G7 ~
document.write('</td></table>')
: g0 u: e: n+ p# U/ v" g5 q( K}
3 R/ L+ H9 G8 k0 u/ e5 i9 E}
) J( u& S. @, I/ _4 J. I+ [</script> |
|