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

|
网页之跑马灯文字特效
//修改宽度0 J5 w6 q3 t0 U- f
var marqueewidth=300
H S) b( q% L$ o# v7 @2 L0 w//高度. M1 ^) \3 U9 f& W
var marqueeheight=25. l" w& q" T% ~2 l# k2 t B
//速度(1-10)
4 q4 R# h) y* x0 u7 c/ @- t wvar marqueespeed=39 F3 p7 c3 n7 ^( ]4 I1 F/ w [( B
//背景颜色0 A2 R5 r" h& V
var marqueebgcolor="#FFFFFF"
: R) b, e/ I) z' E6 r1 Q+ p% }- s0 X//是否能暂停 (0=no. 1=yes)?
/ E; T9 }( I8 |, yvar pauseit=1; B. Y) E1 R6 @4 G( }: Q
, Z2 A6 m2 p5 u//修改显示内容
3 [- {8 _) z5 z/ b/ n3 x) O: {: Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 _1 S( [1 a) r0 h% c/ a
. X6 \2 U p' V# {1 Q' ?
# I9 [7 n) D' j& Z' z! l/ J
////下面不需改变////////////
0 t/ m2 S0 y" B* B
$ g( G' e2 Y) ^# p: R+ hvar copyspeed=marqueespeed
0 G5 L) K* N1 X$ p2 A) ]var pausespeed=(pauseit==0)? copyspeed: 0" k& U5 _# F; b* A1 M
var iedom=document.all||document.getElementById
- z8 s' L( f0 S1 ^if (iedom)0 F# o# [2 q- J' w5 U! m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: V) N2 s6 x" J( Lvar actualwidth=''1 {# A! z$ s# K' w) O
var cross_marquee, ns_marquee
2 K- V: f& h! ]( q$ t" D& _' m
/ }7 g3 y3 T+ F4 J: vfunction populate(){
3 D- |7 H, Y/ s; x' k' g* ~/ Y, Uif (iedom){; l9 R, U5 H+ i+ h h, j9 T/ s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 l" u# j7 E/ E8 q+ x* D5 W7 R5 E
cross_marquee.style.left=marqueewidth+8. }0 T3 n8 T3 P- H$ f
cross_marquee.innerHTML=marqueecontent& }/ e7 f- B$ P9 O4 r+ Y7 R+ Q$ ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, X' h* m* U. O* P2 F* [! P}! v. i/ i* S* H, B
else if (document.layers){
9 w) ]) @: a" m7 vns_marquee=document.ns_marquee.document.ns_marquee2* S( |: ^ u7 o, l1 Y0 M( X% f
ns_marquee.left=marqueewidth+8
( z# ?. L8 ?( ?6 xns_marquee.document.write(marqueecontent)1 e& x/ y S# t9 F1 b5 n
ns_marquee.document.close()6 N# G8 J5 ^9 a% p
actualwidth=ns_marquee.document.width- K4 G0 s6 z- \% l# k2 E
}* U2 }5 `) H' u( |. {
lefttime=setInterval("scrollmarquee()",20)
8 n' N( F% q+ S( Z' H}
" D f( q/ t# M" s$ w6 I7 mwindow.onload=populate
9 k2 C+ o5 d$ O: {% _# W* I( `* c1 T+ |% X; x/ D
function scrollmarquee(){" p, Z5 j3 V, e1 Y8 h/ \& A
if (iedom){+ g; i& T2 |4 v5 m6 k5 X" X% L: t8 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 z* c3 }% x! @. U6 Y; @/ o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ r/ d+ Q s7 r3 w- G
else+ c& E. Z! ~, r0 \! C( i
cross_marquee.style.left=marqueewidth+8
7 A. E& Y! ~; ?' i. o4 z- M9 X$ `3 R7 i5 h- H8 P; m! p" f' {
}, n7 o" U* |; |: W' o, I# @4 |4 ~
else if (document.layers){; c8 Q: I- ^3 g* X" Z6 U( [9 s+ ^0 }
if (ns_marquee.left>(actualwidth*(-1)+8))0 H9 h- j- O& Z
ns_marquee.left-=copyspeed
: S8 N. P' L0 i' s) X- O, h9 Belse
6 P; K J6 ~2 i; p/ N# jns_marquee.left=marqueewidth+8
) J5 C7 S8 q! n+ `$ E0 I; Q. Y}0 d; q; R& ?- d& T- }
}3 c8 U$ ^4 Q2 ]1 |2 P# _1 z& f0 }
# `% l5 E8 T/ x, ~1 t
if (iedom||document.layers){
7 U4 E& e7 M" [% Hwith (document){+ M1 E0 H: F8 m8 Z2 Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" Y7 i+ {6 q1 ~5 a' |! ? N$ D
if (iedom){
- g! [9 w3 ~ e2 h) F) Z0 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) m3 t+ e) i: X; K1 o1 Y: Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 x: { \- G8 M+ B: Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 ^8 D' U) D/ j) b# d5 g
write('</div>')
2 Y, `# A! x% h& R" T}% R6 n% k5 r& r, N( ?, U1 t' L
else if (document.layers){2 C' ~* b! O" l7 r8 r5 m& E+ S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 R, ~% t) K: \: m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* P' j& d: u. L' y
write('</ilayer>')) P' N+ Q( e" g
}
7 @4 m/ u! n$ m4 adocument.write('</td></table>'), g/ o* _ J" Q; l
}
7 B! z7 X! Q; |) c2 {}' M5 q* j2 G; ~
</script> |
|