返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ V& b4 i# b4 j* M
var marqueewidth=3000 Z- Z- I4 m- w' k" v+ o
//高度3 Y- p1 V" j$ `( H
var marqueeheight=251 `% d. B7 z: c5 v) `
//速度(1-10)7 |( O& Y$ i8 y( u
var marqueespeed=3: S8 s, Z( v/ u! \% @' i
//背景颜色) \  A" K3 {  ^" y
var marqueebgcolor="#FFFFFF"1 o/ f# z' Y6 ~, {2 G
//是否能暂停 (0=no. 1=yes)?
4 o3 O5 b' \7 G1 s, f8 Q% pvar pauseit=18 c% \) h+ O" R

3 L; m# ~. \. @//修改显示内容
: b! x# V9 Y/ g: _" e6 m8 v: Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 }3 O( u3 ~4 q7 h& O
4 t. M: c" ?1 \$ S$ [- Y5 A

7 V+ U2 u9 T- G) |$ i////下面不需改变////////////: p- B- t; e" a* n; v. d9 E

) F' P6 {* ^/ z! Z5 k* c6 V7 m. Svar copyspeed=marqueespeed) Q6 H" |7 u) \) n  j. F9 ^
var pausespeed=(pauseit==0)? copyspeed: 0
0 C7 d' B7 Q2 Cvar iedom=document.all||document.getElementById3 Q- v; k0 Y1 j
if (iedom)7 y1 I9 O  `6 }' L; S, i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 c2 u, y. A1 g' J# ?: r) cvar actualwidth=''
% O% B+ i( D; q/ hvar cross_marquee, ns_marquee4 Q4 p5 R3 a& C1 q* g

/ V2 H3 q% A! O& K: _" I# Mfunction populate(){/ M$ ]6 P. m: V
if (iedom){- T! n9 R3 [' Y  l- f/ t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 Q' E8 G: N3 M
cross_marquee.style.left=marqueewidth+8
5 }1 X* o0 Z4 a* Ccross_marquee.innerHTML=marqueecontent
5 j3 i* K3 e9 A2 b6 ?3 b' H9 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 O; b; E" {6 v: ?$ S; T8 s}4 g, }1 ?) T3 C9 r9 u
else if (document.layers){
5 [1 T9 a) x: c% w$ Xns_marquee=document.ns_marquee.document.ns_marquee2
% Y, I; {/ \0 v0 S% qns_marquee.left=marqueewidth+8) T& \; l- d5 e8 q# B* `
ns_marquee.document.write(marqueecontent)
' d) D! @  Q' l; t. ^ns_marquee.document.close()/ S3 _9 c3 @4 p
actualwidth=ns_marquee.document.width
5 B- T" q  n5 X2 W$ P" i}
3 e( [/ _8 o1 i$ r! I+ ], Llefttime=setInterval("scrollmarquee()",20)( J' b4 Q" K' U  D8 }% |) Q. P. p
}. O' f9 m1 |4 B" H4 V" |+ I  a! ~
window.onload=populate
3 A& J5 r5 i1 B$ u
& s9 R: m: C5 }3 b3 Afunction scrollmarquee(){$ d+ ?* c0 V! Q: l" @1 I
if (iedom){
7 C  D! ]* j6 J3 ^6 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ?) y2 j; O+ z( c3 N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- L% X3 Y2 I% O6 h; |* kelse
9 }# ]& R' P% W; E5 Tcross_marquee.style.left=marqueewidth+8( U' h% E$ }$ \5 {
1 b% y- H, O6 ]2 v* O
}
- ]+ ^  P6 [! Q$ K- Nelse if (document.layers){! V7 U1 i1 d; [% ~* E4 k8 ?$ f5 }
if (ns_marquee.left>(actualwidth*(-1)+8)): p9 V0 Y* }) m9 g. W
ns_marquee.left-=copyspeed" B1 v! q/ A. R$ p3 Y
else
3 `. @5 T: C9 k' p( }ns_marquee.left=marqueewidth+8
1 i1 b  E5 f" v" ]  c7 ^" p/ e# I}
# C3 L7 F  }0 G9 j/ j, b}0 Y" n6 \# ~( n* D) a

# g2 P/ J  A' n0 B7 X( _if (iedom||document.layers){
3 P) U! ~0 B: W3 B, Xwith (document){  I8 Y, t' {- Y9 o& g$ y8 F  \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 }- t7 ]' R8 k9 [4 Z, z, s
if (iedom){
! A; @4 W" u: O; Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, _% V8 O# v9 ?+ Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! ~5 z7 e& x) k% z4 d$ }+ p! S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). d: o6 q# y% S" O" G
write('</div>')
) |' z6 b2 n* f% Q( V6 w0 T}
+ Q& b. V% j4 S+ H9 q9 q$ `- yelse if (document.layers){
7 S8 x# l0 _, S, V+ r- Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 X. v4 U; A4 F  K' hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), i6 d) s/ J% \
write('</ilayer>')
7 `1 D+ o6 ~! G2 L/ H: U, w}
+ l0 Y3 Q; f: O/ W9 fdocument.write('</td></table>')
# I; z# L3 n# @8 A8 Q. Y  E}
; h+ t- m4 b5 o% ^6 K& m}) z/ X- l$ o; R# Q2 W& R" a3 J4 |
</script>

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