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

|
网页之跑马灯文字特效
//修改宽度
; K9 D3 h% l; R8 ]/ _7 K& cvar marqueewidth=300
6 _5 N* f3 Y. F& e0 [! Z$ _//高度5 p$ G+ K: d: n3 ~7 q1 J
var marqueeheight=25
/ [; w( @. W! v$ `( H//速度(1-10)! k+ a, \ j$ Z# e9 V5 E8 B! s
var marqueespeed=3$ ]9 U; F1 d1 y' D
//背景颜色2 t) o0 n% _1 ?7 a8 c- \' b
var marqueebgcolor="#FFFFFF") P) z* [. \6 Z: v
//是否能暂停 (0=no. 1=yes)?1 M6 j1 }4 p* U9 j% g2 X' R9 j
var pauseit=1
% Z/ w# U9 h- P' d! t
0 x: g# U2 C' Z8 b8 ]& q* Z# e//修改显示内容
* ^4 f3 z) E3 m0 N+ v& vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; b1 l/ H( k# t* C! \
2 \6 ~( |/ K+ a& c: f6 b( [& L6 I* L! x1 {5 V' V
////下面不需改变////////////
" a1 v# B. S9 {2 T* N
1 a/ w- W( U6 X% l2 X% Mvar copyspeed=marqueespeed
; R, e# K% Q( s5 _, n3 A: x, Yvar pausespeed=(pauseit==0)? copyspeed: 00 v; [$ H4 o ?! G2 X: `
var iedom=document.all||document.getElementById" Q5 `8 I+ {, k+ D* z" l
if (iedom)' k" B+ G4 V" G; P5 d5 o7 l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. V' P$ V/ e. l4 I2 `4 t. yvar actualwidth=''
) M5 j+ S- ?" P0 `1 g. J% L. mvar cross_marquee, ns_marquee
4 B4 }) b. [+ v8 n' }5 I& {* A6 v8 h* l& X
function populate(){, J: N |/ B# C& x7 J
if (iedom){, E6 T; m& r! T. z2 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 x5 |: g* R; w: p% i' u' D/ across_marquee.style.left=marqueewidth+8
& R1 J' S) I" Z" ncross_marquee.innerHTML=marqueecontent9 o5 M3 G; v6 q$ e7 f% B) V; J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! Z: c/ r1 @, z' \/ U7 G; F
}# u' A: z. V% x6 t/ Z
else if (document.layers){. s# `$ U0 X! G5 Z# A3 J/ v
ns_marquee=document.ns_marquee.document.ns_marquee2
- b# F1 _7 u5 v4 _6 \6 I4 ~ns_marquee.left=marqueewidth+8
2 v% y' j, a" j2 Ons_marquee.document.write(marqueecontent)* D# A# F# V/ M
ns_marquee.document.close()% q& D1 C" a: S! T" D; }% T' b* L- y" r
actualwidth=ns_marquee.document.width
" M/ F0 f, [8 ~1 h$ A/ R9 R3 w}$ k2 X& X# m4 V& u
lefttime=setInterval("scrollmarquee()",20)
# J0 h9 i4 o% {7 z w7 X}3 p9 J+ L% ~# d* O# ^
window.onload=populate
7 p5 _1 J( m) b# @5 B" g; I/ t; U1 O
function scrollmarquee(){
0 K' w3 ^/ P8 _* l5 R: p1 Kif (iedom){8 h. t# J) Y0 u6 c5 U6 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! I; H `# j8 h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 q* ]" f$ Q) x1 Q' e+ F: |/ L8 Qelse, O) v4 T0 Q* M5 g$ [ ?3 ^/ A
cross_marquee.style.left=marqueewidth+8
1 A% Z' F+ u ]8 L% a+ r/ o- z& P* @* W0 T9 ?
}
7 H; s( F1 K. _( K: |else if (document.layers){0 {6 J" l; j+ s# _7 F% {
if (ns_marquee.left>(actualwidth*(-1)+8))
( Z5 {1 D( @& F7 K/ f6 kns_marquee.left-=copyspeed: ^! D3 Q- _/ ]. O6 ~3 I6 P: R
else
1 V' I( N' Y) N8 M3 j6 K& N& f( P8 Cns_marquee.left=marqueewidth+8
2 }% K& s# b. |7 b}
" S, r7 c" k) w/ A! Q, ?- ]}
& W' o! _, G- V3 H' V2 Y7 M2 i6 V) x1 k
if (iedom||document.layers){# T9 r9 ^- S$ [: [" {% N
with (document){( K: y7 f" V2 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 f5 f" C9 ^7 w
if (iedom){
# Z2 H2 I5 q ]& X& t L+ @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 A2 H9 H8 }- {) y# g+ }; c3 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 q' N6 i5 A1 [0 k/ Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 [% G4 }. |# m( B( }4 p% x% ?, y( M
write('</div>')
( Q5 ?2 \) v; ]: ^: S9 D$ p- f}
+ e7 _/ i/ j. Oelse if (document.layers){# s m" {# b5 H4 ?( ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( K0 o& h; O A n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 s; U1 \( L& ]6 L, t; V9 e! I
write('</ilayer>')
) P& U( e7 ]9 r}) ]- A, Z; j5 X% Q* o" [
document.write('</td></table>')
, g, G) X9 ^5 ?! J8 _}
) p5 y3 [, [8 H7 n" Z* N1 y}
+ k5 L% d |+ I. h* D</script> |
|