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

|
网页之跑马灯文字特效
//修改宽度# e# o/ G* | ^4 O4 V
var marqueewidth=3004 a- L: O% A% A+ |
//高度: f5 [- i- e( h* j' Z) I
var marqueeheight=25
! j* }; b% N4 w0 _4 ^2 _0 ~+ D, |//速度(1-10)
4 k9 m! n. ]5 {8 b! @( m6 a$ `var marqueespeed=33 N: @4 ?, F& C Y! n3 ?* c; M
//背景颜色' `# e G5 ~' g5 b$ e4 { ?- V
var marqueebgcolor="#FFFFFF"
+ ^# w! [+ f8 F+ M: q5 Z2 |//是否能暂停 (0=no. 1=yes)?
0 O L0 H) B! Z* g B. d# N5 q( X: Fvar pauseit=1
' T" o, u# Z! a' a$ W# U: u8 [& p8 q- E# x: E @# Y! j9 F
//修改显示内容" x: B: q0 t7 N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; C( T& |: \9 q) a. |
1 q U. |, T+ f! V [- A
5 m6 T1 H( ?% w% P5 h6 r////下面不需改变////////////- B7 R5 y1 a/ [
8 e3 v$ G9 }# e4 n" b9 Z, Y
var copyspeed=marqueespeed
2 D# T* g; R& m( ?) rvar pausespeed=(pauseit==0)? copyspeed: 0
! ^" G8 x9 w: q9 T" q) Pvar iedom=document.all||document.getElementById
1 J( `$ I* G6 D s7 P, kif (iedom)
4 h. ]4 j/ x# Z' pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 s: c! ~( G& Wvar actualwidth=''
I) p- H! u2 A6 |9 w- Yvar cross_marquee, ns_marquee8 o1 }7 `/ }$ b) K
# ]3 C4 }, {9 M% @
function populate(){
6 {( A6 S) m1 Dif (iedom){
) K, E' s1 |) I: m$ F) J# lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 s- d! c- F+ t1 s' Q$ g1 C, Ocross_marquee.style.left=marqueewidth+8
7 l; G$ n# L! ]: j# c- _cross_marquee.innerHTML=marqueecontent
* s. D; C% H$ i' Z* a9 g" z2 s1 T( `1 mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% O: {: D e; N) P) ^! Y# V/ R0 {
}, k4 C" U" B7 q5 ?
else if (document.layers){
8 N. O, r7 c( S: [2 V. y3 Ons_marquee=document.ns_marquee.document.ns_marquee2
( I8 \4 x# J! h) |6 u2 T* yns_marquee.left=marqueewidth+8
; S# C. @& Q, @2 ~( r: ~+ A/ \ns_marquee.document.write(marqueecontent)
* C; z+ O5 V1 ?+ N6 i9 x. p, G2 Rns_marquee.document.close()
5 G; c7 e3 y0 \! lactualwidth=ns_marquee.document.width
/ X& _1 W0 k3 V& f4 C}
9 K4 m1 L- i- b7 r) ]: }+ V% W" zlefttime=setInterval("scrollmarquee()",20)
5 x* w/ R4 G6 D9 s}5 u2 |4 K( A5 W. S9 u
window.onload=populate3 x3 h& S- Y! E2 n; i
6 w b0 `' |+ Q( ~
function scrollmarquee(){
' i3 w; c- U0 o' _3 fif (iedom){% B0 r8 M/ ^1 k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 D# }' O7 ^( ^( C2 d; y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed U7 @1 ~1 ?! f! [
else
0 T$ g s# j+ `/ Q' g- ?cross_marquee.style.left=marqueewidth+82 S% s- Y. W% ~& a
[' H/ z" W, J7 k3 A}
% |$ j6 ?/ f7 R$ j& T3 A3 U8 Xelse if (document.layers){
4 A; U" o, k+ Q, y! K; Z5 \if (ns_marquee.left>(actualwidth*(-1)+8))
/ P; E: d' P2 @) U, l+ Nns_marquee.left-=copyspeed
, Z$ z1 K" V( o3 Oelse
+ y0 `, M% D7 _ Yns_marquee.left=marqueewidth+8 T& D) V O* ]4 n4 T, P' ]
}6 {9 t& [* ^' U4 g) k
}( Q8 [9 N, t; k' Z4 D7 x* z
) w; V) S5 {0 V/ X
if (iedom||document.layers){
# r* K" H7 L8 q& o4 ^$ F% X g& ^- U# ]6 Kwith (document){- Q v0 e1 N& R, z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
S6 o I# T# B3 n1 h9 l* bif (iedom){1 v$ m5 E# g0 }3 v( U3 V j2 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: k$ f( v$ S" S2 y2 xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! i K/ ~/ g8 i1 b8 [) wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) h2 K6 m$ i# m: y& \' ?write('</div>')
0 Q6 ^" C7 _ G}
/ \$ Y1 C" Z) t: A: ]! P+ x9 _else if (document.layers){6 u" p ~& P8 Q, M# H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 j q$ V6 H# Y! N8 C& f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: n) f( i" } K: ~# swrite('</ilayer>')$ e9 X- \5 k$ m( {7 _6 _
}. Z+ q# a. {/ D: t9 W% J" z, u( z
document.write('</td></table>')
' q8 O; b" A* a* @6 N}& m, Y. I, ?$ @6 X
}0 M: K/ E9 t3 k, Z/ j' R* F! \
</script> |
|