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

|
网页之跑马灯文字特效
//修改宽度" q" [, |( x7 z* I
var marqueewidth=300. A: x ?5 h6 _4 d; H
//高度
, C- T7 l; C4 |9 V6 Avar marqueeheight=25* N: V0 f/ x d' z3 F, U. ~
//速度(1-10)
0 h( r/ x! A4 }# G7 Qvar marqueespeed=3
& h0 m% k( L. `//背景颜色! S; R9 E7 x% h9 y9 ^9 [
var marqueebgcolor="#FFFFFF"
, Y. V! U: ]5 l3 u1 z+ _+ [//是否能暂停 (0=no. 1=yes)?
5 A4 [6 ^0 C- O, u/ f) j6 xvar pauseit=1
% S! t; S5 y6 e f3 B/ k7 q% H0 M( a6 F+ h5 k
//修改显示内容
' Z% t6 l" ^) v; _. o- R4 K& ]* ^6 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% Q( k6 M, i0 y ^6 [/ W& T* o) w7 T% O* r" }/ n9 P# m
8 ?2 W& b3 u* K& p2 i8 Y- o+ J' w////下面不需改变////////////' Z; e7 C0 q2 Y O4 F9 h7 Z( S
* t5 _, `0 X4 o l" t
var copyspeed=marqueespeed2 O0 i c |. b# D5 R% E, J
var pausespeed=(pauseit==0)? copyspeed: 0
S* `. |2 m1 A5 dvar iedom=document.all||document.getElementById, r9 W+ r# h1 A* H, Q
if (iedom)
! t! N) X1 b( A) g# w# Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 ?# f# t5 Q, C7 B6 g4 v3 svar actualwidth=''* i: a! H F# [- n% Q0 E
var cross_marquee, ns_marquee$ ?* f* F4 e0 K$ ~! n* i
5 I* e% y: T; v6 ~0 h1 _3 x* rfunction populate(){ h3 r0 L4 |2 n" Z1 n+ r
if (iedom){( m" [1 g% S. j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# U% E _' J+ ucross_marquee.style.left=marqueewidth+8
: _( @& x2 K. Z4 V+ M6 f8 wcross_marquee.innerHTML=marqueecontent
. A' B" H/ l A4 r" T: X8 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ K# q; w; W% L% M: a+ [ ~
}3 F7 R1 h2 j+ M2 Z
else if (document.layers){' R! {6 ~3 V$ t/ N
ns_marquee=document.ns_marquee.document.ns_marquee2
( D* J% z* R( H% pns_marquee.left=marqueewidth+8$ u7 @. ^; b; n: [
ns_marquee.document.write(marqueecontent)' f9 \4 @( p/ a: I* L
ns_marquee.document.close() g3 I8 f* }4 k/ f# K
actualwidth=ns_marquee.document.width( R! c+ I; w7 G/ `
}
! p9 F3 A- Y( h. }lefttime=setInterval("scrollmarquee()",20)
" k3 X3 ]# U6 `. x, z% j* `}1 C V# L' h& Z6 T7 `
window.onload=populate$ k( H) U; C8 u: j" m
6 w# {* t% m9 o2 M3 V8 c
function scrollmarquee(){
8 K! d4 }5 i- o9 f1 rif (iedom){/ o* K& M( T; _0 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 a, Z4 z- K, @0 w' Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 O. c9 u! b$ y+ s/ a% W7 [# |5 _else0 }- T6 x6 I& D( {$ \( z- B
cross_marquee.style.left=marqueewidth+8
. h5 A3 D f* T. t* c/ c$ A4 s! q* h# O2 j% [! t, Q( `
}
6 M% G, k7 R: C8 melse if (document.layers){1 r- J6 p9 |6 |2 I
if (ns_marquee.left>(actualwidth*(-1)+8))5 Y! X% |7 N$ i8 G8 t& F
ns_marquee.left-=copyspeed
2 O7 u2 S! ]1 H$ C! A* G2 Lelse& C% Q5 _- `" O# r# F x% ]& I+ t
ns_marquee.left=marqueewidth+88 ?6 i- x+ T2 ^8 d. @! [: R9 B
}
/ n1 r4 ~" A. x+ |0 f- q}
5 q0 h* K) c2 x* e* `3 p' N/ v9 W2 A; J' X' V( O5 j8 M
if (iedom||document.layers){* h) i9 w' W3 r8 n9 G1 ^
with (document){/ Z6 R4 G% b8 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 ^' M( a k' e4 y9 D7 D
if (iedom){
. B, X0 T& U, ]3 J q1 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 w/ \4 V) G) V- I# O. lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 z6 _9 _0 R- L1 J/ K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 {9 R# B) V" X' Jwrite('</div>')
$ c/ `3 n0 X6 n- @9 t, t}# Y& C5 A$ C" e! f, S6 v y
else if (document.layers){
0 q0 k' `' d$ G& S2 [( kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! n& \2 K$ K7 e. d uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" U+ d$ C) {1 ?- q- j( n+ I Ywrite('</ilayer>')
0 R: L) F* t2 b, ~9 f}- T" s$ b" x3 x- @
document.write('</td></table>')& _/ l! b' X I. @' w
}
, O- }( `% x1 w& l7 A* z& H4 t}
6 ]7 m3 L s" r4 ]3 z* v</script> |
|