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

|
网页之跑马灯文字特效
//修改宽度
1 @; d& h4 T" G) P8 _" Hvar marqueewidth=3005 e/ o% U% N5 J# K- U! S- W/ f. h
//高度
+ F' P" _7 b. {. ^6 C! g9 Wvar marqueeheight=254 _* F% [8 g) k0 l( q6 r: B% O
//速度(1-10)
k+ }* L9 x. W$ W/ [var marqueespeed=3
6 d0 r5 n; o- O7 R; \6 m! M//背景颜色+ o4 B% B0 G- Q& X; y' n$ g* _
var marqueebgcolor="#FFFFFF"
k! {5 L0 L9 p+ g//是否能暂停 (0=no. 1=yes)?6 h2 I3 |; b K1 g# ]( D5 S
var pauseit=1
& y3 i: |1 n5 Z
" w; H2 ~+ `( ~1 S( U//修改显示内容$ ~9 c& N0 m$ e7 m2 v* q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 X7 @6 [* `* R0 }6 |1 m8 e
: r- L5 X" F% p o
" ^) p, u& T3 z3 |$ b% z, J Z3 F5 q. Y////下面不需改变////////////
9 `% `3 u. _0 q6 l2 n+ }: f. I' Y8 `6 i
var copyspeed=marqueespeed* p( J2 ]) J- k, s0 Z* m
var pausespeed=(pauseit==0)? copyspeed: 0
# `3 L: F# V% Svar iedom=document.all||document.getElementById
4 p3 n8 I! \# @! S& w: M$ Dif (iedom)
3 ^3 X+ R8 ?& R1 i9 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 p1 [, ]: L5 w' \9 `- d8 Vvar actualwidth=''
1 j: M/ O2 G) \+ j* Jvar cross_marquee, ns_marquee* {) ^0 v$ m9 g9 ~/ v% \7 O$ @/ q! n
( @7 V% B) r0 [! l9 R3 f. Wfunction populate(){& b N; }# @6 o
if (iedom){- Y2 y" H3 G& s7 T. ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" V* a+ C, @* s0 y7 y3 d: B$ g0 M$ h
cross_marquee.style.left=marqueewidth+88 [3 j) i# z8 ?; N8 m2 d/ F8 Y
cross_marquee.innerHTML=marqueecontent
+ ?% r8 i. h+ yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 U. S* r7 |# m! R9 Z
}
: u7 F: u0 } u- S7 v2 F; f8 i9 telse if (document.layers){# A0 Z& @( y' m$ B! a
ns_marquee=document.ns_marquee.document.ns_marquee2
7 S& ~( K: ?: Y" Z# J! E; sns_marquee.left=marqueewidth+8
9 m$ G. g$ q9 qns_marquee.document.write(marqueecontent)
& ~" ~3 E4 V2 M7 W- @- I* |; m0 R$ ons_marquee.document.close()
4 @8 O" F* t2 r2 A& e- zactualwidth=ns_marquee.document.width
: }6 O. o: X* g. t# L% ^1 t9 Z}/ Y3 B* e, @& X8 E' i& \0 n% t
lefttime=setInterval("scrollmarquee()",20)
( X, F- y2 P9 G/ O5 F4 s3 J4 |}
' m* p1 u/ K1 h5 n2 Vwindow.onload=populate
+ C7 A; S' b! X+ U: j" l
$ Y! `) Q/ M& z ?. Rfunction scrollmarquee(){
- f, G. I) R" h3 O/ aif (iedom){
7 q8 M" _+ Q E- o* ~/ V" Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 L( V" Y5 V( w" G( V# W. @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) V1 {2 t' R. R. }2 h* `0 O [4 K6 r
else: R d( t- y/ F' @8 q& [
cross_marquee.style.left=marqueewidth+8
5 _4 r8 G) s. w" o9 r4 M, V( g1 v( c; Z! \2 [
}9 q# b% S! r$ g' Y1 U( X f! M
else if (document.layers){
7 s7 n3 H6 ?# j" ]if (ns_marquee.left>(actualwidth*(-1)+8)): Y0 i! P. s! u2 M6 ^' v: w
ns_marquee.left-=copyspeed( G6 N9 k4 M9 F1 Z2 u1 i
else5 b4 R* h' k- _/ }5 y
ns_marquee.left=marqueewidth+8
) h0 q6 C( {# v) f2 E% C- r}
2 g, R* o* [) `3 Q5 a3 O}
4 K3 Q6 j/ {: A3 V7 V5 u6 U6 U% Y3 O. s4 P5 H% w
if (iedom||document.layers){
4 a! d' Q5 g2 `1 }with (document){/ x) ]: Q8 a) A/ f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) R6 w F4 l" Z$ }if (iedom){' n# [. }% L: I1 s6 R! X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* ]# J$ N0 g- b, v1 w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 b. K- \' k c% Y3 h5 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% X5 m: s# q9 L% |8 k `0 F3 @
write('</div>')2 F# p8 \! _ D; n2 y' [1 I1 N
}
% r! }: Z p, m1 L% |* ^else if (document.layers){
) f; v9 r4 O' _' g2 Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" p3 t6 Q5 w# _0 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' O+ x3 X+ t# V
write('</ilayer>')) |( y8 P" K; z7 I) p
}, `1 Q) m) h7 a% F
document.write('</td></table>')
6 k# Q K8 C2 B5 c! }7 B4 L. @}
# q# T. N5 P6 q* L& y$ y* o}! J/ y$ d& i8 }8 S1 f7 Y
</script> |
|