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

|
网页之跑马灯文字特效
//修改宽度
% F* g( w* P2 O) Ivar marqueewidth=300
( m- f2 s, u5 ~% h0 |" |) @//高度
r- N7 g6 R5 |3 [! ]3 pvar marqueeheight=25
9 v5 Y! g l- p! v//速度(1-10)
( c1 X7 {( A B5 Ivar marqueespeed=3
/ Z. ?1 f- @2 q+ R//背景颜色; ~5 V6 w4 G. F" |2 o
var marqueebgcolor="#FFFFFF"/ E* F6 h5 w; r5 F0 c5 S. E
//是否能暂停 (0=no. 1=yes)?
6 d9 _$ C% A% z( A8 zvar pauseit=1
( v4 @' ?9 {+ c; E( D6 b
}" B; `6 L! Q//修改显示内容
5 ^9 E9 A# x0 e5 q- ?' `$ gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) A/ A* `! {& ~$ J; w! |/ ?( ] H. p! _
( v. q+ t: w8 M- G9 c* _2 x////下面不需改变////////////: q+ X% |; \4 \8 B+ d+ ^( }( v+ [
4 r. p' u( x( F a( O' u. u# Lvar copyspeed=marqueespeed% Z* D& G7 ~' M
var pausespeed=(pauseit==0)? copyspeed: 0' O3 m7 p$ _( E# a" }
var iedom=document.all||document.getElementById
" F6 C v7 M& [, v9 G Bif (iedom). h9 p- N- \1 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
k: {8 o U ?% ]. Y3 ~var actualwidth=''
6 n# |" ~5 C* T( D2 Pvar cross_marquee, ns_marquee8 _' h- k8 _% Z- Y8 _% q
5 x; x9 k5 L8 G1 J3 Nfunction populate(){: W! M8 N' L( q! @
if (iedom){
$ ~# K! u* ~6 F9 h6 W3 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 d: S/ A+ }0 X5 a) ?) |cross_marquee.style.left=marqueewidth+8, a: x: i; E9 X$ z8 _7 P) {
cross_marquee.innerHTML=marqueecontent
9 ?$ r, d) b( ^8 c3 Q# uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ a! y# a& [/ I! o8 @7 t- {
}+ g+ |. l F, A9 I0 ^' V Q$ }
else if (document.layers){
# Q7 n2 D: `, x+ [7 Bns_marquee=document.ns_marquee.document.ns_marquee2- I. Z. @* s! |8 I
ns_marquee.left=marqueewidth+8
4 z4 T# y, s. l- ~9 k0 X; Nns_marquee.document.write(marqueecontent); N& f+ l2 _5 ~* r, F* l! C
ns_marquee.document.close()1 \, n& D8 @7 J
actualwidth=ns_marquee.document.width
2 n9 e4 B1 l r% v$ {1 H* F7 [}+ H m5 w6 n" {9 E J9 D. b
lefttime=setInterval("scrollmarquee()",20)
/ A; R4 S! b, D. A! j4 J}
& G3 B# f; L2 R# V4 Ewindow.onload=populate
( F2 ?+ {$ t: C& t' W
. x, l$ `$ o, J9 Bfunction scrollmarquee(){
) H# J- [- X1 V9 [2 h, lif (iedom){
9 M. r: s, N( o$ x gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 U4 A/ P9 E: E" Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 }1 z: t. r3 z$ \
else6 @( O. v3 m7 V. z! C# E% i
cross_marquee.style.left=marqueewidth+8
. ^; u* m( H: l% C' ~8 [# g5 a' k. ]' A3 e( T. D( }- Z
}% B4 a' Y p1 h2 ~
else if (document.layers){' D4 |- K/ O5 [0 l. Y: D
if (ns_marquee.left>(actualwidth*(-1)+8)) |! t$ \. X7 i6 B0 S
ns_marquee.left-=copyspeed& d( M( u# K# Y1 a# m
else
& X: ~2 \" r1 n2 ?% zns_marquee.left=marqueewidth+8
* P7 e4 B. ?' V. J}
; o. z7 R, O) D/ Z" a7 w; j/ F}
. \7 C5 ^! K( j* \8 i( r3 V$ Q
+ x+ e4 T- P* ^3 r( } H& Dif (iedom||document.layers){
& ~5 R: k* [% p* [% r* [# o$ vwith (document){! R0 t) H! b9 M5 t0 ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: `. h1 _" g) W$ i- X3 C5 u, h w9 A6 Qif (iedom){( W5 I0 T, s8 X: a0 P/ r2 k- d/ G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 v( O0 U! Z) @6 \. y! lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# o$ z6 G6 k: s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; z$ G# b P& |( V& Vwrite('</div>')
4 v. v/ x- W; W; p9 j8 z7 T}
1 v1 V/ |( a- celse if (document.layers){
6 u) Z8 L' \" z% Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! d, h4 l0 Z. |% l$ rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). ^! F% R2 t* Y/ G3 t. ~4 Q7 w* V
write('</ilayer>')/ `2 c r, I- L' w& n0 Q( j
}/ m! N* x: C; V0 O& T0 b s0 x' N" l3 U
document.write('</td></table>')3 D( i7 @+ ^' i0 G- ^ ]4 Q1 J
}! k- W& y7 w0 M# T& W
}
* q5 h4 m, {+ y: I! n7 R</script> |
|