返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- Y7 t- w  O- l5 g" e' d6 l2 S0 Qvar marqueewidth=300
2 M3 d" Q+ Z( c9 C//高度, Y+ @3 `9 }: V; a  K* V
var marqueeheight=25
5 I, K+ ?  @! ^2 m" R7 @' M//速度(1-10)
8 [, @9 K+ m  Z! |0 dvar marqueespeed=3! n7 X4 B. z& _! v
//背景颜色
6 O, d- Z9 x/ c9 l* Bvar marqueebgcolor="#FFFFFF"3 S9 M$ Q0 b# h' D' X$ P% h
//是否能暂停 (0=no. 1=yes)?- \; V+ `- O( {# n1 D" E
var pauseit=1: l. b& o( }: m, D* `
; E/ a4 e( `5 M) _5 H& H
//修改显示内容
4 b, n! i+ ^3 c: C9 f" @4 Q# c  bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) L* c) ^1 H6 i; |) t- S' J$ i
4 ~" h( T& c9 y, U& U% e  _# C. ^  m6 n8 Z. L
////下面不需改变////////////
1 t5 Y1 {- x& L% W/ ^0 o
" |$ r; J' E, X! Nvar copyspeed=marqueespeed
. H. s# z9 r0 k( S2 Vvar pausespeed=(pauseit==0)? copyspeed: 0% L3 `, [# ?* C1 R2 f. m! M& |6 v  L
var iedom=document.all||document.getElementById
3 q6 y8 J$ |  S/ \% K4 a( h+ Zif (iedom)6 ^& P5 R# R' R" q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 d( ?6 P( t: S( l; i8 G/ ]7 K3 ]
var actualwidth='', y# \& d8 w/ g4 i& k' \1 x
var cross_marquee, ns_marquee) ^( P$ s3 {4 B- O0 _
  E3 z4 ]5 X2 T8 R
function populate(){0 G& P6 Y: ?, ]3 n9 E
if (iedom){5 Z' W* i) @) h7 N% t7 K4 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 r" d& [5 F6 V- q) t
cross_marquee.style.left=marqueewidth+8
0 s" k1 _* t3 u- S0 W8 v# Zcross_marquee.innerHTML=marqueecontent6 g9 [) [9 m  d7 l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 u' e6 f1 u+ X. G& {5 K0 [$ q/ [, X}
4 ~' M8 M% P' Q( R: h/ O- oelse if (document.layers){" U% ?" ]7 U# d1 y, Q: \& _% k
ns_marquee=document.ns_marquee.document.ns_marquee2
0 h7 Y& D/ ]7 J$ k) Pns_marquee.left=marqueewidth+8, Y- J' D( O$ @3 `
ns_marquee.document.write(marqueecontent)
$ |" W& E* R0 f9 P8 e* T- K+ yns_marquee.document.close()
# ?) s" L  n3 r1 Qactualwidth=ns_marquee.document.width
% w3 y' l- i+ }3 N! G) p}
+ G! h" _% [4 U! T3 \  Llefttime=setInterval("scrollmarquee()",20)  X6 s; b  y" i0 K* U
}: G6 Z' _! ^* O& P$ v
window.onload=populate
- A& D! i" h$ B! H2 `
1 I( v: u0 l( X! P9 N7 ]  ufunction scrollmarquee(){
- K4 e; s# A5 e# }if (iedom){
# y, {+ ^; ?: u6 l* P8 T' Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 z+ N$ Y9 y# ?* a* A" ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; L& m" ~' E( Q  G7 b) f- H3 b
else4 w5 _& R$ h' H0 p; H( `% L
cross_marquee.style.left=marqueewidth+8* t/ f3 ?" P/ t
' N- |$ h. l9 E# ^/ Z
}
" R# H/ n7 R* S! B' n$ ^else if (document.layers){
; ^- v. }; X8 K* Eif (ns_marquee.left>(actualwidth*(-1)+8))
. {* G" [( ~+ ]- nns_marquee.left-=copyspeed1 w4 K1 u4 d. C% k8 C! }$ Z+ e* x; J
else( W5 X% A) d7 t( i8 B, w/ s0 L; G
ns_marquee.left=marqueewidth+8
/ L# M  Y) r  S/ }/ v0 v# I}
3 |$ l, B1 @' v0 A$ u9 I( ]}$ ~, h9 v4 @5 a" J' |. f4 E

4 n. n9 b7 p; [* wif (iedom||document.layers){
  a  u1 P1 F4 I  jwith (document){4 L) C7 x/ `) h+ l7 S# q- C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); a* i, W# L, d+ A; y8 H( L& G
if (iedom){  H2 s; E+ B: |* `" |; n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* v3 Y' d) e- [7 m2 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 k) s4 }- \, o: t4 e' [* wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), p* f1 F6 W& P0 a0 ?: r
write('</div>')" Z0 s/ P/ w! K
}
. L' v1 e# u* a0 U0 p( Zelse if (document.layers){
. p! O* ?8 i! N+ o: Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" U/ F- _( B; l7 y- \1 d( Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 M, A$ l& C  l  S- M. ^- T
write('</ilayer>')% E( |9 R6 u7 D
}
) G5 \% Z- c  x* Ldocument.write('</td></table>'). b& H5 n1 v: J+ {, `
}9 {1 ]$ c& f" [$ A( o
}7 F5 t' y9 ~7 w% I. Q
</script>

返回列表
【捌玖网络】已经运行: