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

|
网页之跑马灯文字特效
//修改宽度
3 A4 S! X7 D5 I9 y3 Pvar marqueewidth=300& W* @8 i2 I, x; d; q
//高度
4 U& G( ?4 K9 I$ z V, ivar marqueeheight=255 |! y0 g9 x2 `& Q7 z
//速度(1-10)( F( k$ I! x% Y' s
var marqueespeed=3
$ i S9 D% w. N/ ?# n; t3 c+ X//背景颜色
8 T, S$ O2 b4 Ivar marqueebgcolor="#FFFFFF"6 p: }0 R4 z9 e8 w4 B0 E
//是否能暂停 (0=no. 1=yes)?
6 f( O2 K8 z$ T/ Z" E6 ?8 fvar pauseit=1- ^$ C' u4 P0 P: Y
& H& e; M7 H/ E' \. j% L3 ?
//修改显示内容+ s: S: e" _/ Z2 I2 S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- K5 O% u4 ^2 ^" H( ?& X2 M3 R' h. f
2 S7 [/ s! M; P" Z' J////下面不需改变////////////
- c" c3 |$ j, w+ h9 n, N, M7 ~- J% E6 `/ c+ z
var copyspeed=marqueespeed: |( Q/ G, g$ Q t" q9 `+ Z
var pausespeed=(pauseit==0)? copyspeed: 0; { H4 {3 s: u1 J: A# P
var iedom=document.all||document.getElementById
8 K9 e% J) @5 m" _3 z7 M) V2 L9 S9 ?/ nif (iedom)0 X8 C F- q/ n' z6 e! n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 S8 S+ t, w9 F. R. A' e# R
var actualwidth=''% d% e$ E2 w6 Q1 G+ `* W1 Y
var cross_marquee, ns_marquee% ~( {! n& d9 k3 t3 i, Z( ^
+ [9 d( o+ R# c3 `9 _function populate(){! z! L. R S7 X. i/ L" f; t8 c
if (iedom){
* a. ^5 {+ \% a/ ?: Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! T# m# \; @9 J/ s% G9 @cross_marquee.style.left=marqueewidth+8" G" O3 \$ t8 {. v# g/ S4 h6 X
cross_marquee.innerHTML=marqueecontent& d" O4 X4 \0 D" \6 c; a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) [( h: N8 y y% `}
/ u F1 I* W* s; b9 gelse if (document.layers){, {2 Z4 D8 O3 r i- |" ?
ns_marquee=document.ns_marquee.document.ns_marquee25 i, F* n H% {% c- a/ ~! B' a
ns_marquee.left=marqueewidth+8
' `- D* ?5 }0 F9 Y. \/ ]ns_marquee.document.write(marqueecontent)
( [$ {) j- s2 t: O$ T/ D9 e- N: z7 }& Kns_marquee.document.close()/ v+ ]4 ^! ?; T' m
actualwidth=ns_marquee.document.width
5 ]6 k2 i0 d. n8 U! c( p; s}3 |0 [$ U/ u! ~- I
lefttime=setInterval("scrollmarquee()",20)
8 _/ u4 a( m. Y}
0 L( f8 E9 ~- s& j' ]' y6 Ewindow.onload=populate' E, ]% A1 K; U4 O- {6 j
- X x. |$ A7 h. h' p( W" s
function scrollmarquee(){
# q& K, N# N' h# a" o7 Tif (iedom){
, u: @- _! {& C1 B2 P8 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# v4 \- ?4 Y7 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) I6 Q8 h. j* K; ?& t# C$ gelse+ {+ s/ u4 h4 s% T# C/ R& C/ k' V
cross_marquee.style.left=marqueewidth+8
0 k5 Z8 I' A. A: j* P$ a& L: V' T+ w- X( z) S
}* x8 A" i, H/ G* O( W1 v
else if (document.layers){
) S5 U. u8 g% j4 I1 F# n; Jif (ns_marquee.left>(actualwidth*(-1)+8))
* `. o1 E/ ^* c9 ]$ ^ns_marquee.left-=copyspeed
* X* r0 D. A' \- b( Kelse
0 E+ J8 E8 D+ ]/ ^6 [ns_marquee.left=marqueewidth+8 @; p: l3 ~& o
}
' u: O& ~2 l" E* \. T! A}
7 E C9 R; V$ D& I% J) S
7 `9 {$ E2 y/ _5 b6 u" Q# M" Tif (iedom||document.layers){
1 w* b* A+ f2 c4 Iwith (document){! ^% }; i n" m d# H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" ]! U6 r" \ ~6 eif (iedom){
% G. T; p9 H0 Q$ n9 i1 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
k+ C+ o* T4 \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( b2 ]- m7 j* }6 Z$ K. b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! }( g/ _* s2 ^5 B
write('</div>')
: D- s4 K5 p, N2 J$ B) c7 l. {2 E}1 E* Z( i; ` h$ i
else if (document.layers){
( N8 w2 B# `; v( G6 C# E$ X& y: X) Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 D& U/ q# l" Q1 Y7 D% f! Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') p7 h2 j! m' [: S/ x% y$ e8 t
write('</ilayer>')4 I4 Q1 E( e& v% C+ Z( ?, O! l
}: i! Q, Y& l9 K2 f
document.write('</td></table>')
& G7 `# I# z( _" E; e}: F) D- j/ q6 p5 M( L+ d
}
, Q( f3 A$ R' F' T4 A# t, P, o1 F, e</script> |
|