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

|
网页之跑马灯文字特效
//修改宽度+ E- f1 T% ^6 N! W% h( }% D$ Z6 x
var marqueewidth=300( s8 P: N- P8 J
//高度
" C: ?- {9 E) k5 t3 i( r: _var marqueeheight=252 F# z- \8 Z3 o3 ~% `! m
//速度(1-10)
: e- i5 a% W2 [/ l$ zvar marqueespeed=3. d! {9 N% `# g9 G" g. }
//背景颜色
* K& p# i$ o9 x1 }3 r) Qvar marqueebgcolor="#FFFFFF"
6 m" e) }8 y7 T5 \; E) v! N( V: s- W//是否能暂停 (0=no. 1=yes)?
2 f2 s0 f" F% @$ ~" ^- |6 n. qvar pauseit=10 U k$ m7 R: R$ s. n
% M4 [+ Z& @* q* A//修改显示内容
' w+ a% O/ H- hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 l, U9 c6 L# c' T
. U7 g, b2 f# _& A9 V" J
! y; w; p4 c' a( A
////下面不需改变////////////" x- G6 ] ^, R/ _
- Y8 k. M4 a5 Q, p8 M: Z
var copyspeed=marqueespeed) N: n* L- O3 s# ]. g- o
var pausespeed=(pauseit==0)? copyspeed: 0
) Y ~7 k1 {, `7 B7 Yvar iedom=document.all||document.getElementById! M5 Q' z6 }. v, [
if (iedom)6 ~% ^- l f' c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 g8 F/ d3 }( a3 _3 O+ w# A vvar actualwidth=''1 q. s& q$ @; ~2 ?, }
var cross_marquee, ns_marquee* W/ \1 j0 Q, w: H0 I1 }' d
6 _- D7 f( `( I X
function populate(){
4 a5 }( D9 o7 S& I9 @7 ]if (iedom){0 X$ S6 ?6 N e6 o* R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 ~ T% T+ p; g1 I" c; A) U" ~
cross_marquee.style.left=marqueewidth+8
$ S1 j* u5 x6 |+ r: y9 H6 S5 |6 Ucross_marquee.innerHTML=marqueecontent& P8 ^- ?- _1 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ N( L `2 ?: a" }- _
}
5 h6 M6 e- p! m- A% Uelse if (document.layers){6 c7 W* b3 J. _* C) T+ i0 I
ns_marquee=document.ns_marquee.document.ns_marquee2
( h3 o9 {% k3 s2 m- l% ens_marquee.left=marqueewidth+8" N$ R2 y+ P3 I6 O5 ^
ns_marquee.document.write(marqueecontent)1 p" n3 s1 G) s- \
ns_marquee.document.close()
6 t5 j0 T9 `7 P2 Mactualwidth=ns_marquee.document.width; i8 ?/ m4 ^- w$ s
}: i& a) _" x# b, b
lefttime=setInterval("scrollmarquee()",20)
* Y) P3 o' ]- B}
0 f# D" [% ~0 A: H! u Jwindow.onload=populate
9 l% T$ O) a' |7 X) V% W d! r/ P' g; ~& \) V" c
function scrollmarquee(){
4 z: h$ F% }& l" t' [if (iedom){5 A1 u h* Q0 F' c2 U# _4 @+ r: ]- C" n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 H- o$ j/ {- w9 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" u8 g6 X' U q4 ]
else. E1 x, B5 a& p) d x- K
cross_marquee.style.left=marqueewidth+8
8 n9 G& e* D) U+ n
% N# Y' [* G' Q2 W$ I7 i} ~5 v6 q* s" ~4 e
else if (document.layers){
0 H" d8 G% \, F8 H8 Z9 uif (ns_marquee.left>(actualwidth*(-1)+8))
8 _' l$ J3 L0 H6 P3 p+ ans_marquee.left-=copyspeed
3 e3 X i1 f4 { \8 delse& g% {, f( z$ W! C# M K6 c
ns_marquee.left=marqueewidth+8
& |5 o _3 a% I# m6 O6 Y8 d# K1 y}
5 ~# ?+ Z8 x; y' L: s5 E2 n}. Y ^* @0 g9 n u
- H( I6 D3 E! Z' G" [if (iedom||document.layers){9 v D Y2 k; s! E( \- s6 A
with (document){
" q& C6 y6 d. X) Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 a& B6 V/ j i, ~8 P
if (iedom){) m" d2 n# Q: _" L* L0 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 y) C. S! l3 R: y- g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, y- p p2 K5 k) x( ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! B1 J5 u7 |6 Y/ a3 f
write('</div>')* `6 b( s# N' h# z, d5 O
}
+ E( Q, v& F7 I ]else if (document.layers){
8 V* F$ G2 Q1 F9 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 |/ x( k2 ]1 @9 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 ~( |9 I: w3 m5 dwrite('</ilayer>')
1 P" @1 q/ v0 v. }}, t0 v! ~, L+ Q1 `
document.write('</td></table>')8 j1 \: Z6 ` ]
}
/ O `5 N* Y' J6 x}* P$ {% y% S4 d5 S
</script> |
|