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

|
网页之跑马灯文字特效
//修改宽度
" f8 _' a$ r8 P) u( V) mvar marqueewidth=300
! y; p7 r }$ z( `7 j//高度
1 V0 Q4 d: x8 wvar marqueeheight=256 y4 J; D+ p0 e
//速度(1-10)
1 J( y) y( ~. f- ~/ d) h6 gvar marqueespeed=3# L$ J( K. [: A) W1 G
//背景颜色) H0 M4 ?; l5 a6 F+ m9 T
var marqueebgcolor="#FFFFFF"
- R i& K" I( {4 Q//是否能暂停 (0=no. 1=yes)?
- O& {0 X, t! uvar pauseit=1
4 y5 X2 m; _) `, Y( j+ x# z5 U
: `) d. o3 j5 @ u# Q//修改显示内容4 S8 @; D' G# L/ H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', z9 b9 E; w: { }) A; X9 K
$ d' r6 B" m* z( z6 b* F) ^0 M5 R; c0 b
5 o' t/ C" L9 |3 H: J$ i////下面不需改变////////////
3 u1 k3 f6 I0 V" c8 ~
" C, A4 T" I, L( m" y2 yvar copyspeed=marqueespeed
8 W# y2 ~* e4 W. F" cvar pausespeed=(pauseit==0)? copyspeed: 0
6 D& l# g+ w3 u# O. Hvar iedom=document.all||document.getElementById
7 A4 P& ^/ S3 x R2 i* Pif (iedom)
' `# A# x8 B, C K/ i$ r2 P! fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! v1 X: M) M) s7 I# } ]
var actualwidth=''
) ^1 U3 S0 { o" z5 r4 b1 {( Dvar cross_marquee, ns_marquee
/ j8 H. R+ J7 x0 k. r4 Z/ T8 P% E& X
function populate(){5 v/ L% R8 s- s" z1 W3 l l, u, b
if (iedom){& |! c9 L$ x' d1 Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 n+ g5 `( ? u @
cross_marquee.style.left=marqueewidth+8
$ S) c$ m; K% \cross_marquee.innerHTML=marqueecontent# R8 J" v' p- j' t* l: X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 }7 |: r- U2 Z; l* ]- C7 p. d, J. I}
, W% c3 C6 m/ l6 ~: Ielse if (document.layers){
5 O/ ]6 O2 D: i9 d. D$ Kns_marquee=document.ns_marquee.document.ns_marquee2/ h4 a" h( p' [
ns_marquee.left=marqueewidth+8
$ s) M7 i% M$ Y, b0 P3 ~& vns_marquee.document.write(marqueecontent)
& g1 O. Y! J& Ens_marquee.document.close()
, a/ F7 c, k3 h4 c- m5 q( gactualwidth=ns_marquee.document.width* }* P/ R1 t# C4 F; Q
}6 o- Q, L0 k9 \# k5 b9 b) @% P
lefttime=setInterval("scrollmarquee()",20)
6 q3 Z5 K, z+ g6 E; o}' y: y! ?' j5 e9 y
window.onload=populate
1 r# E* \$ z$ P5 J" d
6 i2 h2 P3 u: X: @" ^function scrollmarquee(){
% S6 Y" @( i, Hif (iedom){
5 Z# E. M9 \5 l5 L; O& }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! g; c/ @: m- j" ?$ n: V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) j, l; j3 k2 H V4 _4 ]" ]else
5 e& s8 z+ P7 u% x" ~# b! _cross_marquee.style.left=marqueewidth+8
! b9 U" k" G1 S+ A* d2 M, L9 V4 t3 ]2 h2 k% K" [. y# b, Z
}* T3 y$ W7 o9 l0 ~- v- L
else if (document.layers){) Y' V' T ~" N) M
if (ns_marquee.left>(actualwidth*(-1)+8))
7 n/ U6 l2 U7 t& }: m, M: ^6 Zns_marquee.left-=copyspeed$ U+ q2 H! W1 C4 U1 r, A2 e( ^. U
else
9 u' C3 J' J Z8 }* @ns_marquee.left=marqueewidth+8
" Y8 g% D5 Y J2 {2 a}9 [, S# H3 |& L% _& m' ?
}
: o" f. w6 q; g* j8 b9 z' ?* F- S0 x- {& l2 r
if (iedom||document.layers){
. s. k7 `5 r( F' q0 Z/ T& B6 Wwith (document){
/ _, }% U1 r$ t* rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( ]2 X. S, n2 Lif (iedom){" v8 L: ~4 R5 H( v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 T) O! r1 p! `4 {% Q: g( h2 J# wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
p4 ^9 q* H' h, @2 x* ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( H0 h' w% @4 G/ P* a
write('</div>')
1 H9 }4 y7 ^' s' a: ~; u) J}
; W/ R' s" I9 s% oelse if (document.layers){
/ }$ [* T% ^' G5 i8 F7 R7 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). I$ d1 k# r2 {. o. L* x& p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; E4 Y0 x0 Z& |; [write('</ilayer>')
; h* d7 j) \+ c% h7 b7 J9 u* t}6 x5 e% }: F6 `8 e% [! T
document.write('</td></table>')
0 a6 ^; ~6 L7 i* G}
# g! M' B- s! f; J- j3 z}+ {+ O3 s8 M4 d# q# h2 k4 ?
</script> |
|