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

|
网页之跑马灯文字特效
//修改宽度
6 w5 D! q7 }" n: {" F2 ^3 N" Nvar marqueewidth=300+ T4 {8 Q" ?* H
//高度& S1 J3 R5 @; E' T! e3 I
var marqueeheight=259 ~+ a& I4 k1 J5 v6 |: i
//速度(1-10)3 G. U# d1 S! r& D& N* E
var marqueespeed=3
" n# C2 ^2 l$ N& h//背景颜色
5 w( Z% Z+ M; Hvar marqueebgcolor="#FFFFFF", b& E2 q/ c* _
//是否能暂停 (0=no. 1=yes)?
4 U1 o5 S' @; \+ V8 Hvar pauseit=1
4 u" D1 L; v. g$ h' ~* f* A- ^3 w2 \) a
//修改显示内容- p$ w, F, g& Q. R0 K2 N% h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') [$ }7 o* C+ [: w
$ Y/ a, N. U, c1 G8 U3 C7 n! k0 E! S$ c# x9 U
////下面不需改变////////////2 W: e" U7 j, M4 }6 g1 j& g
2 e' Y: \8 @0 ~! v0 k
var copyspeed=marqueespeed; G+ }# i8 U* }! D* U# i
var pausespeed=(pauseit==0)? copyspeed: 0
! m, K0 i4 I+ E3 F* n% B! hvar iedom=document.all||document.getElementById
1 |2 |$ D+ g, v/ A/ Z; I& gif (iedom)
' N% ] P* _. G$ zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 n/ l( x2 F8 g# f- _% w3 G
var actualwidth=''
8 u& ~# B* [" \2 N5 y# q/ Pvar cross_marquee, ns_marquee
' Q* v* D5 h0 T: n9 W' v& T z B; d$ Z6 c: ?$ W/ ^5 I
function populate(){
4 ^+ K3 I- c; e/ w, ]" Hif (iedom){0 Z9 ~- ?6 |* V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 K- o$ E7 N" I& L2 |! }cross_marquee.style.left=marqueewidth+8
; B. V6 w! S* J, w% Z& k# F2 kcross_marquee.innerHTML=marqueecontent
( y' F. K* U- k" v5 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 [$ t2 B: ], m% K" I! L
}
! p T/ @3 z/ A9 E# j/ pelse if (document.layers){
- P6 }4 d( }& }: V9 c+ rns_marquee=document.ns_marquee.document.ns_marquee2
# X5 U" s1 @9 G* qns_marquee.left=marqueewidth+8
+ R# |4 G0 o6 Z7 J, C# a( N; f1 F: Qns_marquee.document.write(marqueecontent)
: `! a1 o& Z, r) s* H* tns_marquee.document.close()# F3 v. ^1 u* m
actualwidth=ns_marquee.document.width
1 \" _# k, X$ s0 q6 B5 f}
- o( |) T, I" q6 e% j4 \6 G. \8 flefttime=setInterval("scrollmarquee()",20)
- y: p) j: y6 a% y' y/ x! T! _}7 {* ]& `! p* A$ \5 Y
window.onload=populate7 l4 s9 L, N% o. }2 A
& l7 S v) X) _. \6 lfunction scrollmarquee(){
) M$ z, u4 B+ }) Q2 dif (iedom){
b8 P/ K# D1 p$ {- x+ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ R* B5 ^3 O3 U) r* o: H% ~ }" Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) Z1 q' e8 J6 l7 O, v) r1 z% T
else
3 x9 P3 B0 T( Ocross_marquee.style.left=marqueewidth+8
3 J8 S: o7 N5 Y% G$ r/ S4 w* }
. X, b7 ~9 M/ ?}
. v4 [1 K8 [3 w' {+ Y) celse if (document.layers){' @* [6 l0 c' a3 U
if (ns_marquee.left>(actualwidth*(-1)+8))
. L5 w& e- y( t( ?& j# yns_marquee.left-=copyspeed
9 V6 N3 g: V; f( k0 X* B1 \5 Belse0 f3 t: c" J! ?
ns_marquee.left=marqueewidth+8
; K; }. b5 F' d( ^4 o}. s3 H! l# X* ^3 A W
}
4 \4 i6 j9 Y8 T$ D$ J: G0 q% Z5 x: B' f; l" r
if (iedom||document.layers){5 W5 O- F& u1 t$ M1 k
with (document){
, l+ q8 ]$ A0 t, e5 q0 f6 [* V, jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ M' v" h" d* i" ]
if (iedom){1 K! ?" p$ ^' {4 M5 J1 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 r5 P6 Q5 Z- P: `! h' Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' ?& | r' L& t t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" V* [3 C' W, w
write('</div>')4 i: A% i' y( ^: P- J! }
}' W2 R$ O$ ^0 F# d) x
else if (document.layers){
7 `1 Q/ t$ I' q+ W! jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% j, Y+ E2 f! [( M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( F& t/ _1 i* u9 d
write('</ilayer>')
0 S; N5 [# x' b}
, |; i2 p: ~8 u4 x4 J: Bdocument.write('</td></table>')
) L# \' O3 Y3 s+ a, l. @% t1 J}$ g2 Z$ m' {2 o* k1 j' Q
}" m0 s, d' c/ v% K3 R
</script> |
|