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

|
网页之跑马灯文字特效
//修改宽度0 w- H" f* D3 ]4 G% ~" M W: ]7 W+ ^
var marqueewidth=300( o3 K1 ?( q& {4 E: c
//高度* U, i2 s: o2 K
var marqueeheight=25
/ `5 s% k4 x' l$ K//速度(1-10)
+ ^0 }/ {: Z3 i2 Qvar marqueespeed=3
# u# B+ }( f0 A0 l' S3 D3 [//背景颜色
8 t6 s5 J) `+ @. E# a* O9 V& R; uvar marqueebgcolor="#FFFFFF"
, O1 V. w3 p8 y//是否能暂停 (0=no. 1=yes)?
, w" P; [( S! s$ g' Lvar pauseit=18 [: i2 C) _, U/ r
0 ~) S2 z5 i1 o2 D3 `( J! _//修改显示内容
% f- ~: w5 O$ }( U5 }' N+ ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ y6 @' V% T: G3 e2 B: B# c
9 {5 x" G( o. i4 P
7 ? q+ x$ k" k" q////下面不需改变////////////
0 M0 i1 @1 A" d: F
8 { J; _* z. m, o5 j# Yvar copyspeed=marqueespeed
2 P- z# l1 i; W8 k/ P7 nvar pausespeed=(pauseit==0)? copyspeed: 0
$ Q9 i; q3 ^& g. W$ I$ x* Ovar iedom=document.all||document.getElementById1 X+ F0 w9 o' c% x0 h) l
if (iedom)
; @. @) H) P0 R' {7 B7 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, t5 T- [% R& J1 y; q+ dvar actualwidth=''
* y. R- o" ?- I% B2 kvar cross_marquee, ns_marquee6 e6 S: V. Z" c
7 ` _7 q/ u+ Q3 h i, p1 ^- D8 wfunction populate(){* x2 M1 @9 @2 {/ L3 i
if (iedom){7 _( H% y/ t2 `# ^" p$ i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 b! H0 P" p( [2 v5 N3 f: q
cross_marquee.style.left=marqueewidth+8. r. r- a* o/ `% r+ A
cross_marquee.innerHTML=marqueecontent
6 \* ]. b0 q5 e2 p( T; Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ j5 \ q$ l3 x
}
' I8 I) H/ s0 i9 G: h$ l( t7 Eelse if (document.layers){3 `2 e* |6 K/ J8 a, C" A5 {( [1 f
ns_marquee=document.ns_marquee.document.ns_marquee2
' V( b- H5 {- W: Jns_marquee.left=marqueewidth+8
/ |' T. b) c& v2 ~ns_marquee.document.write(marqueecontent)3 L- R9 U! M" G9 ~
ns_marquee.document.close()
' u; u) R$ t* i* lactualwidth=ns_marquee.document.width0 ^4 ~$ g, L2 N/ @
}
O; g# F, k. c6 xlefttime=setInterval("scrollmarquee()",20)* k& t9 }- h7 c
}* r# Q- P1 p, H' [: A: g9 O. D! f
window.onload=populate
# j# k, R k( Z# E* k
" m) s' y, U5 x0 ]' |* sfunction scrollmarquee(){' h- c1 a# i8 E
if (iedom){
' E# E( S. w: f# c* h( D g* Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ N5 Q/ j9 `0 b7 O; O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ W2 R) r0 o% i: B! ^- Yelse
A- ]" b! u. P5 j+ P L; Y3 L& gcross_marquee.style.left=marqueewidth+8
: W% d6 _4 ]8 {/ X+ m% J
1 K( h# \9 D' Y) |8 R}
; f# s0 E9 v9 L. W3 oelse if (document.layers){, _" T% q) E6 \
if (ns_marquee.left>(actualwidth*(-1)+8))
2 F! t: G: p7 A9 R" u- ons_marquee.left-=copyspeed: n: b% W, `6 t* \, {2 M. q
else
~9 ^6 s7 I; d" ~, ~" d7 X, C2 Wns_marquee.left=marqueewidth+8* G5 v2 ~# n& l% p$ k$ R5 s
}
- _" p X' H7 r) @ K3 O0 J2 k' S X} t* Y0 C7 c' s7 k7 `- J' w* k
; F* W, J {. P ]1 T
if (iedom||document.layers){
: f* z+ Z$ o7 n* z" K" S# F3 Kwith (document){! V5 j4 _( L+ h {1 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 i$ P! r9 Z$ j8 Pif (iedom){6 v N+ N, [! {5 L% \ D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: t# I m; V9 n$ U' q/ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 x$ n @! G- Q2 @' ?. G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. r3 ]0 E1 V2 O6 nwrite('</div>')' @) e% P, ?" j8 R+ g# Y
}* p) {: Z; r% I
else if (document.layers){
: n% y$ h+ j- x: |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 B9 b/ ?* U- ~ p, @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 y7 f0 H0 Y/ [4 s
write('</ilayer>'). X' N: e7 Y' {3 c+ Q7 R* _
}7 @- F1 h1 Q) d; j
document.write('</td></table>')
) K8 L$ r4 q, ~, q. w}
2 ^/ A% h3 v7 F+ Q6 i X2 R+ L}
# e2 r, @" M3 ?9 p2 [+ q( a4 V7 D$ ]</script> |
|