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

|
网页之跑马灯文字特效
//修改宽度; f0 x9 \3 k' n6 x; h
var marqueewidth=300
6 r# @$ l0 }+ o; p+ e) M! u. E//高度
& T$ M: T0 G& H% [var marqueeheight=25
: w$ c7 B4 e! f. `$ B- ]//速度(1-10)
2 F3 k, q2 U! l' A0 H7 @* @- [9 lvar marqueespeed=37 h9 w. J! X2 J" [
//背景颜色
3 F4 O& S6 H0 K) W( wvar marqueebgcolor="#FFFFFF"
$ |8 M. L' B( A1 z6 Q2 h6 T//是否能暂停 (0=no. 1=yes)?
. s! P+ Q& A& B9 J( g; ?var pauseit=1
6 J9 `$ z A. l& l* T
; e- _2 R9 U8 d5 ]1 E" B//修改显示内容
. o5 T: |0 x) G" ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', i, X) Q/ R5 g8 C1 }
" G4 g8 ?9 d3 x; T! ^. U- j. M( L; p4 a+ f1 @
////下面不需改变////////////+ x2 n, \1 H% c( z5 O
; a5 ] {& K. {4 b6 v" qvar copyspeed=marqueespeed" i f4 X0 `0 j; u
var pausespeed=(pauseit==0)? copyspeed: 0
4 J' b. }( t0 I6 S+ y: dvar iedom=document.all||document.getElementById
( a% b* m3 j6 M2 `( D1 Dif (iedom)
: n u3 z( l" U @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; p/ u1 _* I( J0 ]5 g- \& U& p/ J4 ~var actualwidth=''; L( D& Z+ c$ {+ n1 }
var cross_marquee, ns_marquee
; r/ s+ `) R9 o! r) E3 [- m- O t3 N' u% \
function populate(){
8 u/ y$ z, @, Q8 N5 P+ h! V% B5 Wif (iedom){
1 h& Z5 U) C; ~8 d4 S2 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 _' i/ y( W* v& w" G5 P$ e B4 {cross_marquee.style.left=marqueewidth+8
9 k; J% {- |2 o; Qcross_marquee.innerHTML=marqueecontent
/ Z3 u- l8 w/ D# s5 k" k- u. hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* d2 ?9 m! ?+ z0 n7 A" }8 r* D8 j E}
$ n- u- E. {( ^* D5 l# `; delse if (document.layers){
/ P* v; D7 F$ t: X* R* K. n; Hns_marquee=document.ns_marquee.document.ns_marquee24 c, s3 @. \. h, y
ns_marquee.left=marqueewidth+8
3 Q l# F3 L v3 ~ vns_marquee.document.write(marqueecontent)# K" K% o, w. `0 }* r! C3 B. e
ns_marquee.document.close()/ R$ [& Z, ?% A! s- n5 S) t
actualwidth=ns_marquee.document.width8 e P! o, H& Q- Y
}
7 c& P& o, n2 ^1 T. @/ glefttime=setInterval("scrollmarquee()",20)
& T% `, Z' O m9 @}
/ S/ W, ?8 L2 owindow.onload=populate6 ^+ {0 d" e7 M. l0 v: W- Y, n9 K) N
; E/ R- B! X, |7 zfunction scrollmarquee(){" L; }+ l/ E# F% ~8 b& d( v
if (iedom){
6 m! ~, H% T( Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), F! f2 q" K* I3 T4 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" V4 N1 z d2 a" D& ?" B7 t9 `/ eelse
% O: {! x" r# Mcross_marquee.style.left=marqueewidth+88 O6 b; f, n/ g
3 A) b4 C, q3 p7 X k7 i
}7 Q1 }/ x q+ T7 e$ K: Z$ ^8 R
else if (document.layers){8 K' e7 k0 d5 I
if (ns_marquee.left>(actualwidth*(-1)+8)), M4 ~) b, Q0 O8 s! h
ns_marquee.left-=copyspeed
3 Y; J+ g: d8 L/ |# u6 l) Selse$ r# K2 b2 Z' {! [$ D9 G
ns_marquee.left=marqueewidth+8 h) b9 w. y8 ^# o4 B" n
}
" c# ?7 p: ]! Y2 `% |}
( Z9 z0 Y) t+ [: i7 E. B U" u( B7 W: E
if (iedom||document.layers){
. e( ?( d+ H r2 Iwith (document){
& ~8 m `9 j" u' N7 D; X9 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 \0 f. P K L8 wif (iedom){3 e9 z% F: _* _5 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- @3 Y6 k" _; Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 n" F; b% e0 n7 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- Q! y3 ]% B% K, U. S$ |: `, p
write('</div>')
2 c6 i5 Y( ]2 [* m+ D3 o. g}
7 A/ f- ]1 F# c! R, [$ g6 xelse if (document.layers){$ |& k( o$ Z# }6 Q( G3 ~7 w, p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( J% P6 s {& j) M* ^8 d: R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 t" Y$ Q- n4 v) A' A
write('</ilayer>'), W2 T0 k* S% N0 p# w/ A9 a
}% L3 l W& i, f2 C
document.write('</td></table>')
6 @3 A1 e+ m; ^% W# O/ l8 E/ Q}
$ a" p6 H# w5 l2 h, |* v}7 s- W" g e$ r7 Z! x$ K, [
</script> |
|