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

|
网页之跑马灯文字特效
//修改宽度) j( M! a6 ], v. F
var marqueewidth=300* a5 [ v4 o, ^# ?/ A* q9 [0 C
//高度
7 [$ w5 a+ |( Ivar marqueeheight=25
, o: P* K, Z# l7 H* V//速度(1-10)
( Q6 b. b& {6 kvar marqueespeed=3 k ^8 Y8 E- F$ t
//背景颜色) p' c' d4 ~1 G* J3 R" \* J5 G
var marqueebgcolor="#FFFFFF"
f! g/ E) @( {4 I9 ?! Y# {//是否能暂停 (0=no. 1=yes)?
9 u+ X: j7 {% w* \3 Gvar pauseit=1& \% b: R* }. f6 ^" {. g. E" Y
8 q6 d7 y, L) z7 S' v# h0 |//修改显示内容, M3 C7 S. B. D; X9 d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# R- S9 C1 B- z1 j) N3 b& a+ D7 Z, T! v% \8 T( B9 ?7 j
# T3 E) I" K1 ^9 p4 C////下面不需改变////////////
; h& y! F/ B; q: E( A% f4 Q2 [5 x: T! Z4 Q" u* L+ l% D4 G
var copyspeed=marqueespeed/ P1 Z9 A: ]4 E
var pausespeed=(pauseit==0)? copyspeed: 0
* t8 z( G. `( ovar iedom=document.all||document.getElementById* l% S5 k1 P( Q* V7 o: k
if (iedom)
: ^6 O& I5 U# d9 s7 t/ jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' B. x/ J2 Y3 ]7 ~* X0 ~
var actualwidth=''
: ?) R }7 y; |2 j$ |' E4 ?* J8 Vvar cross_marquee, ns_marquee+ `% A- _5 D5 g1 p" F* T ^0 [6 Q+ @
; H2 O1 [) X1 G& @! b4 ]
function populate(){9 V) N; J2 x1 e9 A
if (iedom){& h( ^( }" h/ D, {5 ~5 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 d; U) t; h% H/ f$ i: \cross_marquee.style.left=marqueewidth+84 l0 M9 _5 P! p5 d7 l, B+ h7 s
cross_marquee.innerHTML=marqueecontent
! T/ p' x Z2 J2 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 B) u1 X5 _( d2 E# }0 Y" V, K
} y5 P E% [! f
else if (document.layers){ z" ?/ q6 U( {% g4 O1 L9 w9 v8 o$ Z
ns_marquee=document.ns_marquee.document.ns_marquee21 |, N5 H& }) s3 a5 } s
ns_marquee.left=marqueewidth+82 ]) }1 [* ]6 Y
ns_marquee.document.write(marqueecontent)9 T; I- B' o- W2 ] O: s
ns_marquee.document.close()6 V& D+ b2 K& Y8 G+ @
actualwidth=ns_marquee.document.width& D, _, `% V5 m; {# C9 R4 i& L8 ]
}1 z. u* R/ c T& s* u* k
lefttime=setInterval("scrollmarquee()",20)+ S2 ?) \8 F- M9 z S+ \
}
! T s. u/ b2 D. |& jwindow.onload=populate8 }: Z. g6 Z# ~- [
0 E4 x! z* z! `function scrollmarquee(){
2 }) I8 ~) I9 x( A+ Pif (iedom){
0 ], i* {+ V' E% Z$ f5 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 i8 E/ w* P/ \! R5 |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 u$ o5 |5 h: W
else
& B# J. h' \+ z/ ?cross_marquee.style.left=marqueewidth+8
2 ~1 Y" e4 J& a" a" x) h. ~4 l
0 y" \6 c2 K7 [: w$ ?* E}
7 ]& H* n8 L7 A; Y: kelse if (document.layers){: p% n1 Q8 \! ?: a5 T6 d9 e
if (ns_marquee.left>(actualwidth*(-1)+8))0 n4 ~2 D" ], E5 e$ ]- Y9 B9 Y* A
ns_marquee.left-=copyspeed* |! W- N) z7 u- P5 k
else
2 |5 P/ W5 \ L3 c5 E: sns_marquee.left=marqueewidth+8
+ }8 F. `) \; I) c6 {& d8 Y! F7 ^- g}
% F3 C3 r: }! f- d! P' D( p}3 O/ i1 g3 Q S
7 `$ b, ]- a6 D. d3 N. u( ]( v% P2 s! U
if (iedom||document.layers){1 |/ ]+ a* i! O8 T1 R
with (document){, f, c: o2 j+ F4 S' c# O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 p% e7 q. M7 f/ _9 V) A0 Xif (iedom){) D9 [5 d; Z7 |; P" Z9 M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: h5 i" x& v1 G) K2 Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 N" o9 O8 k& J' O- E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; S+ m0 n# g: f- R) i) A8 f, ]' nwrite('</div>')
/ ^' c* {9 T9 u+ g9 r( K}
: C* K' [0 M# P! P& v1 u% x4 telse if (document.layers){
2 F# ]: V, V' X) R- q8 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) @" ~* ], P F9 u' V3 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
^3 U _, @; a$ y7 V2 Pwrite('</ilayer>')2 J% M3 n& g }" e8 j0 c
}5 n3 b7 R; W( g; v( w- z y
document.write('</td></table>')+ n; R* u5 \, C3 ^/ K* |2 T# G
}8 A" l1 w7 V$ i* I+ t: ?+ x6 V7 Z- H
}0 ~, X5 I- K: J, d7 n( t
</script> |
|