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

|
网页之跑马灯文字特效
//修改宽度6 B4 z! U- l/ s
var marqueewidth=300
* ^9 d2 \) U& X' m7 [# y% @//高度
4 ~% H% e) e- c7 cvar marqueeheight=254 D S" e7 ?$ C: e) M1 N
//速度(1-10)3 T$ I( c' e1 N: ]1 e$ i
var marqueespeed=3
) w a6 @3 @+ k0 ~2 G( X( V* o7 e! o//背景颜色
8 l7 I; a" p) f( s, H8 d/ J/ Pvar marqueebgcolor="#FFFFFF"
: H& Y) O. a. l//是否能暂停 (0=no. 1=yes)?
4 s1 A3 `1 u( j+ Nvar pauseit=1
" t6 l* {( D6 x8 L- V5 j- b+ K: ~
//修改显示内容
$ V# P \- _7 e, E" V2 R2 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& u. l- @; g, K' O$ i
3 e8 F& ^! z) L6 t! o' H9 G7 R J/ [% _* D# q3 X
////下面不需改变//////////// g, F O9 C0 ?9 a" ?
& k2 {5 D, ]5 [( o% X9 ]7 A. T
var copyspeed=marqueespeed
* k8 v% y( g, X5 A* b5 Jvar pausespeed=(pauseit==0)? copyspeed: 0% c' X0 j# w6 G( R3 t6 v
var iedom=document.all||document.getElementById6 L' [7 Q1 q+ K, A
if (iedom)
" h7 D$ v4 N. k. m% z% ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ p+ b- d6 s3 a. u( @! S8 X
var actualwidth=''
( _5 B1 T9 [! B2 N0 M' D& |var cross_marquee, ns_marquee
+ B+ B6 G, C9 F3 U- }
# J) s0 k: D8 p0 |0 G8 G" g) ~function populate(){
* \& l+ i( O: ]+ i' m! e1 U( [if (iedom){
0 |8 s- g/ F, G: R1 Y7 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ V, Z6 j' L( ~8 j9 }- U0 _$ Tcross_marquee.style.left=marqueewidth+82 b9 r8 G- [4 e" B* k$ v
cross_marquee.innerHTML=marqueecontent
7 P# X$ C& W) g! v* xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- N. G0 ?, N w( c- M
}
0 S& _7 ?* } ~else if (document.layers){
' v4 c8 b: f& l' i/ t/ Zns_marquee=document.ns_marquee.document.ns_marquee2; j& R k* E ?" Z
ns_marquee.left=marqueewidth+8 @: P# M+ p3 w H# S1 \
ns_marquee.document.write(marqueecontent)) r n1 z+ k2 ]0 z% \6 v
ns_marquee.document.close()
9 a/ |1 |6 H' q2 [& [+ Z- L" X! mactualwidth=ns_marquee.document.width
2 p- C9 h: o% _! q}
6 ~6 |/ x: {4 z- Jlefttime=setInterval("scrollmarquee()",20)
% a6 d: }: g% n) c2 p/ ]& T# T; G}
s5 O7 A$ k9 rwindow.onload=populate
$ T& L$ q. k6 ~# F
2 Z" f1 R6 c% z$ `; z6 ?! Bfunction scrollmarquee(){
0 e8 \8 {% P9 |2 Iif (iedom){7 ]) `2 l1 w, v% z7 a& h+ E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) z( d/ t1 l. ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 `4 z, r; B- V+ U; a, r
else2 t7 d" ]5 t. A4 E7 ~
cross_marquee.style.left=marqueewidth+8
1 F: h- F9 T3 T* F# F* P& P) v. B) x' K4 `5 @7 v( {
}
# p5 d4 Y/ s: W9 d5 qelse if (document.layers){
- M# g% }- M# c! o: A7 s3 u2 aif (ns_marquee.left>(actualwidth*(-1)+8))8 ^& o. z* s. K4 ~! O+ o$ q) W# y
ns_marquee.left-=copyspeed1 c2 `- d1 T7 t6 N9 Q$ B5 Q
else
$ K; Z! i1 ?% f" I mns_marquee.left=marqueewidth+8
9 j5 v* ^. ]( d}2 F; V4 S' D% u. \
}
! x4 W) ^8 v, ^* F
7 _: T* P' l5 [# x0 oif (iedom||document.layers){
9 M) X0 N0 c7 E2 @4 k2 {with (document){
. Z- N6 H+ Z( w7 k1 V* S; v: Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 J3 K: y& U; u! Z) O/ j
if (iedom){6 q. Q" c. F) e$ ]: _3 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 f# X6 j6 B: Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: g& n {' G/ E2 N% ^/ iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" W% W5 W! t, a) u3 H7 bwrite('</div>')9 g* D W6 i' ?* k7 r" [- D M
}4 B, O; b7 b+ q3 x1 g* f
else if (document.layers){
: c/ l, p" V* C; W3 V! Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% K/ I. b: N8 _/ k- G/ A C( m) Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# N( H1 C, t) ^0 u- Fwrite('</ilayer>')
/ {# E) B- l: J8 K R! P}8 m/ O2 @" L; E
document.write('</td></table>')
+ m' C+ M# {" K* l( _}& s ]" f( ~' j N. N f: b
}
( B0 X+ x8 X5 W</script> |
|