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

|
网页之跑马灯文字特效
//修改宽度
4 i+ M( d7 A1 Y! k! `" d0 Q2 bvar marqueewidth=300
$ }' V! u' U& H//高度! B5 V7 Q$ {6 A f7 D$ K
var marqueeheight=25& Z2 O3 m5 i2 `
//速度(1-10)7 k6 b- }2 N- d) x* B9 L
var marqueespeed=3
& m% L: W5 W+ U. a/ f) S8 I' i//背景颜色: |7 T* n1 v }3 I- g
var marqueebgcolor="#FFFFFF"8 g4 T" p0 p; \2 g/ T8 b
//是否能暂停 (0=no. 1=yes)?9 t# s8 c. S: [8 u$ v2 Q6 l% W7 _/ s
var pauseit=15 y8 }5 V1 W- W' q. F# Y
& j1 y5 \ e& B; B. U2 B5 c//修改显示内容
# p% O$ ]% @* W3 ^+ z1 f# P" C7 gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% Y' |/ | H+ \5 F! i' ^
* a e4 Z! A& `5 h& Q+ o$ {7 i
& _* c; G# b# _0 o+ Z* z
////下面不需改变////////////
8 Z( M& M- t1 m) M5 w
3 [- F9 w0 a* V9 G0 Z! q0 @' P @var copyspeed=marqueespeed) N9 j2 o# ?" o( b( C5 i
var pausespeed=(pauseit==0)? copyspeed: 0
- Q+ S: M) O6 {var iedom=document.all||document.getElementById/ ^8 w D* ^4 h' [1 W
if (iedom)
7 A' E. N. x; ^1 [, w0 I. pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
O7 |2 S [5 X' H5 \: J9 Q; ~- yvar actualwidth=''6 N0 |3 r: P/ ^; c# J& p% [4 j! J
var cross_marquee, ns_marquee9 n. j7 {* e0 `8 G5 P9 m' ^
4 \" {9 v5 O- t( }" p6 B4 N
function populate(){
) [+ a5 T# ]$ p, K' d# V5 W, Nif (iedom){& p* a) O' Y* \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 g/ _% `7 \/ ]# e9 e1 j% n
cross_marquee.style.left=marqueewidth+8
- ~$ ?9 |. J8 d* X: scross_marquee.innerHTML=marqueecontent) a, P' m( j- s1 c# ]- h0 b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ [. i) E" q0 Q, E7 }+ i
}, j" }( D: C+ ]6 s2 Z
else if (document.layers){
) N* S8 ~5 x* u$ h' lns_marquee=document.ns_marquee.document.ns_marquee2
9 f, k; f& A3 H H2 C5 i% e$ ~5 L! Uns_marquee.left=marqueewidth+8
/ k) n, G- m* g( O) {/ Tns_marquee.document.write(marqueecontent)8 O: z9 `0 m1 @ s+ m* O
ns_marquee.document.close()& X& l* ~4 p6 _5 A# J: n6 H+ J
actualwidth=ns_marquee.document.width4 c; x4 S* o' R! {* M
}9 {, R5 o5 T' ?8 j" X* j+ N
lefttime=setInterval("scrollmarquee()",20)$ z; e# v8 |/ V: _! p5 p; C1 s _
}) j) c0 r& _. E: v. `( S; E/ Q
window.onload=populate9 [$ F- @$ g1 U8 l
6 t* D4 Q- U, p1 V5 Ofunction scrollmarquee(){# \6 A. H; S( A G
if (iedom){
3 a8 p7 a1 U. H# ^* f7 u$ ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" U& |1 T4 |+ {5 R$ ~; @ r* j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 i, o; s2 K4 s6 N, X" Y* E& }else; c4 K0 X+ z7 [, Y- P/ I4 u- E# f, q
cross_marquee.style.left=marqueewidth+8
! T9 N0 N: Z% ~5 V L J( J, `9 V n/ K; R9 {
}- z ~* F! J4 k
else if (document.layers){- t. @+ i; v0 D2 q( F
if (ns_marquee.left>(actualwidth*(-1)+8))
4 T% {: x3 B9 gns_marquee.left-=copyspeed3 \# n* { [ a L
else1 T! Q& W- s5 @& T
ns_marquee.left=marqueewidth+8
% A8 y2 x4 z1 l$ R2 s: f/ W}- @7 L/ H6 l9 W
}6 X! c( |/ m. W$ X' ~
0 b2 b( }9 X, P2 y* J7 Q
if (iedom||document.layers){
: q' N) T1 V# J, c+ awith (document){
$ I4 }! b2 ~4 D5 M& Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ]8 L3 T$ L' C$ r' N
if (iedom){1 C& u% e8 k' b! H$ e6 w9 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( j4 h. X% j. L. f6 f! m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
U, j+ E. e5 @: ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 i4 S! D( r9 Z' s, u. A
write('</div>')7 e5 C9 a" Y6 Z
}
' V( k. p# K6 i8 uelse if (document.layers){
: h9 L$ @8 a. c/ L! Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 r& q% T! Y+ v& I4 {0 H& ?) R8 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 V/ C& ]* x- Y3 iwrite('</ilayer>'); M$ D& A2 Z; J6 H
}1 R' p* r. H! k" i
document.write('</td></table>')/ U) k/ y" L& o2 U$ a+ Z
}
, V+ d/ |* ]( i: ^* _6 r}+ R z1 h! a& F1 h/ W5 T
</script> |
|