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

|
网页之跑马灯文字特效
//修改宽度
6 U( W* D$ {9 qvar marqueewidth=300, H2 o0 D0 [9 E- s0 F
//高度
) |1 Z" K) z: k1 rvar marqueeheight=25' i9 S/ j# I! [3 p! k7 w
//速度(1-10)
j0 x: J' V* {, Xvar marqueespeed=3
5 j$ Z# u# b; t9 S//背景颜色4 k& E! _" E; X( x5 n4 |
var marqueebgcolor="#FFFFFF"' I: W( c% {5 m3 g+ B0 C
//是否能暂停 (0=no. 1=yes)?% b* h8 a" u% k8 X: ]! m
var pauseit=1
3 x+ u$ W8 @- U9 v5 ^
" o: M0 A- K+ c ~//修改显示内容, D" `& E/ w4 P* v" K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% L# ?) V$ Q- N# y
" }2 A3 y! i, U( q' _' ?% ]4 W
; l+ D0 `# b; u, z8 B0 U: B" ^& `3 w
////下面不需改变////////////9 `3 o2 x; @- v: H4 h9 ^$ O
3 Q& q# H0 n: Y6 l$ s/ I+ mvar copyspeed=marqueespeed
9 c% @" i( }% [* |0 R1 b# zvar pausespeed=(pauseit==0)? copyspeed: 0$ l5 D+ M, p6 K$ z+ Q+ j+ v& | j
var iedom=document.all||document.getElementById
4 A7 i+ ?( k( O( \0 c% qif (iedom)
) \/ Z- M# ?/ E$ h. _% H' `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 B& [9 U, o% qvar actualwidth=''( w: s3 u. H* q5 t' h
var cross_marquee, ns_marquee
& D* f; k0 N# e }7 O( j. q9 ]# j0 f. l2 }
function populate(){5 w9 K) k8 m$ B# Q, e2 W
if (iedom){
% V( w- X5 M- ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 M8 ^# M3 L. s9 X" a
cross_marquee.style.left=marqueewidth+8
; H R7 R6 P. T8 ?- v& ?) lcross_marquee.innerHTML=marqueecontent% W8 X. U; _+ Q( p$ v7 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) k' P3 D& i v+ ~6 M
}/ V0 G2 f! l2 W% p7 B; v9 Q% ?
else if (document.layers){) L" ?1 N8 d' s" H! { Z. X
ns_marquee=document.ns_marquee.document.ns_marquee2( I4 B0 X! j! Y4 k
ns_marquee.left=marqueewidth+8
; N, l. M# u, d# \) Q$ q- z$ d' `ns_marquee.document.write(marqueecontent)
1 ^( u- c; O( g/ [; m) h4 }" pns_marquee.document.close()# e- ?: T: y3 ?$ O% _3 H# p9 W
actualwidth=ns_marquee.document.width
' O0 c9 _1 s W% ~* o}+ S( B# F/ o+ E) Z+ w
lefttime=setInterval("scrollmarquee()",20)
" c% T1 \! @/ w& b! Q9 H}: _8 o3 |; F% Q! X9 ^
window.onload=populate
1 S. X$ Z1 m1 ]+ l7 K1 j) B4 Q
, Z' I; u0 Z. H: jfunction scrollmarquee(){
, j1 ?) s4 x* T, X. ^. Hif (iedom){% e; L( \ G' N$ B/ Y, u4 G. c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ n0 G6 h% d/ j1 |) p9 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* \& E1 _) m2 X- M q
else
& z/ G2 b o2 a! gcross_marquee.style.left=marqueewidth+8
1 a' B9 m( Y6 x$ s* [& H8 {) Z% U. Q# A- {
}3 L# r8 ` @8 j) N. @8 z: K) i- o' ^
else if (document.layers){
$ ?" M, W% C* O3 |5 N/ T3 Lif (ns_marquee.left>(actualwidth*(-1)+8))- I) B+ z7 q- [' X
ns_marquee.left-=copyspeed
3 @8 t4 f; Y+ b! u1 `else
$ G% K1 f+ r% o) Pns_marquee.left=marqueewidth+8
3 n# O7 A; u! v& x) C( D" Y2 ~/ u, x}
/ X2 g4 g) n7 X, v& y" m8 J% \" S}8 A7 l. O0 |+ a# b
6 V! H/ H: L( r! R7 l# ]- r6 E" V
if (iedom||document.layers){
' y- A1 w s+ J; s2 z+ wwith (document){# f2 D' s* n- r: A+ S1 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- N% b( G: K8 o7 l
if (iedom){
) W+ f5 [5 O y- k7 `, A4 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ X ~; J. C, o O0 wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; P6 U0 U; B, R1 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 v0 ]& q: o" c# r- w5 Z, F8 `& N
write('</div>')
* p, T5 [+ @ e: O2 I0 _}
; z6 P6 |. T g$ O2 U* Nelse if (document.layers){+ |8 E0 V5 e* t4 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" p, |+ r3 F/ L1 t6 b6 Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! b/ ?4 e3 g# R( s7 B/ D/ s, b# Uwrite('</ilayer>')
6 U6 {" } D1 b' g8 d/ N}
; h* k5 J2 R5 Q/ D' e, s1 E" Vdocument.write('</td></table>')
0 b9 ~7 ?( x2 |: K+ l; r}
8 E+ o' \/ Z0 j, v# e8 K$ \3 l}4 y& d8 O5 @3 v' A; g& E5 A
</script> |
|