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

|
网页之跑马灯文字特效
//修改宽度
% T( D7 w5 E1 }) ?2 y, f) v# |1 [var marqueewidth=300: D3 k! @+ x& P. ^1 ~
//高度
+ ]( i! M4 J4 b/ ~) L9 M7 x7 Dvar marqueeheight=25: N" J4 S2 o8 o* w4 P
//速度(1-10)
! d3 [0 j% i4 e& z3 k/ @7 Svar marqueespeed=3
9 i$ H" G; K; L8 K- \//背景颜色# x0 q, u0 W; S D
var marqueebgcolor="#FFFFFF"
, z6 B5 H" H+ i6 n5 z6 C//是否能暂停 (0=no. 1=yes)?
# ?1 U% K9 j) V' pvar pauseit=1
9 U0 m; g$ r2 k) f/ s n: Z0 g j/ ]5 `& w& l8 |/ ?
//修改显示内容8 S9 I; `" |9 x# Z% \% n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 A& d; H0 d( B" ~, ~
. V) E% ~$ m; O# x! c) \9 v/ [3 Y& y2 h6 l" A
////下面不需改变////////////
: y% g# n# s9 q3 ~# ~7 j5 N8 C
! C" m0 J! U- L, tvar copyspeed=marqueespeed- P$ k; |, @5 K2 W7 z5 Q4 y7 p
var pausespeed=(pauseit==0)? copyspeed: 0
. B% H4 d8 a" Z4 M5 z- Avar iedom=document.all||document.getElementById4 f# ^0 y- k. s& ?
if (iedom)
3 U, o6 `8 b1 z) w! r Q8 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( |( g0 Y' J- I0 m' p
var actualwidth='', v0 a( j/ v v3 r
var cross_marquee, ns_marquee' [6 o# p2 E' `% d
/ d( s. T* e2 N# r3 `* z1 y+ Xfunction populate(){
x- X4 }9 k' o. M7 A, b" I4 Fif (iedom){
# p9 |- V, Q8 a$ Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( o- e. W! ?1 ^1 f% [
cross_marquee.style.left=marqueewidth+8/ a/ ~- s4 V' M; M1 u
cross_marquee.innerHTML=marqueecontent0 P' _+ \- U3 y# E4 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* q' i' {- N% j& I6 ~9 I}; Y1 ]; R. J3 X5 b+ r
else if (document.layers){: T0 t/ v: E! W/ \1 z
ns_marquee=document.ns_marquee.document.ns_marquee2) i( G9 w0 v" Y5 @
ns_marquee.left=marqueewidth+8
" l9 I k$ ]. C7 B/ |; L9 `ns_marquee.document.write(marqueecontent); O/ _, h; N4 b" O6 k( t Y
ns_marquee.document.close()
- o, M& o' h" M! ]* tactualwidth=ns_marquee.document.width: k) c9 x: R V" A
}
8 }# g% @$ a# B+ _7 a& W8 K8 Wlefttime=setInterval("scrollmarquee()",20), s" v, W# j4 j2 a- f
}5 ] M9 S2 V- M- ?3 s1 O
window.onload=populate
1 C/ m$ z* Q U0 p E% K9 S' x. K) |6 O# a* T! {
function scrollmarquee(){
. L6 P) i+ r$ B8 @) \if (iedom){" A: X2 Q" T$ \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); W( C) v3 ]& p- m: @2 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 I2 f& } R0 h# J, eelse6 N5 d1 E# p4 e4 v% i* G
cross_marquee.style.left=marqueewidth+8; G7 I% m8 |7 d8 c1 e. }' P6 {
) V& _; c9 {" Z+ c- ^}5 ^. L+ f! ]1 v
else if (document.layers){
$ U0 ^5 R- H! N+ O3 B; wif (ns_marquee.left>(actualwidth*(-1)+8))& v$ M u) g9 O7 _5 O
ns_marquee.left-=copyspeed& x2 V; G+ M! o9 H
else% J ~. ?9 r' t# n
ns_marquee.left=marqueewidth+8: B1 O8 o: ?% \2 C7 ^
}
4 |8 ~* k% p6 N3 m}
] v( U! Q ^" e7 k! B& b0 K( M5 O5 M( @* Q0 [. Z9 x7 C+ Z5 d
if (iedom||document.layers){! n- b4 Y4 D, I( L
with (document){
& M) S# R1 m: S' Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). Z% I" p1 p4 f6 U) V2 G( K$ P5 S
if (iedom){
' l. Y# e$ C* x3 J/ j) w. Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') y5 Y6 z4 ]- |3 i9 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- _: E: F: c: c+ M: T C5 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; n9 x8 u( U6 }5 Fwrite('</div>'): N5 g& f9 n/ P1 k. Q5 z, {9 b
}. X/ T+ y) z: d1 F
else if (document.layers){
5 g! `, X: h8 c. g% k' ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) V- ^' @: n3 i- w8 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' y- a2 i5 j. v
write('</ilayer>')
1 B5 L U; h S8 G# |} V9 C; z0 Z, p, E0 F
document.write('</td></table>')
: |9 O; E* c7 [- N2 j3 ]% ^}
* a" G9 `( \& X5 m) s' E! n2 S}! Z3 K, }# m- u0 P% x# Y
</script> |
|