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

|
网页之跑马灯文字特效
//修改宽度1 U. G, _1 a$ F) p
var marqueewidth=300
0 J1 x3 _" ^, s: S//高度
& Y" g7 K5 B1 z* X6 P0 p6 P0 Yvar marqueeheight=25) g4 P w; F* W5 G" c
//速度(1-10); e5 \9 \2 |4 }# I+ u7 m7 o# U0 X
var marqueespeed=3, d0 c3 p8 k$ [+ F& b5 U$ a; `
//背景颜色
Y* S9 y4 B! G. G0 d' }& Z! Bvar marqueebgcolor="#FFFFFF"$ v. E- L& s4 u* g
//是否能暂停 (0=no. 1=yes)?
- y2 X& S) X6 \* ^) ~% `var pauseit=1
& |2 j8 G J3 ?6 P
% W& {9 O! Y2 v2 p//修改显示内容9 ?* ] ] ?/ r; P) `4 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 z- A' @; \& v
1 n. j( c. q3 J" a6 h
, ~$ Q5 R2 C1 j' N, B3 i////下面不需改变////////////
5 {9 \. {+ b& ?3 S, Z \3 {
' d( b0 I( J2 {3 G% m9 D/ B, K/ C1 Jvar copyspeed=marqueespeed& V8 p# ~; S1 J+ B7 j/ F
var pausespeed=(pauseit==0)? copyspeed: 0* u$ r+ q% `4 Y. b3 X0 [- G
var iedom=document.all||document.getElementById
9 N( f2 T- Y+ O2 F# Q) ]if (iedom)- ?! X0 F& b4 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 l5 D% B+ p- wvar actualwidth=''
) j; c e% h/ U( ^2 ^6 A# ~7 z, jvar cross_marquee, ns_marquee
. a d; x# T; P( P9 E2 k
5 t/ @3 s! C" V" k3 O. _function populate(){
! n5 v& G& {7 R( A% j7 P- Uif (iedom){- T& b2 ?+ Z2 I8 {) A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ u6 x" L5 E ~1 x6 }' \cross_marquee.style.left=marqueewidth+8
# b$ Z, x$ w( lcross_marquee.innerHTML=marqueecontent
( ?$ u* {* @/ w! Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" g) @% r7 `! y, A}
& V+ I/ |6 G$ helse if (document.layers){, K4 W+ d5 K+ {
ns_marquee=document.ns_marquee.document.ns_marquee22 A# |6 K( ]& `' f3 z
ns_marquee.left=marqueewidth+85 l/ y, m3 G; Z7 W7 ]- |0 z
ns_marquee.document.write(marqueecontent)0 M1 U2 z' B: D5 a
ns_marquee.document.close()
: C0 n% S' a7 h* {actualwidth=ns_marquee.document.width, K/ f9 ?6 t9 Q; k8 N+ X9 o( t
}# Y" y3 u* N8 z2 `2 [" I
lefttime=setInterval("scrollmarquee()",20)8 e9 U; G+ o; D+ r+ f
}
6 u$ {) ~7 ]1 W$ @window.onload=populate* ]0 C! T* ^/ \
# M9 X" N& V. afunction scrollmarquee(){
+ x+ D* S' w' m2 n: e- l- B' b( e6 hif (iedom){
7 {" b: ` y' mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) K# q Z7 F. G ?+ [/ n# V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! ~3 l8 q( j5 B
else0 Y3 n# W" [* q
cross_marquee.style.left=marqueewidth+82 m/ @, W% r u2 A& a0 M! t5 a
+ x9 A" m) Y! e}5 M& V/ F% O- ?2 D- i" ~& i
else if (document.layers){1 A, p8 u- G' N% I# S% y m
if (ns_marquee.left>(actualwidth*(-1)+8))
3 K/ @! Y! ~" C; O0 Xns_marquee.left-=copyspeed0 K* Z8 H: w5 a( k0 y) m) O
else
: I; X; A2 t6 {4 Y# b: @: J2 F0 Yns_marquee.left=marqueewidth+8
' Q% D" ~$ |4 `}) e; e* s$ D9 A/ f0 V! D& Q
}
* l+ r* k7 g9 a/ b9 {4 l' @- f
+ F7 i$ F t0 }' Xif (iedom||document.layers){. J/ q1 p7 W; O9 y. L
with (document){
4 K' k7 {0 _. W6 Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 C8 D0 O0 F6 [7 Mif (iedom){
! g* t! x1 ~4 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 G- |7 t% a$ R9 B) v9 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
]$ B, _& L9 X+ Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- ]! U# g0 J2 ~/ R4 Pwrite('</div>'), G I1 I" {8 V3 U- g0 T; y
}& R9 j5 k: j( \& X9 N. m( U% u
else if (document.layers){
$ p6 n7 Y, Z0 _2 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 R/ \; J& t" y5 ^; lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! B0 f. x) i9 o, h( }/ `% U! l) x2 iwrite('</ilayer>')
: D" C$ f( @: o# K0 p$ b}! f0 i% ?( b+ X% k( } r. d% x# J
document.write('</td></table>') A1 l5 E6 v* {# s( T
}; D3 G! c8 n$ o" c `# Q
}+ g' P5 H h2 i) O0 p" |
</script> |
|