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

|
网页之跑马灯文字特效
//修改宽度
2 t7 {& V5 z% S5 I8 p- tvar marqueewidth=300' a. @8 u5 ?7 a0 f- I1 D
//高度: N7 j# s$ f. ?: x* b. n1 w% C
var marqueeheight=25+ M4 k5 f0 w% t4 }9 j
//速度(1-10)8 \: R8 W; ]. t) p- b9 v4 }
var marqueespeed=3
* D1 a( s+ o$ b; |, K//背景颜色
% u8 ^! H5 [5 l+ X, h: R* J4 Uvar marqueebgcolor="#FFFFFF"7 a+ X/ h# ^- m0 l
//是否能暂停 (0=no. 1=yes)?
/ `5 d$ h2 I @5 O+ g% G$ d. c8 Q tvar pauseit=1
; b7 i: e1 B. B0 P. e* c$ w8 m. W% N( n* H, l* Z- `0 U) o
//修改显示内容
% u/ C: K7 D% ~/ nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 `/ J- r( R) o5 P6 Q/ T% a! i3 i; ]) Q! O. ]
+ m2 J; l* O) Z/ F# z////下面不需改变////////////
- x- ?" N- o' f
9 y2 j- Q8 P; g- }, zvar copyspeed=marqueespeed
1 `; D: }0 S: {0 \7 [4 {& A2 Ovar pausespeed=(pauseit==0)? copyspeed: 0
* N3 z- a7 E4 [% S- f& {+ ^! mvar iedom=document.all||document.getElementById
8 L# l, c1 \0 p6 C2 }" }+ @if (iedom)6 ` w. O+ K$ o4 w3 O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- ^& j: t) i' zvar actualwidth=''
5 N: c0 V" y2 Wvar cross_marquee, ns_marquee
1 h4 W0 h7 Q F6 N% W& y8 j2 F* b+ z) ]) F/ x5 N- U
function populate(){ x4 c2 r5 ~ Z) }$ Y
if (iedom){
5 f$ q) p8 h6 _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ p' F5 b$ x/ l1 b2 G9 C) Q+ w/ ?# Icross_marquee.style.left=marqueewidth+86 E7 Q2 x8 A8 S3 T/ ^ T7 `7 j
cross_marquee.innerHTML=marqueecontent& v2 x4 c$ o, J, f$ r1 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- Y+ F. C8 J( _
}
- K1 ]- w: K! Oelse if (document.layers){" s6 V% g; `) u
ns_marquee=document.ns_marquee.document.ns_marquee26 N$ C9 P) h2 W
ns_marquee.left=marqueewidth+83 A$ p- n- _' H c8 j0 J: M
ns_marquee.document.write(marqueecontent)( H0 M5 s+ |' m: Y* B
ns_marquee.document.close()3 b6 b0 L; f$ K D$ H0 [
actualwidth=ns_marquee.document.width2 N+ `" }: y. Z* C! H8 E
}
: O. ~, H0 z8 O7 a: n9 {2 J& b* dlefttime=setInterval("scrollmarquee()",20)6 a5 o% x2 A: x' K4 `( \& {
}
3 a/ d0 S$ ~( d- d5 f3 vwindow.onload=populate
! g7 t5 L7 i9 `7 W) |% J
C4 b2 |+ x; }, Nfunction scrollmarquee(){
3 N5 x) L, w& u/ U8 u6 [if (iedom){
L+ k8 G e, ^ Q/ r4 G. d0 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ Q9 U* D0 l5 u' l; Z( X. r, V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. ?8 Q( R: k% ]( S9 W
else# Y9 j% ]* b- _; ~
cross_marquee.style.left=marqueewidth+8* r& g+ Z; U; p+ e
0 |' c5 E8 X1 ^1 K: \: W& y
}
8 T/ M/ u; Y; t. [- H! k: w. @+ celse if (document.layers){
; V' G3 X1 @2 B/ A% L. U: eif (ns_marquee.left>(actualwidth*(-1)+8))' j/ `: x4 A( m* k @, {! X& l
ns_marquee.left-=copyspeed9 `' u! I0 m5 n {: I. B. H
else5 F8 _! V% n' z4 k
ns_marquee.left=marqueewidth+8* f6 ~; v9 S1 x% P" M
}
; c+ l% W! z& [7 n- G3 X$ m- w$ p7 a}
8 U$ ~2 V4 G5 }0 q/ R$ H
1 {' s# h& W7 ~: n5 hif (iedom||document.layers){
. n7 m! x) _' N% v* rwith (document){2 G& m/ E0 f* R$ g7 r2 D* C5 {8 s7 A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# @8 F- m, w8 N# U- S' U5 S
if (iedom){( [4 c* M8 F1 F I9 Q& G2 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# A8 m, p% m; K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! m: p& w3 _7 ~2 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 k. c9 g2 j4 G! M0 F& u6 cwrite('</div>')
) {9 I0 E+ p F3 D3 ]0 v}' l; K5 g9 p! N- v. C; b
else if (document.layers){
) J2 i% m. L$ t. R( Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: t9 x* S8 C& {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ c* F" n" s# j" u6 S0 N* A
write('</ilayer>')
5 w Z: P4 ^3 R' o, X* N}) r. E( Q: A: E( ]* |# t, l
document.write('</td></table>')
* P4 s7 m9 H; Y+ L5 A}
# n E! M6 d2 D: P}
# N2 L! \/ K9 n1 e4 s* Y</script> |
|