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

|
网页之跑马灯文字特效
//修改宽度
8 t! i! f+ W' _0 Q2 y) A2 ~var marqueewidth=300- ^! H( b# S& t5 f7 ~$ S
//高度
5 [, x. o- p& n. V rvar marqueeheight=25
; M; O& y: C) C& b5 o+ I( t2 p//速度(1-10)% `9 J# j! p8 t3 U
var marqueespeed=3' a4 d6 Y. E* ?( {: H+ o3 w
//背景颜色
6 T8 P- i: L1 O; a0 ~6 Mvar marqueebgcolor="#FFFFFF"( v- m, G! Q7 Y3 |( \
//是否能暂停 (0=no. 1=yes)?: B) ]- @/ {% K
var pauseit=1
9 Z% w5 A3 {: e0 s: ]1 L, B3 B5 J" o0 E; p8 L4 C3 W
//修改显示内容$ S4 b) V X6 P4 B9 l0 M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 p2 P' k E: A: Z |4 B. b* J4 u% j4 L4 z' U. S- X
/ k/ K3 G4 N% O2 [, R% ]4 U g. r2 h
////下面不需改变////////////
+ Q8 P& }. s: k
; h, G8 e7 S+ ?4 A( f, f _, d: @" _var copyspeed=marqueespeed
+ J$ {4 O o! V' s/ c2 C+ hvar pausespeed=(pauseit==0)? copyspeed: 0! L2 u6 P2 {2 }. r1 J; d6 M
var iedom=document.all||document.getElementById
" G& S% p& S# D8 ~4 `- K+ |- rif (iedom)
. z! V+ E- T; ]3 Y/ Q. I: ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# E) t* {0 E% Z7 J3 svar actualwidth=''; a9 a8 b" N, ]! e- D9 I$ K; e
var cross_marquee, ns_marquee
5 g: j @7 k* c- S- r: K E4 T W; r4 D' w$ p. ?2 w
function populate(){
1 ^- _% I9 G# L5 @( E; e1 ^# jif (iedom){9 Y; L% z$ W6 S, j0 q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# _7 j; y. ]# Z- u- g$ |cross_marquee.style.left=marqueewidth+8
1 z4 t& q- V! R8 Kcross_marquee.innerHTML=marqueecontent
! d" R f) ], g) S; t" v6 Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- B! M, `/ l* ?
}2 l- D6 g5 }" ?( t
else if (document.layers){6 V. T0 g* g: N [3 z; B& x
ns_marquee=document.ns_marquee.document.ns_marquee2
7 F& e- l3 K% S: Y( sns_marquee.left=marqueewidth+83 O) v( g4 @+ J! s
ns_marquee.document.write(marqueecontent)
/ I% H$ M5 m5 s2 Tns_marquee.document.close()1 x: ]! K, {5 d. e: h* d& b
actualwidth=ns_marquee.document.width
. e! f; b7 w: @3 D$ h3 m}2 t+ z- m2 Z( e% v6 w/ U. c% ~
lefttime=setInterval("scrollmarquee()",20)
# d& ]5 @ X) c% a. b- L8 w}+ h8 ~. \ a% J7 h# O
window.onload=populate% Y. y" X9 j& W8 }, J7 ~
/ L9 V5 J) C r8 z) [" Q
function scrollmarquee(){
" b% [7 N! I- w! _' H' j2 z) Wif (iedom){
# O. |: v: k2 P1 F$ Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 r# n1 b2 h4 O9 c/ n% @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ u3 t2 k' m& r5 o" _' i$ K4 s
else
r+ k1 y+ g* T! B1 D0 O3 gcross_marquee.style.left=marqueewidth+8. g' m# k4 u& r% d, B
1 B2 }" B' {. g4 K$ }7 m9 L}
7 y; Q/ a6 D# b. u" l2 \, n+ J Delse if (document.layers){1 X) z4 r- A' j
if (ns_marquee.left>(actualwidth*(-1)+8))
! P; |! `; T# P5 Sns_marquee.left-=copyspeed
0 `" L) P6 N. ~7 D; D g* ?9 a" n- Eelse9 n2 n7 f8 R$ k2 V. e
ns_marquee.left=marqueewidth+8- ]/ i7 I! r+ A/ ^: N% y# a4 M
}
6 t4 a0 v3 J1 l) ]) ~9 I8 e/ z3 X}
. V5 Y$ w5 A g0 g2 E, Y; x6 t; \# A4 m2 K+ l- _, q/ e
if (iedom||document.layers){5 D, X* q7 @$ p& P/ v* L
with (document){
& g7 S* l* D0 J( o8 d/ \" Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 T: |7 w G3 ~0 uif (iedom){
) Z: U8 j, G5 c! W) A* n# vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* o- H3 R4 U& C- f' t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ m4 @; ^# ]# t7 r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ Y$ g' s j" {0 R gwrite('</div>')) ^- _+ a% j6 j+ P; R
}$ M" I% _6 _/ C
else if (document.layers){5 U4 k: x- j7 h% D7 w- B) l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 T8 b- `, }( e3 S, t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ ^6 _/ _+ I! I
write('</ilayer>')* L& H' f) |0 u& C
}" M( j& A3 i! f* j5 |
document.write('</td></table>')
0 L2 y4 U0 P1 C4 D. m. o' {2 e}
1 V6 a* m( V3 S Z9 v/ |8 [1 R}
$ D1 o: g0 B2 P9 x( Y</script> |
|