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

|
网页之跑马灯文字特效
//修改宽度
8 x! A( q% F) r9 f5 n: Mvar marqueewidth=300
! b( G0 w1 h; [/ F7 ~ p//高度
# q# a( W2 { L) p, x& b$ @var marqueeheight=259 \4 u/ s. `( q
//速度(1-10)
5 X# W% {4 Z2 l3 O, Q& o; yvar marqueespeed=3+ t) e/ H2 {2 \/ i2 ?* M7 J/ B2 |
//背景颜色3 w( G7 a* _' [; \
var marqueebgcolor="#FFFFFF"; `! c4 K$ T. Y4 \. S. l
//是否能暂停 (0=no. 1=yes)?2 i- a% u6 q& J$ h9 ^1 i: N
var pauseit=1) M6 ]. t- R) [, l5 T- u
5 F- @: @# q. J1 J
//修改显示内容
( x9 x; E! Q4 c7 Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- U' W7 x8 y% f" {" S1 x
1 a5 V4 ]' O# ~; `! J5 X% I1 b: I
% x. N! k- [0 J- s4 j6 B* B7 B////下面不需改变////////////8 [: B, q+ q) q8 h+ q+ E; U! }0 K
0 x0 \7 T& \7 R( Z: F
var copyspeed=marqueespeed( {1 q* @, H8 a5 S/ \* K
var pausespeed=(pauseit==0)? copyspeed: 0( B. _4 g9 i! j i1 _& s
var iedom=document.all||document.getElementById, j, \2 f( ~+ ?9 V; ~1 V: i) M
if (iedom)
- y5 U4 F& ~4 X' F) ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ |4 f( x4 E( Z6 h
var actualwidth=''
+ w2 q0 I3 e0 p3 G2 Kvar cross_marquee, ns_marquee! j3 w5 U1 v2 \2 L
1 c0 _ _; p+ R+ Q8 \1 ?1 j6 Pfunction populate(){$ Z6 Q% F8 l6 v0 o: s
if (iedom){
8 G4 V) p/ F$ H# Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 z; t7 m9 r; g+ i
cross_marquee.style.left=marqueewidth+8
5 V1 W; N9 n, I1 G5 G, o0 Q* scross_marquee.innerHTML=marqueecontent
3 Q" {1 n, v& L4 W3 @# j) Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: j* m; t" O# P" p: C/ n}
: @8 u- h% M9 q2 j; pelse if (document.layers){
2 x6 V! E# T6 t7 h! e. V) jns_marquee=document.ns_marquee.document.ns_marquee2
) U9 W l8 Q! |8 Xns_marquee.left=marqueewidth+8
$ {& I F& d7 ~, L, o qns_marquee.document.write(marqueecontent)
: [$ {# E4 s6 Jns_marquee.document.close()0 O1 l. c9 O- E& o' X
actualwidth=ns_marquee.document.width
; r; {) }) S9 [: T8 r}$ Y7 A* F. _1 f G/ Q8 L
lefttime=setInterval("scrollmarquee()",20), j. m1 l5 T3 q* h$ l9 Y2 I/ i. b
}! P/ O" Q. U4 A( N
window.onload=populate) D2 A# _8 _% X4 R4 Q; b
* R: {) ]+ A J! ^' V2 y8 sfunction scrollmarquee(){; F4 i" n2 g5 j
if (iedom){0 k: b: C. m0 L8 j, e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 {: @/ D" Y/ W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) ]* [9 J2 I2 J3 X I& Kelse5 a$ M# F! s. ?
cross_marquee.style.left=marqueewidth+85 y" V0 M) y7 x
3 G0 D: ]. i" i# h) X}+ }9 ?9 B3 P1 R7 z( a9 S
else if (document.layers){
) ]$ ?! @8 J( X. B& A9 Bif (ns_marquee.left>(actualwidth*(-1)+8)), E, C4 X" u9 M9 d5 A8 b" v
ns_marquee.left-=copyspeed
( j' B" ^6 l+ R, s! r1 xelse
3 U" Y" m6 a" y& Nns_marquee.left=marqueewidth+82 L/ g7 f, f2 ^4 A& d- {
}
# M2 e. I" n: v! H2 I* A}
3 L' v; m+ u W- Y6 j! Y& _2 A& ^
+ k. o0 X( \: G4 x u& e5 f7 Wif (iedom||document.layers){1 Z* C# o, l. q6 k3 m2 p
with (document){
- F' O$ b& Q* S/ E% ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, H+ z% C2 |8 q V% |8 Oif (iedom){5 b3 B+ j! R# g L8 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 q2 B6 S. f& u$ w3 S+ [% g Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# F% y# q3 `# y6 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ d% A: @% [& q4 ~write('</div>')
# C9 q% D& `3 g! B# s; A& d) v}: z4 b, C* z/ w: G* ?
else if (document.layers){: o" V/ Y \; l' K2 \& w8 s' g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 v3 _8 X2 C) d/ F4 j t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 F6 a: B; {) \# f; z! J4 H6 `write('</ilayer>')% q! Q8 n$ s+ K+ M
}+ b }( L7 \& I: \9 M: l
document.write('</td></table>'): N! w8 U" e/ X' u$ m" A4 n8 l
}
2 ]' g! b# g" H7 \0 |3 a9 ~, L+ W2 {}
7 t2 o% l4 |- G+ g* u: ^* r' H</script> |
|