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

|
网页之跑马灯文字特效
//修改宽度8 t" j. Y" K/ d
var marqueewidth=300
I, v+ X3 `7 }5 s8 G. P//高度: C6 R) D: Q ?/ K6 Z6 |0 W4 {
var marqueeheight=25
3 f5 d/ Q# F* q D3 }: h//速度(1-10)
/ w& D1 U' j' {( [- O8 Evar marqueespeed=3
' f- [; Y7 P4 u1 y' q" `, X//背景颜色
. X0 X( }2 V @& W8 a' f, t1 z3 X# ]var marqueebgcolor="#FFFFFF"
* U5 x# j" [) u7 @! R8 x( G7 u6 M//是否能暂停 (0=no. 1=yes)?
2 d0 h1 v3 h* Y6 Qvar pauseit=1
) ]2 G! o$ U; p' p, T
/ Q, ^. C& f; g9 H$ b& b//修改显示内容
$ |2 z/ D9 T, p& u! }* E% Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- T- E9 @$ X3 L8 r
# b+ a" N; @8 h0 X& B# u) X4 p/ h2 l! G6 f# J2 ] h" [: d
////下面不需改变////////////3 p9 X: Z2 S6 U3 K' _
. d8 o$ d9 l8 Mvar copyspeed=marqueespeed! n/ y# t4 c2 w- k
var pausespeed=(pauseit==0)? copyspeed: 0) e2 H5 q0 [) K2 d! L; J) _
var iedom=document.all||document.getElementById
E4 q1 f8 r# t+ Y$ ?if (iedom)$ b1 U9 u+ U" F( Y: o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 z! s8 e. l' d, r2 q& ?2 h/ a6 Yvar actualwidth=''
8 y/ y S: g" o' }var cross_marquee, ns_marquee$ m2 a P: E5 B' F: D. p3 w5 R
, n6 X1 j7 Y2 S; F1 L0 S2 h1 Gfunction populate(){) o/ \1 L' M. d7 }1 c% ?
if (iedom){4 r4 [& D6 |/ T# y3 z: Z0 M Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, \. i; t6 z0 F$ g& E! r
cross_marquee.style.left=marqueewidth+8. v& O1 ~9 p+ b! P, }
cross_marquee.innerHTML=marqueecontent% ^ D* {; j4 }& v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth P8 \6 k" K3 q! j6 Z! @( {" r0 C
}
6 M7 A% \. K- k# Q, Qelse if (document.layers){1 W& s1 l" G( `2 l6 J0 x* l9 Q
ns_marquee=document.ns_marquee.document.ns_marquee2, R" D* S( \: H
ns_marquee.left=marqueewidth+8: N8 s' M0 X' _
ns_marquee.document.write(marqueecontent)
$ { Q" x8 _& e6 B- @ns_marquee.document.close()
" z+ K6 J" C8 ~9 w+ u' m# ]actualwidth=ns_marquee.document.width7 U0 B7 F4 l) A4 G
}0 i! j2 F: H6 d* F+ M4 U
lefttime=setInterval("scrollmarquee()",20)
3 ^* u/ N& {6 X/ E2 Z: h}' g1 h- d' s, y$ n
window.onload=populate
6 L7 K. c& h4 `* N8 _- u& d& P+ `2 F; s7 e; u
function scrollmarquee(){' `: T4 m/ }6 h9 Y
if (iedom){8 ?* X: X) S f. u& Z) l- A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ G8 i7 U# c8 w1 j2 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 }; \ ?1 n; z; K2 z2 c9 M/ `( ]6 n
else
: {7 {, F) K2 m: L1 Y: h8 }cross_marquee.style.left=marqueewidth+8 C' v+ o' g4 f4 a
7 \6 @6 |/ P" u7 [
}! F. L* ], h1 [/ O, l
else if (document.layers){1 v( w4 T0 `+ p: b/ J( ?
if (ns_marquee.left>(actualwidth*(-1)+8))
6 T9 {$ x+ @' e3 {7 u& E4 vns_marquee.left-=copyspeed2 D$ s! c; x( n
else, n( A" G8 h8 ^# D! p; g% V
ns_marquee.left=marqueewidth+8
" ^% l% G# r8 S- P) K}
2 _ G# J5 ]# ?3 \" }, X' |}
+ o* a o3 @# Q, N# [" m) m9 ]5 C! N( ]5 ~/ P& `8 |
if (iedom||document.layers){
, I7 T; E4 L4 z9 h# J5 Rwith (document){
4 S6 x; J* O. p$ E1 d1 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. o9 G: y& J8 pif (iedom){
: T( G2 Z! y3 j, H$ ?1 ~8 s* awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! ~; [$ j( f& L% r( Z$ B7 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; T3 q$ Q: Y. w$ s+ t0 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 q% K% b- c7 ~# z# `7 c+ Y! _5 ~3 \write('</div>'): f. U f! ]1 ~7 z! |% q, N! `
}% y( R% d- B$ a+ t
else if (document.layers){
3 \) _: \- T/ Z+ K3 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% l& ^2 [/ [" |2 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% F! B5 U* O% i, g' A
write('</ilayer>')2 O) |8 P, [! f; g5 X. O# N
}
) g) h5 F4 r8 [/ K! ?% R: ~) Cdocument.write('</td></table>')7 n" A1 q6 n4 X# \; f6 Q* B" r
}; P8 U0 M1 Z) R
}
/ q, z S, @3 u! f- d3 A: U</script> |
|