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

|
网页之跑马灯文字特效
//修改宽度
* s/ ?" b6 j7 n, h2 I% lvar marqueewidth=300# |+ g9 M. T; i8 J V. u
//高度
r- U! s* P' ]var marqueeheight=25
9 {' Z- c$ O2 [( q3 \" D; l//速度(1-10)
* A* Z6 a9 S+ q2 V" I1 {, a7 I f4 Yvar marqueespeed=3
; [; }# e A) o3 r: n2 w//背景颜色1 _# C) ~8 s+ d0 y" z! `
var marqueebgcolor="#FFFFFF"
' S, ^1 D1 C" p0 _//是否能暂停 (0=no. 1=yes)?
4 x$ v+ g9 z: g$ A& Y3 p4 T3 B# E8 avar pauseit=1
/ d8 C" \( g$ g$ K- N0 c
! V3 C* Z9 h2 f! [7 ?% F//修改显示内容
( [7 o0 N+ [3 z6 R6 S H( l4 pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ u- _( b) t9 ^' @; u& K
2 L, u s$ X0 g' a, u& u1 k2 s! H& E& ]) p8 o4 {4 m
////下面不需改变////////////
/ k8 E8 x- z; h$ c0 H/ V9 c' v7 ]
* c0 w, C- x U& ~, h. gvar copyspeed=marqueespeed
% D2 Q8 n( d. c7 p0 a: U* Lvar pausespeed=(pauseit==0)? copyspeed: 0( I$ q- `0 d j# a# t; |
var iedom=document.all||document.getElementById
, x' R' ]+ M/ f' dif (iedom)3 P w0 E3 r- l5 n, k6 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 l! k) \6 H" {) ^/ C
var actualwidth=''5 }7 W' Q6 C j5 S- R9 _* ?
var cross_marquee, ns_marquee% \+ a) K" O D/ M
' q& }* {# V1 U' `0 W. nfunction populate(){* X8 F# ]0 K e& ]
if (iedom){- w3 r! H2 o" x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; H0 T2 T4 e3 d8 m, i# u* u+ ^cross_marquee.style.left=marqueewidth+8, A4 K q: @: c; s! j
cross_marquee.innerHTML=marqueecontent' H5 u& ]$ o; e# e" ?" c: w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 v" c9 x& S4 L5 C3 ~5 O& q}) j0 e2 P9 j9 C5 A
else if (document.layers){/ }2 I( v. ^9 q+ G8 w
ns_marquee=document.ns_marquee.document.ns_marquee2& t2 Y# }/ _0 [
ns_marquee.left=marqueewidth+8
- k M* H( z" e, r9 G# i2 Qns_marquee.document.write(marqueecontent)8 s; n# x5 N1 a
ns_marquee.document.close()5 w4 k/ M0 {7 Y% j6 A+ p
actualwidth=ns_marquee.document.width
, d5 S$ r5 P6 O, M% X5 Z; k2 m0 u}
, B$ e7 r6 v+ i5 C6 f7 ^( \lefttime=setInterval("scrollmarquee()",20)
# {) i. b4 I' l( a- K" S9 c; |}) R! u K$ ]) c( m6 P, G
window.onload=populate
6 I, r8 V A. W; @6 {- K; ~ m! u* \1 g1 v' `- O2 c( X; q
function scrollmarquee(){
1 V5 D |* n& ^9 U6 ]5 P1 X: mif (iedom){
2 q; O* o7 k9 S u4 W- sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# J6 i6 ~) F) }1 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* z, q, d# ^+ ~0 s5 b( W, Y9 q9 }else# ]* F5 l. r G# s4 f
cross_marquee.style.left=marqueewidth+85 Z! k: R$ U0 p; N4 Z* a
) W7 c- K7 w/ j% _9 k" V. ^
}, P8 C1 h( _/ y- g0 _3 L' p
else if (document.layers){
8 J% r+ A0 o: a! B$ M0 ~5 Y6 uif (ns_marquee.left>(actualwidth*(-1)+8))4 h0 d' ^( P e+ g9 f: n2 d5 y
ns_marquee.left-=copyspeed5 f5 h, z! G8 @/ X! I5 e) W
else
& S; l/ ~+ V! _1 P/ S: O7 Nns_marquee.left=marqueewidth+83 e: R( }6 p6 s& i
}1 Q) u) ]* Z7 D& W2 `. ^
}
7 T3 @" a4 d2 o8 t" J/ s/ H1 L$ T, D) ?- B' U% a
if (iedom||document.layers){! s' ]% ^+ V7 N2 y @' I
with (document){
& R& B# Z6 M4 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 x& ^( f+ l+ E; \& s( U ]
if (iedom){% j- y+ T4 `/ {# d# G1 K+ w' a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- m2 a) m# _0 }8 ~: dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( d4 \5 U! A, ]' L, y8 uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( {" L) u6 K# I& Vwrite('</div>'), V' U( I1 g* z5 p9 u7 f
}
, ?0 t* n$ l* p* I5 g aelse if (document.layers){! B0 v+ @; N" {1 q t" Y+ X m# J! \. v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* ? f' o' J: [% L! W4 K( X3 W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# m5 C5 a+ v7 J/ T* _3 z% X
write('</ilayer>')* V( r9 q+ |: s+ B2 D
}
% x8 q* a2 z- L- r: ` Fdocument.write('</td></table>')3 L7 J4 @8 ?% J) p" ]0 {5 h
}
. ~' w( g. {# X. ^2 N2 L! p}; O! w; n7 s7 }" q$ K- e( J( H: X
</script> |
|