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

|
网页之跑马灯文字特效
//修改宽度4 a9 V, x. @- |, o8 r
var marqueewidth=300! ]* h2 t) T1 |( z& B
//高度3 Q: H8 o4 k3 M) [% b" }
var marqueeheight=25& P K2 R! q6 S: F
//速度(1-10)- p8 [% ?2 O: U
var marqueespeed=30 B& a/ X0 R+ K
//背景颜色
) k: g2 H& n2 h- F* Tvar marqueebgcolor="#FFFFFF"/ s$ P* v( o, r# x
//是否能暂停 (0=no. 1=yes)?
3 J1 u9 R9 u. m( [6 w' }( ?7 Lvar pauseit=1 p( O; {& V8 @: b
+ c! w, X' M: }; R) }//修改显示内容) S% v6 J/ ` X4 `6 N6 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( P; q* ~, K' X: R
( K _- r. Z$ V0 W; \; d
, i* L* P- s" \+ S9 P1 Z////下面不需改变////////////
$ r# X; w: g: m# U0 a5 H( |
* u! X7 R) f: Ovar copyspeed=marqueespeed
7 l2 e( i6 r: ?/ \5 ~var pausespeed=(pauseit==0)? copyspeed: 05 g( a/ t2 O+ f5 d! S# q; v
var iedom=document.all||document.getElementById
5 \4 m% Y0 l; }6 wif (iedom)
4 \3 s8 x) d/ }3 rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 V' ]( K, `) I6 Z# mvar actualwidth=''
7 ~5 W9 R* [ ]8 Z( tvar cross_marquee, ns_marquee
0 E1 }) ~# t @- ?! K+ w% t: S0 p. w6 J, w" g5 R/ O) s
function populate(){' q/ j- o% { w
if (iedom){0 ^7 H& ]# r8 _ {' A. V& R: I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, S4 M: W/ n: [! N4 Pcross_marquee.style.left=marqueewidth+8. n8 S+ p. N3 f# C
cross_marquee.innerHTML=marqueecontent3 A* S9 G! D" b1 H" a8 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; @6 J$ {, J2 E" t7 f. L" R5 y
}
/ @& M# f6 I' Selse if (document.layers){
, C% V! U. O! N% B$ [% g* uns_marquee=document.ns_marquee.document.ns_marquee2
: _2 ?' b2 T6 {ns_marquee.left=marqueewidth+8; U3 E& |9 t6 ?3 C5 {
ns_marquee.document.write(marqueecontent)" Y# L3 [) }# M( u2 o4 N3 q
ns_marquee.document.close()6 B' B J% F. n3 }0 b
actualwidth=ns_marquee.document.width, z2 U9 n8 H# F: j; ^
}& `1 o3 |; S' E# Y; \& G
lefttime=setInterval("scrollmarquee()",20)
. {8 Z, J# i3 W4 P9 f; e; j9 [ ^* |}4 N) |) n! ~- K3 g8 @6 w
window.onload=populate! b0 ^0 W: i: y$ C2 ?+ b% d
1 T: q Q/ s2 }+ x9 Ffunction scrollmarquee(){
, h, @8 j3 ?' r+ r' m+ I4 lif (iedom){. M7 @! _0 O A! i% l/ @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" O! u ?7 r% Y! ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed C# l ^6 L0 a2 E
else+ s( k$ x+ n4 o$ D
cross_marquee.style.left=marqueewidth+89 O: s9 w ^* [
# F3 _6 c9 ?& J8 W}4 l) x/ z# i- A2 q0 @0 z, `; _
else if (document.layers){
: z- |- x$ X+ _) i4 z' Zif (ns_marquee.left>(actualwidth*(-1)+8))' o u0 C S2 v) \' I
ns_marquee.left-=copyspeed# M/ \7 m4 X# ~
else0 t& ?0 G/ Y3 l. |$ w- z% Q
ns_marquee.left=marqueewidth+8( v. r7 x/ v) a/ A2 ?
}$ H3 ]7 r' A; o& M# r
}% t8 Q. k) B2 e2 U3 G: d
2 Q1 N* S: O* }' hif (iedom||document.layers){
! [2 O! T8 K; Gwith (document){
- O4 o0 ^/ R" N: pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ ^* |1 Q* p) W% F8 u6 Lif (iedom){) l( S8 o# N* v& p6 H8 Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 f3 Y' Q, e, b! a4 u$ c- _& jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 W5 ^4 H. h& m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). Q; c8 \6 j7 w: h, {
write('</div>')4 I" P$ E- }& o2 L9 t9 y4 e
}
$ x- ?7 q# N0 F7 N) ~else if (document.layers){* b# e5 l) m" J* @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" Z+ V8 j, C( Y6 I5 M& B+ o: Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 a* ^- u6 U b: e% P/ d, H& P; n
write('</ilayer>')( ^7 S) @5 o. R' c9 D
}. ~6 B) P1 r! {" x+ i6 ^% R
document.write('</td></table>')0 c7 U* d" Y) p' ~ c- v' g& O, z
}; s; X0 j8 G4 H/ O8 K/ [- _* E* C
}6 b! q2 ^1 b: A$ J# ^: m$ L D) s
</script> |
|