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

|
网页之跑马灯文字特效
//修改宽度% y# Y, S" T" N# o# ?' W1 ]
var marqueewidth=300
0 `) p2 e6 z4 Z# o; x//高度
0 v, S2 ]+ r. Q, A0 [. Qvar marqueeheight=25
8 h' A: f. w: ?$ i7 Q3 s6 ?//速度(1-10)
# R3 W- i: K( Y& e! ?3 B0 Uvar marqueespeed=39 N0 ~! f: Z% Z: r' D+ \
//背景颜色
4 M4 Y* x3 E1 i M% @" [; y0 m, qvar marqueebgcolor="#FFFFFF"
& d# ^4 P$ O$ f9 @* K//是否能暂停 (0=no. 1=yes)?3 h2 q( @1 w1 N( v' a, p. k
var pauseit=1
: T$ I* a* x/ H3 T. e
; e$ r# E( s5 k) \/ P//修改显示内容
9 {* |8 I" r& ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 w }3 k4 f- [) u
: \+ v: X m7 I1 j* _& M
! r0 u2 x) l+ Q" x* F* Q% s0 a0 A////下面不需改变////////////
/ J4 G5 |& o/ v6 a# _( E
% q) U# U9 E) b$ ?7 i/ tvar copyspeed=marqueespeed
6 p9 Y' V5 r+ [7 |. Nvar pausespeed=(pauseit==0)? copyspeed: 0- z! a9 B2 f% o# ~
var iedom=document.all||document.getElementById
, _+ c% b1 ]/ Cif (iedom)7 h0 r i6 c3 N* A; p* v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, m. D4 w( {* d3 ?- Pvar actualwidth=''
: E4 c6 x* o- V4 R- |$ J. m# @var cross_marquee, ns_marquee5 B6 e7 v9 t7 {# k! H, A
* O" p; }: z: R) E4 h8 Z0 S% ~. j
function populate(){. ]' f! M6 j# q1 ^9 P
if (iedom){
7 ^- H7 p8 |- \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ A! y4 `' @* J6 k$ O" I; N3 j
cross_marquee.style.left=marqueewidth+8* g0 @- \ [5 }( y. v- K
cross_marquee.innerHTML=marqueecontent
6 a- V# K+ b! D e' C& {* zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# i' C% X+ @4 V2 l}
5 H N* i8 B1 w& b; melse if (document.layers){ Y8 A" T3 ]- l9 Q0 ?
ns_marquee=document.ns_marquee.document.ns_marquee2
1 x& j/ ]2 A: X4 W$ f1 wns_marquee.left=marqueewidth+8/ X" z$ s' O3 f* S- X3 A, u6 S
ns_marquee.document.write(marqueecontent)' G& r7 k2 m6 j7 J9 v8 o
ns_marquee.document.close()
+ Q7 B+ r: [ f/ ~! B$ Jactualwidth=ns_marquee.document.width
2 R0 ~3 N8 ]3 n7 H: p' F$ D6 w}
: t) ?0 J; F$ ], y% _7 plefttime=setInterval("scrollmarquee()",20)) Y1 v, w; v. p1 K- W" K
}# j& ^# n5 p& G* i8 D& q+ Q! E
window.onload=populate% M* P4 l3 K% k
1 @, [7 L. o* {6 s E' Tfunction scrollmarquee(){
* n1 }8 g( ]9 p) A* ~( d5 L8 b7 b Kif (iedom){2 C3 ]/ n* T8 ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. M: o0 n2 P$ s/ C$ {. Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 _+ }/ b# }# P) Selse
& |) u* O, s6 fcross_marquee.style.left=marqueewidth+8, o% g. u) r! Z7 K0 v
6 j8 j: l$ G! b* B: O) R: h
}
- N" n' |6 f1 F0 x" X( Selse if (document.layers){2 \* [# i3 @' r$ ^; b: w$ ^3 o
if (ns_marquee.left>(actualwidth*(-1)+8))8 |) K- v9 X5 d* |& n9 B6 s
ns_marquee.left-=copyspeed3 p1 ^/ a4 D7 c" F- l8 q1 F
else. D* {& b7 w3 I8 j1 A% X
ns_marquee.left=marqueewidth+8/ p& _, I- R6 T
}2 Z# z7 }0 W; |8 B7 T, y
}
; f$ o! N* q: a" h9 Z) F! n+ L) L& N' X+ G9 h
if (iedom||document.layers){* J/ n" Z: s: `8 v8 z, i
with (document){
* K$ W- I) h* F! A- odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 Q1 {. V; H2 I H- y/ {. hif (iedom){' m+ F9 Z# a* V* e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 f5 r8 S9 V, E! P8 ~. {0 O; zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ T- t, p o9 @. V6 P% ]9 u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 j8 u1 E: ]; @' B! cwrite('</div>')
4 U1 v E5 n5 s) M6 W2 S/ @}
8 @+ E7 [$ L! T$ L# \* a: k( }! telse if (document.layers){
; g# N% l0 _' @: U n' [1 Z% Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') U. {# k" G2 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- J" ]' V6 e2 `4 M4 e& awrite('</ilayer>')
* \" N# s( N3 K# n}+ F |7 h' a2 \* b6 u
document.write('</td></table>')
* U& ^: W) r! r5 r& b}- h- ?4 Z J8 a* a6 j+ f
}" R. | e2 X- i. Q4 j
</script> |
|