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

|
网页之跑马灯文字特效
//修改宽度' B- `6 v: Z3 s- r% o# w+ V1 l
var marqueewidth=300
( J4 w# s: _- m& C* w//高度
8 v& R1 K' E9 X0 `var marqueeheight=25$ v; {8 K5 R* ^' }9 ~
//速度(1-10)
L* i, }6 b( V, o) F. _' _2 Pvar marqueespeed=3
* G6 h4 M8 Z9 _7 K- m0 n3 f3 T0 E* U//背景颜色
: q6 q4 ?5 _! Z! B. W/ T: d$ evar marqueebgcolor="#FFFFFF"7 O# ?/ C* D9 P5 V i$ S! J
//是否能暂停 (0=no. 1=yes)?
% W7 L* f4 p5 nvar pauseit=1
$ t* L* W: [. k' L, i$ [9 y8 s; Z. o4 V( W+ @( Q) Z
//修改显示内容6 V \) y' {! M2 O/ |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% ~3 x) G) ]( N7 @5 _
4 v$ ]5 ?; S2 p- f- {
6 Y! I/ e2 \. p4 f- b0 W, ^
////下面不需改变////////////9 ]8 ~. d% C' M- x- ~3 @
+ u* T8 v2 U1 [3 L, R
var copyspeed=marqueespeed/ n1 @8 |/ T' @. q( k% S# w% M
var pausespeed=(pauseit==0)? copyspeed: 0; l t- O9 W- P4 S( B! F4 F7 `
var iedom=document.all||document.getElementById: s0 S/ u0 h& N
if (iedom)- w Z; |: E3 c" p* ?" C. s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 a1 N; v8 n4 S' F
var actualwidth=''4 a' y$ T9 V1 G" @# n$ q
var cross_marquee, ns_marquee" I) G( q+ c: @) I( q" f6 z9 R2 |
. [% t# @' c) m- n8 Kfunction populate(){
) x' e( T- \5 q; \7 E$ ?if (iedom){& I( T/ v8 J1 ]$ |# @4 j; Z+ l- _% }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ F7 n, J. _7 t- w0 o# P& S( Ycross_marquee.style.left=marqueewidth+8- Z G! ]3 b# e. R% t1 E
cross_marquee.innerHTML=marqueecontent
' o O; f# U8 {* }- [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ \$ o) x; K0 I5 [5 r: ]}
9 d; M7 w) z6 _; D3 K7 c! selse if (document.layers){1 C7 r- n; }: ?3 y l, t+ V$ W- v) z
ns_marquee=document.ns_marquee.document.ns_marquee21 S0 k: L; r; K5 S: z$ M/ S
ns_marquee.left=marqueewidth+8, o- R w" [' Z5 |; z0 }
ns_marquee.document.write(marqueecontent)( A. c% O3 g- G& P% F0 X
ns_marquee.document.close()8 ^8 R5 O0 p2 Y/ s
actualwidth=ns_marquee.document.width
7 s, @8 m0 a2 }}
: [* o. P2 s" Plefttime=setInterval("scrollmarquee()",20)
; A0 w O7 h. I}/ Y! f6 d9 u8 K; C
window.onload=populate7 k- b1 _ X5 ?( o6 E4 a9 C' B- m
' u5 d6 R5 I" }function scrollmarquee(){9 G4 y P; R) v( N- j
if (iedom){
1 X* V% a* e' [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 f& F4 ?' E) P. `, E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 W4 r2 }. Z; u7 Qelse
% I: l2 Z5 Y( f, ecross_marquee.style.left=marqueewidth+8
/ q1 T' l4 B. C7 L$ ^0 Y) c* e
8 F/ B' r2 l8 Z! |} C. }9 z2 d( A: n9 z# f3 B
else if (document.layers){
0 }" _+ w# Y5 m5 s# W! K$ Lif (ns_marquee.left>(actualwidth*(-1)+8))0 h% U7 y: S$ {2 S$ C* z
ns_marquee.left-=copyspeed$ I) k) ^( h5 X! ^
else
0 U0 }6 M3 t* B) H2 ens_marquee.left=marqueewidth+8. q' j0 J% I. q$ C
}( @" D! t+ \$ \' g* [( t1 A4 x
}' u+ P. A, [: }" ]5 B/ D" @7 F! k
, A! L+ d2 {0 X- Q @if (iedom||document.layers){
: ?3 Q- _+ V- J% bwith (document){
5 _/ R5 w5 Z! S8 y( I$ Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 n# m' C. y8 J4 w8 [4 h" Qif (iedom){
& \% e. ?5 M3 m% j" F9 Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( Q1 `2 @- O! `2 L R+ s6 Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
q& O' [ p2 z4 N4 b8 v1 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); O' K8 I% J+ z. a8 r! v6 e% }% V
write('</div>')
8 | F8 o8 e; F# n9 R}
0 X8 I% L3 c9 T' M q' ]# P3 w7 ~ gelse if (document.layers){
" u' X( |( l4 K7 E( \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 @5 {) l9 R8 b6 p2 I1 V8 k; W; \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ f6 [- G4 h3 V6 B9 B; Y# `write('</ilayer>')5 C5 {2 I" S6 ?$ L& t6 y# C
}
. C. Z$ ?' ^) ]' Hdocument.write('</td></table>')
7 D o# I; B6 z1 \2 ?6 `}
' ^' C4 }( w6 q) T}/ |/ O/ U: Z2 m y4 ~5 O
</script> |
|