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

|
网页之跑马灯文字特效
//修改宽度( P+ h& ?! B& D9 x( ]4 b
var marqueewidth=300
2 N& [5 k6 ^ H+ `7 |//高度7 H/ |$ K0 ^7 n2 G4 d6 n
var marqueeheight=252 }2 M$ Y" r* z! @* x l
//速度(1-10)
6 U- t" j- U; Hvar marqueespeed=3
" i: \6 r2 c) W: R//背景颜色
7 T" q! D9 Z1 v4 z4 S# Y+ qvar marqueebgcolor="#FFFFFF"
" a, r; i: c( X1 t: O% B//是否能暂停 (0=no. 1=yes)?3 f( {2 G! F0 y
var pauseit=1
- n8 `, e* Q7 c. m
- Q i& `+ r0 e8 F//修改显示内容
0 x7 R7 E. P% M ^' w' O; b, pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 e# d! G1 t I6 k& W" M' c3 f( q$ E) @. X& ?4 f! k2 n
0 y/ `: r% \0 q8 z6 s4 e: J8 U! ^8 @
////下面不需改变////////////0 g" m+ A( L! E5 ` z5 y
' n4 N, p3 p+ @, ] _1 X
var copyspeed=marqueespeed
( y0 T7 _8 f6 q0 }! r2 K% avar pausespeed=(pauseit==0)? copyspeed: 0
2 ^! F6 s, M8 X5 R/ ?3 S6 Y9 t, ~: yvar iedom=document.all||document.getElementById* f' G* w: s4 I+ q& S
if (iedom)/ ~! K* I, z4 x1 F) _ w' _$ l$ Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" i; h0 D: h% H/ T g: h4 z
var actualwidth=''5 d0 ^: ^" k! q, {# A' [2 z. P" a d
var cross_marquee, ns_marquee
& K+ E) @* Z8 d* G4 s6 q
1 ^8 P% l$ X/ z$ m$ W2 f2 Z' |9 d' bfunction populate(){
2 T) N/ O# A# n ~) P2 m& l. e) uif (iedom){7 X: A* O9 I; a8 w; b. P; f" i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! Y4 K% [$ s9 W. R3 Ncross_marquee.style.left=marqueewidth+8" @" A( T5 O! K: z3 n3 X
cross_marquee.innerHTML=marqueecontent
) S. v. D. h6 R s) O0 |4 w* A9 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: h( c6 w) o7 s7 [1 b& C; u) F8 b}4 S+ i# i" `% _4 h2 `1 B6 | `5 {
else if (document.layers){# Q* ~6 o, ~1 K O( `/ v9 o
ns_marquee=document.ns_marquee.document.ns_marquee2, y: S! I3 A0 c4 Z6 h) K3 S; X
ns_marquee.left=marqueewidth+81 H; S8 T4 V& s1 [' }
ns_marquee.document.write(marqueecontent)
7 |8 X6 _8 T7 ens_marquee.document.close()4 [% x1 n1 F1 B' i6 C) c
actualwidth=ns_marquee.document.width3 J) a- u8 }* _0 H8 F: x9 N
}0 d3 x5 U2 o1 g6 Q* z5 F
lefttime=setInterval("scrollmarquee()",20)6 E5 _; C% F' @2 g, H" z
}$ x. f4 N, O9 P% J1 J' E# o
window.onload=populate
9 l, o: R) N: N; @" @0 O3 u' v) ?/ W! ~
function scrollmarquee(){
* d0 O- U3 } T" J4 x: ?0 k8 gif (iedom){" ]/ @5 n: b7 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 F' w3 l. G- A. x: M9 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 W0 ^% x7 ] X2 H) C7 delse0 j. f- }, w# H1 ~
cross_marquee.style.left=marqueewidth+8# _8 q8 P8 h! ]
. s/ U4 p& U: m}
, i4 j- U: C" O2 O( l6 k% Helse if (document.layers){
; A, Q' w5 \$ o8 m* Kif (ns_marquee.left>(actualwidth*(-1)+8))
6 U( Y8 l; m0 f. ~, R% q2 t7 l; @ns_marquee.left-=copyspeed
7 `$ c8 f( G1 |; M) `5 Q& Felse# M- [# S' Q, Z6 b6 K
ns_marquee.left=marqueewidth+8- Q5 z! l7 f0 x4 \
}
- ~* F, J p" Z( K}
& K* K7 y# E1 f0 `8 `: K7 r% W# {4 ?& U' g$ d% z
if (iedom||document.layers){
% G2 V. T7 M. H: u& d3 qwith (document){
3 M$ C _2 b, r& Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. D4 G+ g9 C7 t. a# N4 uif (iedom){
3 ]7 ? [0 Q" H$ uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
g0 h2 i* Q8 b% x9 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) N: u8 K% b: S) Y1 Z. q: i- Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ H+ D7 k8 a5 a( n+ X) b3 ywrite('</div>')) s5 V1 s/ U0 d% Y6 @! @- F
}
1 ]6 U5 K" u; E1 }* D2 ^8 A- R% qelse if (document.layers){5 l: V& \% D+ Z# l3 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# W6 M+ @2 K% j% f- I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( i2 b) T4 j. t: s0 l0 _/ r% jwrite('</ilayer>')
$ a1 y9 H; y0 b( {" j$ G! r- a4 `}
# f4 h! g) n4 p8 V3 K$ }document.write('</td></table>')
8 R. N7 j; M1 _) z4 `}& I# y9 N! _) J( x
}
& {. Y. D* n/ d/ l</script> |
|