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

|
网页之跑马灯文字特效
//修改宽度
6 R) t {4 B$ w* ^# l7 Xvar marqueewidth=300
# R% G/ d9 G6 ^7 h" x/ J. I8 F1 @//高度% e4 m5 f4 E* a6 b
var marqueeheight=25
1 n' {: ^# S2 X1 F//速度(1-10)1 r0 Q& B4 \4 J1 q, g6 m4 B
var marqueespeed=3
! e) a, m) a' U) D6 s1 Q6 f//背景颜色0 ]; o/ d6 j8 C1 R+ n) F
var marqueebgcolor="#FFFFFF"
T3 W. { t8 M8 U6 B# H' I0 F8 D//是否能暂停 (0=no. 1=yes)?
, J5 a* ~' x& w8 Q& A6 _! ]var pauseit=1
0 a9 g) T& b0 A, D- h0 h% Y3 Y2 u
3 J/ x9 r; d' P. Q, e//修改显示内容
" ?8 Z- r: @! g; Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ N$ X9 F, \5 |( ^
( Y% d; }5 b3 I/ @7 t
$ h/ Y/ L0 C9 Z% H////下面不需改变////////////9 e# t' _7 a- I7 f; [. d' x
) _$ X8 d! b' G
var copyspeed=marqueespeed
8 I+ [) \6 r" a$ B+ K; Pvar pausespeed=(pauseit==0)? copyspeed: 0* P+ K3 M$ _& Q) V. }$ @/ Y
var iedom=document.all||document.getElementById
5 F1 x/ x n' S0 ?& C7 N! ^* j$ @if (iedom)8 F- d' S& N9 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Z8 A* n( m( P. X4 nvar actualwidth=''6 ?! B5 T! ]% l. R4 D5 f: x
var cross_marquee, ns_marquee3 _4 ]0 u" M4 n+ ~9 T) E4 y
* K* W7 C( a( B5 c9 L7 m
function populate(){
; v! P" ~9 j: b7 m, V* Dif (iedom){7 |7 Y- \6 y) j# g ?; Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) G' ~* S7 V) E% z
cross_marquee.style.left=marqueewidth+88 V- o9 }1 F+ O+ B8 L3 l+ G: [
cross_marquee.innerHTML=marqueecontent
( P1 s, H9 n- X* ]. ]: d+ ]1 zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# H) L! X* ]! P5 \/ c
}
, h3 m' |& a' S8 Yelse if (document.layers){
; h1 Z6 F9 O( y" w8 kns_marquee=document.ns_marquee.document.ns_marquee25 m( ?2 Y2 \- V% c! J
ns_marquee.left=marqueewidth+8
' y& I2 d) g- ins_marquee.document.write(marqueecontent)
. W6 p. `( i! V) a( Vns_marquee.document.close()4 z+ p7 F2 F4 z2 X2 t, ]9 t
actualwidth=ns_marquee.document.width2 J* _3 r+ i0 M7 n ~* V i# k
}/ G7 l# U; T; n
lefttime=setInterval("scrollmarquee()",20)
0 n- m% B2 V/ a( x* m) E8 r5 t0 d}3 F$ J$ _& r' i- H0 a2 X
window.onload=populate
Q! S+ C- s, r( u7 \ k
- F6 E& F3 @! Q$ Y2 L( c8 x0 Rfunction scrollmarquee(){" X2 h# F9 O" J, Y
if (iedom){
+ c- J) ~0 W" |5 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); o$ b0 _: w1 n h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( w3 P6 N+ u2 ~else- n) S% h `- [7 Q3 U* @, a1 Q
cross_marquee.style.left=marqueewidth+8/ N' r* d$ M. J" w
* E4 a) ?& G% E m( [3 M4 c2 ]}& p- q4 z' W) b6 L( c, P0 I
else if (document.layers){4 G5 r/ C8 h. Q+ |1 f9 h, o
if (ns_marquee.left>(actualwidth*(-1)+8))
7 j2 j l( O" z6 m; O0 Rns_marquee.left-=copyspeed
: [& j! H1 @# A3 }" Uelse
8 ?% W9 G6 _# k5 Pns_marquee.left=marqueewidth+8
1 [' O" b3 I+ i. C* ^}
/ a, U0 f& e& Q, \4 ?}
; R; G; \/ [$ e" Q8 r2 E$ h* A" d: u1 j9 t
if (iedom||document.layers){1 _7 k j$ U2 m
with (document){
5 d8 E* M9 q B2 N/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 N \4 A7 }, L# U8 _% D# z9 C$ |if (iedom){
% U4 a( t2 a6 w9 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# L6 B* q3 s, Y* g# o' x, f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! w! x% H/ {1 O2 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 H7 e: y, a' s; _. s# A; i: u& i$ qwrite('</div>')
( Z: U" K0 m7 H6 }% k2 W: G. l}
% Z1 G* @3 Y* Melse if (document.layers){
# J1 F4 J- I2 G \$ a8 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 n9 T; l+ U4 i) M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 n s, g/ S E, _5 Rwrite('</ilayer>')& W9 ^9 A" ^8 B$ b; X7 S8 S
}0 c/ \$ @8 a( R9 v- |8 [5 `
document.write('</td></table>')
' q5 d* X2 m! @}! e7 H" I$ E; g% j
}
. l! X X8 N. W( l; s! O</script> |
|