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

|
网页之跑马灯文字特效
//修改宽度
7 S( H8 k- W6 `1 o: N. `) [var marqueewidth=300
2 G- [1 i2 q* `8 ?//高度
3 {" m+ [( J- \. [5 [ I. [% Hvar marqueeheight=25
8 {( T6 U6 @. p! M$ g: B5 Z//速度(1-10), n- C4 H7 h \+ i
var marqueespeed=34 u0 v2 f3 ?( r/ l5 |6 c
//背景颜色4 I# \7 x$ [: i
var marqueebgcolor="#FFFFFF", \; A5 {6 ~5 N# t& \3 O3 ], x1 v
//是否能暂停 (0=no. 1=yes)?
- Z- C5 p+ R. ^var pauseit=1
6 H9 O, |# r5 o4 I+ P7 P6 w4 @* F; x, z$ j' a, r3 \. r4 {
//修改显示内容
1 I7 W8 K) c$ C! [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') e* x2 G$ V3 u! J h
2 Z6 G6 i+ `6 n
: m0 u* a* R& Q& K) l& g4 y4 f////下面不需改变////////////8 Z' D: I* W9 F' I& d) K* K
+ D* J8 U+ n0 C7 o/ @$ @
var copyspeed=marqueespeed
2 `. B' f! L' h% x! S! l: lvar pausespeed=(pauseit==0)? copyspeed: 0, T0 T `# z$ o6 h8 e% n3 P" [
var iedom=document.all||document.getElementById
; H2 C* m+ U3 r8 Rif (iedom)& J* u k" O/ |1 i- C }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 T, a& M9 u6 l0 x8 o
var actualwidth=''
9 [+ y: }" X6 p, z* Zvar cross_marquee, ns_marquee" O6 e2 p; ], G0 f
N* h1 y8 g$ Y! `
function populate(){
3 E; B0 H0 ?, P) i* S R* lif (iedom){
- Z7 z+ t7 n! ]& \2 \) wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: N) R1 N. b4 h$ ~8 V# across_marquee.style.left=marqueewidth+8! K9 |' y' ~% e4 _( d! l
cross_marquee.innerHTML=marqueecontent' d6 a! l ]1 l( |9 Q' m' L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 c8 ?$ `2 O/ z# u3 c4 ?& _7 A
}( K4 C# D& S6 y) D- F% c" x
else if (document.layers){3 W G: e/ w9 x" w6 M& g" \% `
ns_marquee=document.ns_marquee.document.ns_marquee20 }3 g0 N: S/ A+ p1 I1 P: i
ns_marquee.left=marqueewidth+8( }1 {) |- e$ B6 i# u4 y* r+ z
ns_marquee.document.write(marqueecontent)
& U) D' e$ R& R j7 P- Tns_marquee.document.close()- W3 N0 O: u+ V5 G' O }4 H. x& ], `
actualwidth=ns_marquee.document.width
[* r, P8 g3 {; e. k* s! N}& f7 p a2 U; s
lefttime=setInterval("scrollmarquee()",20); d. ?. I* Z2 e1 O# |4 H8 R
}+ t7 ]* t' }7 ?; T9 y1 j( j
window.onload=populate
( f: @# y9 L5 J O
. ]% I: M% C6 {+ C% q: Y# p& r7 [8 Hfunction scrollmarquee(){
6 ]1 N% c1 c* Tif (iedom){
2 h; U! q7 {1 F/ a2 J4 d1 Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) y2 |6 [: J# P4 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ Q8 z1 m! F7 J2 J
else6 J8 ^4 b& @0 b: G- t0 [9 U
cross_marquee.style.left=marqueewidth+8' \* V& I& U; F
4 Y' ?3 L( r" |' ]2 B4 S( d" _+ f
}. K. r. [* Y+ j* }
else if (document.layers){& T5 x& U& [1 T8 J
if (ns_marquee.left>(actualwidth*(-1)+8))
# @- C/ J+ U' q4 J H5 l5 Z3 |+ e( Cns_marquee.left-=copyspeed e3 F$ @* ^( [' O# H! Q
else
9 o. p D4 }" u' j/ c' ~" Tns_marquee.left=marqueewidth+8
& F& W6 j7 S: d$ e0 b' g}* B0 \ e; N7 j4 L
}$ M5 [, {9 _7 L+ h; j; s. B$ s
z1 _' Y! t" }; Y, ?9 Q
if (iedom||document.layers){
# q$ z$ X! g# O/ G$ vwith (document){3 ]5 O+ O1 g5 c& g7 w% u4 }. t* e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' }5 Y; w) b4 O
if (iedom){
7 t8 d6 }/ {9 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ r0 J% h+ f1 ]* f) j* M+ Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& F) m6 p; ]; H/ p# ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 V1 R1 F: [/ l
write('</div>')% v7 b+ k5 h% R; Q& r, m* }% }
}" d1 w2 k& b" O, y( f
else if (document.layers){$ m- E* M2 h; x* Q$ D) b2 h5 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! ]( a, F0 D3 b+ W9 g- b1 Z/ g( H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 f5 ~. b! Y0 o1 W5 b& Uwrite('</ilayer>')" J6 r1 \; q# M7 }
}
: P1 U' T l: [2 Xdocument.write('</td></table>'). f+ ?4 a( t1 Z, F7 s3 Z( y
}
( f8 A9 v7 T9 W/ f0 B0 A6 d}. O! i; X/ f2 [# [" Y5 y2 y9 n
</script> |
|