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

|
网页之跑马灯文字特效
//修改宽度9 x5 c" Y% L; S8 b% h6 ?0 C
var marqueewidth=300
* ^! |; A. u3 ?% a0 z1 t6 b//高度( ^5 }" L9 l- Z: x
var marqueeheight=25+ W3 x" @! ]0 X0 e
//速度(1-10)$ T6 Q# v8 E1 W
var marqueespeed=3( O5 w7 p9 F' @6 g4 c, w7 e4 P: ]
//背景颜色
3 d1 s ~3 u: j! Y* a2 ovar marqueebgcolor="#FFFFFF"
5 V% k' m; m$ |5 k% ?9 f# r6 P//是否能暂停 (0=no. 1=yes)?
% e: Z( z, S' A& c8 Kvar pauseit=1
& P5 L* D2 l3 G3 X. D# t( o2 ^* w- d5 B
//修改显示内容, ^ c6 _( w4 Q# ^+ r6 e2 V( A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', g E/ F9 @3 ?$ q! q, y
3 n' a, O* C' Z
% j# m2 N2 i0 }" Z////下面不需改变////////////: Y/ |- [( k+ p* c4 o% t
. f1 ^+ T, M) J3 r
var copyspeed=marqueespeed
& B' y" e3 t( y2 E( w8 X5 mvar pausespeed=(pauseit==0)? copyspeed: 02 r" |& h- y3 Q. k( R
var iedom=document.all||document.getElementById% l2 e- W6 a7 F0 I( q5 F s
if (iedom)
3 G/ M5 V1 O3 e Y8 H6 K. sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 s9 N" L3 U8 K' \5 t1 g
var actualwidth=''% s! I3 S; {) s7 J# A
var cross_marquee, ns_marquee* R- B$ h/ k% ~
: `0 N' `' Z/ g+ f& F; r
function populate(){; r4 E; z6 B3 f8 i( _
if (iedom){; \( S" \1 ?. ^4 u5 {3 T' P/ S& p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 s$ a i" s3 P/ ~5 ~+ ^1 H
cross_marquee.style.left=marqueewidth+8( c' N5 C& P6 x* R X' D, [
cross_marquee.innerHTML=marqueecontent
V% z2 Z; P# p( Q) g# _& Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ ? P4 P0 k( _9 {6 F: a}5 _3 n& Y) R% V+ ^
else if (document.layers){
! f8 A. k/ s r2 gns_marquee=document.ns_marquee.document.ns_marquee2
3 `$ o4 E9 }4 Y# ]7 H- h# ]# ]ns_marquee.left=marqueewidth+8
* [' I: F4 ^3 v1 Qns_marquee.document.write(marqueecontent)
0 f" g% O, T3 q6 ~) e) Kns_marquee.document.close()2 }! x; L) ]9 k* \% { T
actualwidth=ns_marquee.document.width
7 G: n- F5 m, I9 }* k& q& S E}
% Y6 A7 L/ t U% }1 \9 P k9 ?lefttime=setInterval("scrollmarquee()",20)
# X2 n$ u6 Z E. N4 o1 L}
/ K6 `& E; q6 ^9 R! ?# Y% Hwindow.onload=populate: K: W* T$ d8 Z4 p% Q- z+ S
/ t% j5 I) j, U6 ufunction scrollmarquee(){
6 ]2 |0 {) V, Xif (iedom){
3 U6 L$ O8 P/ w* W6 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) [7 u0 @ m! Y1 k& x: t* G: H ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ m E! n W+ relse8 \/ T, T) I( |& T/ r! L
cross_marquee.style.left=marqueewidth+8
& k: S# x5 u' r8 g4 r$ D' }6 ?% N
6 V5 V0 n# e/ h( G8 X}
$ q% D2 j+ q" _& U# c1 kelse if (document.layers){
- O$ e1 k; l1 o& Aif (ns_marquee.left>(actualwidth*(-1)+8))$ m3 Y2 Y( X: S2 z5 h- r' h* u0 W* H* t
ns_marquee.left-=copyspeed
9 F7 L' Q, \8 z9 [0 xelse
2 ^+ R- I# t2 x6 Rns_marquee.left=marqueewidth+8
7 ?* E/ L, W6 h4 w9 |+ t}# z" f+ o, d; e& c7 u4 l) H+ G
}
/ N8 S/ e2 [! o7 d* _2 q) M: s1 d1 Q+ G, b
if (iedom||document.layers){
* z, Z. C7 J: f! z8 |0 r s/ C4 awith (document){
Q7 l5 K9 w; e0 [1 M; F' L' \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). M8 i7 b/ E1 Z9 U3 o) g) W
if (iedom){
- l9 V" Y# u/ l7 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 K$ P6 y0 q) u- t$ S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 D* }0 D' S! ?$ ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" b- t: \; Q5 K0 p gwrite('</div>')/ d# R1 a9 p, R( c. `9 [
}; B9 t4 `. D2 W4 H6 K9 R. O
else if (document.layers){4 r4 R$ C! R/ d( {5 L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') {! v6 \: k& H- F; J; P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ }* z! U5 A/ Y, M+ k7 m7 N& t: gwrite('</ilayer>')' ~/ d8 k# c7 ?6 S0 _) E. A
}
1 \, h" U) Y4 a# J; m4 m- _! M7 adocument.write('</td></table>'); E: Z' ~4 w' ?
}
, k; M w; D: G E) v& X: G1 z}, I* I$ `/ x) x, R- t, A& d
</script> |
|