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

|
网页之跑马灯文字特效
//修改宽度( p# S* @6 i3 ^: _7 U
var marqueewidth=300
0 O4 T& Z- S) O0 Z& `//高度3 [& a; R" B6 d- f# i
var marqueeheight=25
( A3 |. v- c7 T" J! ]//速度(1-10)! K! l" i9 v& b( a o" N
var marqueespeed=3
* V7 T1 R, f6 Y* }% ]0 ^- C: L9 k% p//背景颜色
1 m6 R9 U4 s0 j( K: |var marqueebgcolor="#FFFFFF"
% ~9 N' w) t/ U$ ~, m2 K4 O$ I//是否能暂停 (0=no. 1=yes)?6 f+ n2 t9 }) r% q; p" A7 l3 i: ] R
var pauseit=1
( @5 j1 t7 s) {( d; j/ \: ^& Z# I8 G& L+ f/ S% T2 {; J% I$ A% y
//修改显示内容# U! L: j0 m) q- I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ \- a6 o5 Z+ k# B! k
2 [/ m# c6 I( n, V+ P2 p! E, B2 G9 o# T8 c
////下面不需改变////////////
$ l$ P: a7 e% |' X. Q1 {* m% g+ x* z# L: _
var copyspeed=marqueespeed
3 f$ W& W+ i/ ^- [var pausespeed=(pauseit==0)? copyspeed: 0' K' D; e; Z+ ~+ `
var iedom=document.all||document.getElementById( Z8 m# J, |1 p8 w/ N$ I' j
if (iedom)
* G$ c/ N5 o9 s; `. Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). a2 r, H1 d6 z! V+ \9 V
var actualwidth=''
% S1 C0 g% \6 d2 `1 Jvar cross_marquee, ns_marquee
/ C- ]; j% w. x
* S% ` m* L, Z+ U& bfunction populate(){. p; [. Y) u4 u! P
if (iedom){, Z. g+ w0 q+ }+ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 E1 g/ v: F: q" }9 g1 K
cross_marquee.style.left=marqueewidth+8
' g8 e: s+ K* y" W) [$ q. ~cross_marquee.innerHTML=marqueecontent. [0 } ?! v6 m# {3 I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% W- U1 z2 U" l" }0 n! E/ Z
}& u7 Z; g! E6 J' Z" C; w% V# Q1 O
else if (document.layers){2 T: u3 d; N+ S6 g( f" i+ A
ns_marquee=document.ns_marquee.document.ns_marquee2
8 g: q8 C% N) O& t- F" gns_marquee.left=marqueewidth+82 Y9 j" E1 c% f2 T" G
ns_marquee.document.write(marqueecontent)
) q6 w( B1 j: \+ m0 Ens_marquee.document.close()/ H& Y/ U3 X6 \$ P4 G
actualwidth=ns_marquee.document.width
9 J" C& S7 D4 E: `( ?}
9 m; u& `; H) i$ Z, k, u/ X0 @lefttime=setInterval("scrollmarquee()",20)9 D- D) r% E, J3 H$ S, V$ T2 D
}
( W+ t5 m+ z# U. c4 H6 Gwindow.onload=populate+ [! w& M% C4 m3 ]9 ~* I
3 H% s+ f% L! ~# U
function scrollmarquee(){
" Q5 B, w* K7 Y. y2 Q8 R4 qif (iedom){- S8 y' K. O% v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" X: W) {& y" m A- ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' G- B' a' r* Z6 N0 g; t- ` A5 X) w
else# h, d+ \$ V! U8 L; t$ @ D
cross_marquee.style.left=marqueewidth+8- k: U: B4 [, C9 s
; n n* n( v- m$ _}8 U" ^$ K9 U+ d5 f W0 y
else if (document.layers){
, c: q2 b H2 J7 K# r) yif (ns_marquee.left>(actualwidth*(-1)+8))
- ~6 D( y$ n# E5 I1 Hns_marquee.left-=copyspeed+ B7 ^& d2 ?* y6 ^: o+ n
else. H3 I. r- |& Y( g- |7 E3 k H
ns_marquee.left=marqueewidth+8
8 Q' f+ r& e" Y0 `0 W8 L}
# J; H0 N0 `! x7 o6 c& N}' `8 S& r& v' W2 D% ?
# h6 D* a$ Y9 Aif (iedom||document.layers){0 I+ z) r( m5 }' H( Y2 Y+ y
with (document){! a5 k: _4 u4 `- o7 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). e1 o" s- u% ` U/ ~' h4 f
if (iedom){
) J1 X) X3 o# {3 N' ~. z. Q8 Y; ~3 Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& r* ]) }4 l' b/ ?& m) N& N1 z- e+ Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& C# ]& ~$ P% G& h: Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 g) N7 ?3 d0 k1 q7 b7 N( kwrite('</div>')
" V g) I5 Q. f% Z}
7 ^# {4 r/ j/ d8 D: Lelse if (document.layers){: T8 U2 O3 C: _! Q+ n( q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' k/ [/ {8 B1 v7 e' mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& d2 K5 x5 _1 ]* ~; a0 H7 kwrite('</ilayer>')
# P/ J4 y1 p: [9 k0 I2 ?}
6 f8 G$ `5 F$ H- N6 X+ M" B: Zdocument.write('</td></table>')
) r: S% V Z* u" y/ ^, d+ _3 ]}# C2 Z# {5 x- `( G8 S J
}8 D1 H# ]: h$ A+ w: z& N
</script> |
|