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

|
网页之跑马灯文字特效
//修改宽度3 I& d* K" f6 r3 |$ P u' F( r
var marqueewidth=300
) I7 c; o0 o. V/ k% U$ Z//高度
; H! a4 }" @% T$ t) ?var marqueeheight=25, V9 p2 c4 A3 t
//速度(1-10) E, M/ @' ]* H3 u- T- ]
var marqueespeed=3
( i- D8 D, b( W6 D! C* g4 R5 A k//背景颜色1 D! p3 l9 {9 U2 X$ s+ y! C0 a2 v5 C
var marqueebgcolor="#FFFFFF"
5 }6 y% m6 q! }//是否能暂停 (0=no. 1=yes)?
6 a6 ]* i9 W. ]+ d+ Dvar pauseit=1+ o' e) d2 {, R9 h) Q# X- n
' h/ [6 }; ^$ z$ k5 u }" |//修改显示内容
5 v/ U! B: Z5 K4 M. ?+ @" Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 ~1 W' k! \7 M4 P1 Z0 v# b
4 B( ? `. O+ Z' T H0 C. L- l
$ f% @; Q: P6 A# {+ X: J" X# S
////下面不需改变////////////! c( x( @; F. J+ r
4 K5 N$ b; f9 [" i, y! a6 U! jvar copyspeed=marqueespeed6 L) Q1 _% g+ u! j9 r, E' ?
var pausespeed=(pauseit==0)? copyspeed: 0
5 i. `% f |! w! o' `" H# Cvar iedom=document.all||document.getElementById
6 A1 z3 m F; k2 F" a( G+ }if (iedom)
) E: U4 d& s f b: Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 E3 p, S. }9 S) _# p
var actualwidth=''
% S* G' Q& S8 w9 c6 E9 n+ Lvar cross_marquee, ns_marquee
4 F& z. r# D/ N. R' }9 [
, h6 V7 r" J) dfunction populate(){
& A( z4 L6 D% {" v4 M) Hif (iedom){0 J6 v# O$ I3 g5 W$ Z+ G- G$ l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( Y) E- q4 X/ Hcross_marquee.style.left=marqueewidth+8% E; O) Y( O9 v
cross_marquee.innerHTML=marqueecontent8 E3 R$ m* V; r& \7 H4 U: q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 j, Q4 i+ k( y5 Z! U}
0 O/ O1 x/ e3 L8 E- c8 B' Welse if (document.layers){
* n% K i0 f: j% c1 {& V* Ins_marquee=document.ns_marquee.document.ns_marquee2
1 j- |. o3 S# f( [ns_marquee.left=marqueewidth+8& C6 Y% C4 j6 r
ns_marquee.document.write(marqueecontent)
0 {, B7 \: z4 Q9 _* ens_marquee.document.close()
1 Y$ R6 Q& d: x9 z- ]: J. Q- p5 L* Wactualwidth=ns_marquee.document.width
' z: c& v# X# n% T}
+ u6 C4 s4 t! u; a: `2 Z8 [lefttime=setInterval("scrollmarquee()",20)0 j6 A* E" V( D7 U& \$ @
}
* J3 \# ]4 l1 }% w" z2 I1 ^window.onload=populate
+ ~+ y' h5 T A1 L) z; R$ y; W+ p$ n$ @) {/ ^3 J
function scrollmarquee(){
1 ^' h7 k6 _/ i& Cif (iedom){
5 ]* |+ M2 k% H4 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- B5 t6 u5 K# d" ]7 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 F% w$ C/ |+ qelse: Z, z- u+ e' ^3 w
cross_marquee.style.left=marqueewidth+83 B+ d* J6 E" e) R' p8 \& p
7 f9 Y9 k% _) e
}
3 g$ y+ b+ j! \; N" j( C6 [else if (document.layers){( _% u# Y4 u% y% V* {: r. i
if (ns_marquee.left>(actualwidth*(-1)+8))% [+ ~9 [" ]0 ]
ns_marquee.left-=copyspeed& X9 H2 w$ f4 h$ k+ o R. a
else
) \% w, X" H6 M* |- Lns_marquee.left=marqueewidth+81 `" p) T. n% p! N7 n
}
* d8 c! b6 c- O}
+ I# L% t( Y4 g. k9 h# \4 z* l, e1 h3 y
if (iedom||document.layers){, w. J! j% y/ d; Q) Y+ t( ^) h0 K
with (document){5 o+ K0 q$ ?, K) ]( i& E/ J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) z1 z/ J1 `2 S; Oif (iedom){3 L) d+ k7 Y! f: _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) b9 `9 ~8 Z/ w. G% p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* Z8 x' q; j% e( O2 D: k8 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 ]/ A6 Y5 W& w2 ]write('</div>')+ y& L' D5 _4 B
}
8 | b9 W1 i% v. d& k4 Melse if (document.layers){2 j* b0 b, C# q" r8 a! Q2 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). e9 H7 A- `* V0 ^) v S+ n7 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! O: d$ D: m7 Q+ D
write('</ilayer>')( ~' w" O% c9 W; z1 m [
}
5 c2 X1 Z0 C3 m6 ?0 C6 y/ H3 P- Adocument.write('</td></table>')+ E5 o" v9 Y; o1 L. k
}8 w$ i# H3 T& o8 S1 J( `; i$ a4 O
}; j/ j9 [; \8 l8 H4 \" @/ s
</script> |
|