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

|
网页之跑马灯文字特效
//修改宽度
% W! P- \( n" e: X+ Bvar marqueewidth=300. M8 g: ^+ D1 R0 e
//高度) n- Q/ S! ^6 e' r6 N* n: S
var marqueeheight=257 s/ @3 w. l) l8 [8 E
//速度(1-10)
5 i2 V# z' e' Q% {var marqueespeed=3
; {* c3 n: E5 h% U; J) f//背景颜色1 i) c, ~/ z% W% |7 q
var marqueebgcolor="#FFFFFF"1 z, w" J. u% o* R2 U
//是否能暂停 (0=no. 1=yes)?3 _' J& Y1 G# u; `- f
var pauseit=11 X; `' P/ ?7 C! k( q j, C9 K
[- G) _. b% L! G' q
//修改显示内容
0 ?% y1 H2 M# R, E$ xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) b6 R- A, e* p0 E
% j. j4 p: n0 ]( Z/ u$ r
# q2 |& U" j& y( K////下面不需改变////////////
+ C2 N, N2 g3 @% a1 ^
6 t4 l8 w. ?0 C- k b+ b C! @var copyspeed=marqueespeed
( E; I5 a5 S# B. _7 q7 b. bvar pausespeed=(pauseit==0)? copyspeed: 0
- w, r% r) [% f* J+ dvar iedom=document.all||document.getElementById
9 b; J5 `9 T: J% {7 y( d+ }7 Tif (iedom)* f- J$ S2 n& ~5 r! G4 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 J, S" U- `+ d& X1 Y% _1 avar actualwidth=''; H: @2 h+ `$ s$ g) g: N3 _* O
var cross_marquee, ns_marquee) b' l: E& O4 ~- b+ R
) W2 y/ {& g: |, g
function populate(){, `! s R3 k8 v1 x9 c2 B
if (iedom){7 x9 S5 N* o D4 H$ \5 |+ L& R% x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; r7 u' t, B9 tcross_marquee.style.left=marqueewidth+8
* [0 C/ S/ u2 D" C5 Ucross_marquee.innerHTML=marqueecontent
/ e" D a! f" \$ A/ a+ Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 h( d4 J* R- ^, W0 Q2 f
}
: G; `" u: \% d1 X5 R4 velse if (document.layers){, ~; C* B5 ~8 U% F" T) s3 ]
ns_marquee=document.ns_marquee.document.ns_marquee2
" G& K, G( J5 Ons_marquee.left=marqueewidth+8
7 S) K9 \, R1 ?: D' L- R8 |ns_marquee.document.write(marqueecontent)/ p; ]: }! f X5 T5 ~+ b
ns_marquee.document.close()1 m2 ^; c7 S0 i% W# {
actualwidth=ns_marquee.document.width* ^. W" s! a9 G$ |1 q2 @' o% `8 _
}+ D+ A$ m: r' g7 M: p/ e
lefttime=setInterval("scrollmarquee()",20)
2 g& |/ s0 \6 Y6 O" S2 y6 m- I+ Q}9 i6 k- r8 W% M K: P* W' M: U# w7 Z
window.onload=populate
. [: M. t$ @' a: O6 T! W- @& a8 B3 X! v$ s" E R
function scrollmarquee(){
l! `2 R: L) w0 @; zif (iedom){
. A% D. T8 W% H8 @) c" s; y2 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& ^9 C. L- H& {" V- [; L, |& ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 t$ I) f! H. a) J% delse5 M' l( y/ r# \
cross_marquee.style.left=marqueewidth+88 W2 z) h7 [% J4 M
( _. t2 m1 b1 Y" A4 |( Q7 M}
4 t. n# g0 ]. @+ ~6 selse if (document.layers){ O1 H g- ?: h4 t) b. j
if (ns_marquee.left>(actualwidth*(-1)+8))
+ Y6 m! x, \/ `4 Z8 ins_marquee.left-=copyspeed, e; \7 V% W: w" W4 t m* m
else; G: ~$ ?& ?% w. x" s- ]7 d
ns_marquee.left=marqueewidth+8
# v( E0 [* f- q4 X. p}. |& [3 t% x" L
}: \" B" L q- c! b2 W3 H
) k- a7 }! c P$ S1 n
if (iedom||document.layers){
# ?! d$ z8 P2 @1 D& Swith (document){1 Z$ Q; N1 _4 |5 ]9 A; ]& P6 b9 S1 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 l& J0 R0 ^! X) _8 K- A7 b
if (iedom){
: V. W0 t2 Q: bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 S3 C- D- F* y& k9 P! R2 F3 p! s5 Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 B; }4 l7 Z K. e Z6 R" B6 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. s- p$ T* v) }# Xwrite('</div>')
3 d* t4 U% n6 M" | X}
% L; Q9 d* }8 h" J. c1 D& t# {else if (document.layers){
' ~# |& E% v1 E3 m r$ z5 K! G7 Y" D( Y. ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# F/ ]' k: ]+ xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ `! ]7 Q& Q- A3 W9 twrite('</ilayer>')
# Y6 z; v: T5 y/ D" p4 N}
+ ^# U/ K* I3 }document.write('</td></table>')5 c4 ?5 y* u6 L
}( n( J% V9 ~$ O7 E' |
}2 D; M. S/ o, \, j
</script> |
|