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

|
网页之跑马灯文字特效
//修改宽度
& b& M& m. l7 o2 dvar marqueewidth=300: p) r9 d0 K |1 P: l( ^* G
//高度
; r- P5 f0 q4 M/ y! Bvar marqueeheight=25
6 u, Y5 q9 f1 s//速度(1-10); _3 Z9 a' |7 v! f' T# b
var marqueespeed=3
8 i, ~* l2 `# k//背景颜色
' C7 Z. T/ }2 ]. W q7 mvar marqueebgcolor="#FFFFFF"% }, \( }" q) X' Y7 |
//是否能暂停 (0=no. 1=yes)?
) v) A; j1 V1 Z( B& Kvar pauseit=14 }. k: t f3 \0 ]
" x8 F7 K. {" ?% j: ]7 a
//修改显示内容
. [7 D: T, V J- Z3 m0 U6 k, [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) y+ L9 O8 J; @
- z, a9 ?- W7 V1 n8 M/ \8 J
% _ {; N# m( r: |8 l `5 ]////下面不需改变////////////
7 k5 ~) \: l: u' M! t- o1 @% o+ @; S* r
var copyspeed=marqueespeed! D/ a+ p! z- b6 i0 q8 z
var pausespeed=(pauseit==0)? copyspeed: 04 g$ Z" W# i. @9 F" L
var iedom=document.all||document.getElementById6 R8 D4 [! Z# J/ {. G9 f7 @! n
if (iedom)
/ `; c6 s# |7 h, q8 @; ~% Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 r% P2 b: b8 q6 a# o; E
var actualwidth=''
4 D5 r9 ~" ^/ Hvar cross_marquee, ns_marquee* X6 ~0 u( ^4 p& C% a! K) V3 v9 `
, Z( R5 y- n6 z5 }+ nfunction populate(){' f$ A: d1 B, z
if (iedom){; I" @+ e3 S1 V0 T7 m9 l; x) d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! _7 n. B8 K8 j& z$ T, z
cross_marquee.style.left=marqueewidth+8) B* N. G" C- r4 Y3 R/ z( Q
cross_marquee.innerHTML=marqueecontent: h& }4 T- f) z5 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* T0 R, L4 o! b) X
}2 ?! e% ]( {! G A
else if (document.layers){
. k* z' Y* U9 |ns_marquee=document.ns_marquee.document.ns_marquee2 Y7 D+ ^- |" p$ f' S3 L1 _: p( \, d
ns_marquee.left=marqueewidth+80 E$ {2 E! Z8 |/ S! O3 X# Z
ns_marquee.document.write(marqueecontent)
. B6 r w8 i1 r) w7 V& Ons_marquee.document.close()
/ {2 ^/ H* `- I, o0 t( {9 ^- N6 lactualwidth=ns_marquee.document.width
6 t3 ]2 f9 M2 G7 {* B; k; n}4 a: q" O8 R/ {; G1 B
lefttime=setInterval("scrollmarquee()",20)
: o" N/ }' t4 j1 S0 f' o; _* c0 C}
9 R. q% c) [. z; }! Jwindow.onload=populate
- z/ o# P$ A% Z4 U# U" l: [, w7 N Z ?2 b- e, s: `
function scrollmarquee(){
% P* u6 u$ R7 P+ P- wif (iedom){$ r# x- e" I# R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 Y7 }7 m; P k- l- U4 P+ ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' r4 H2 ?4 V, ~8 R @5 |) V6 i
else
" p( K0 ~) g, Lcross_marquee.style.left=marqueewidth+81 |- o. {& Q3 H, y) e* S; R3 G
/ H0 G j6 `/ @# g}$ t: ?6 @ q; Z0 h( l) q7 _
else if (document.layers){
' Q! @: [5 Z& p: J: _* F, tif (ns_marquee.left>(actualwidth*(-1)+8))
, ?+ |1 L+ [! K( q* ?ns_marquee.left-=copyspeed- X% t4 g' J# |4 j! Q
else7 R) u" r, A" z3 a
ns_marquee.left=marqueewidth+89 a/ L$ t& t& d4 }. G+ e
}! |4 b! a2 {. y. v2 _! m- q
}- s- ]! a: e3 t; o. f
; w1 J% |4 s5 i- g+ M# T& k
if (iedom||document.layers){/ ^9 E6 @( G1 E9 u' v
with (document){
; r* [/ \0 f" @ T6 g: Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* a+ g% n( s4 Y7 y3 Q1 S- wif (iedom){ ~4 P6 y3 ^; P K3 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" ]' A6 Y/ C0 D$ e9 Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( I7 M8 ]5 \' F0 ^5 B3 U# P, vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') | O0 J3 W5 E: k$ t: q' E5 d1 v
write('</div>')0 T& m" b1 x: m; q9 t' Z/ C+ h8 E5 M
}4 z) h' s& e& P9 y( L& `
else if (document.layers){- ^) L& \: Q% n4 {+ U: h( j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 W0 E/ \* X3 l6 y+ I& c& O+ Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 A5 \4 S' V$ [
write('</ilayer>')
# f3 `0 S8 ]8 S: Q}0 g( @, `& s/ R1 {( b, Z
document.write('</td></table>')5 N' A# Q! Z2 j/ H7 |: t) k
}! J$ {# \- R: m' q/ B
}! L8 g# h& o% u+ {3 t, ~$ ^7 @
</script> |
|