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

|
网页之跑马灯文字特效
//修改宽度0 Z% E$ S: M; ?# h4 |+ M$ o1 ~
var marqueewidth=300( A0 ~: R6 W K. Z- t* y" C9 g
//高度+ c9 r1 _; f$ g- U) H) J" X- k
var marqueeheight=25! ?% d6 N- e$ d" d7 R4 P
//速度(1-10)
# K% k/ B' y+ I9 kvar marqueespeed=3
6 f% b1 Z$ y! t//背景颜色0 D/ ^3 A3 [9 |' V8 c
var marqueebgcolor="#FFFFFF"0 e1 O1 T/ O* u" `
//是否能暂停 (0=no. 1=yes)?" f7 K4 P' U, b, P2 P1 ^
var pauseit=1
# {1 g D& i6 V. T$ v. \9 y4 H4 V* ]' J: [; V7 E
//修改显示内容
# m3 p1 v4 l4 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( y- j1 k# E7 R8 G. h5 e! Z) C6 t R& H q* e
" _( }* c( o5 N; x
////下面不需改变////////////
2 Y5 @9 T- b: L' J( v* h
1 H# k/ _! W1 _# U/ o/ {' Jvar copyspeed=marqueespeed1 h" j! j2 B: e0 X c
var pausespeed=(pauseit==0)? copyspeed: 05 X1 I' S5 i' l$ q# ]
var iedom=document.all||document.getElementById" ]; y3 {% S- d- r5 V, i; b
if (iedom)4 K( ^9 v# [$ Y1 s& m4 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 |& Z& \+ S' L; u+ _var actualwidth=''
# p3 Q1 n' h0 T& y# J9 L& Dvar cross_marquee, ns_marquee
$ R' `6 K9 m* C8 c5 J# M+ J9 R, E' S) ^+ J- U! a
function populate(){
( \- H! m1 z. c! n% uif (iedom){
3 q$ @' X# c h9 M; T+ hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: D3 D7 P6 }' f1 e. Icross_marquee.style.left=marqueewidth+8
2 a. q+ t9 e7 G9 n- [! tcross_marquee.innerHTML=marqueecontent
: V3 U- A; Q$ W. W+ Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 p2 [4 E) ]3 E- E
}, F M# `% i) |% |$ ? V+ N+ K0 }6 e% B
else if (document.layers){6 F% U, p1 q& z# Q, h: t
ns_marquee=document.ns_marquee.document.ns_marquee2 d+ O% a" V" Q& g. x, Q: f1 O
ns_marquee.left=marqueewidth+8
' R1 W1 w: s$ c% I D/ \ns_marquee.document.write(marqueecontent)& r! g# F, | z5 ^4 `0 k
ns_marquee.document.close(): K. S, l& t5 y9 M8 U
actualwidth=ns_marquee.document.width, k" t1 k( F, p
}
1 W2 t3 w9 M3 H$ \/ V7 e8 blefttime=setInterval("scrollmarquee()",20)/ E. i$ Z9 X8 N
}$ t& P E, O5 f2 q& C) ~ H
window.onload=populate
; z; n# d7 u' D: C" v4 n* k: |: T: u8 z# N6 r( i7 j
function scrollmarquee(){
) D8 Z. O5 w4 ?9 m9 P$ sif (iedom){
* ~/ D1 t8 u$ w& Z* u) w" [5 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 ^" W6 N# ~* Y! y: ?) g. g+ z; J4 T* pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ B X% w9 \6 R: p, O# h5 ?9 Y2 \else
, I( Z3 p$ [' _- ?3 o/ Q* icross_marquee.style.left=marqueewidth+8
/ ]) k6 d5 W2 r) X
z1 j3 W) g' `& I$ w% K}, H0 {( i1 a5 c, p$ k
else if (document.layers){/ W1 P8 d* ?2 A: J: E4 L
if (ns_marquee.left>(actualwidth*(-1)+8))) Q* S: h* |$ c0 X- T& P5 D
ns_marquee.left-=copyspeed
& Y0 |$ v% Z% u/ J8 M V& p! b; ^else9 H8 q3 G* ?* b% a( t9 x1 S) K
ns_marquee.left=marqueewidth+8
: k) Y, \, }! g& K3 x3 v}
% g! y4 F* @# E" l4 J* s}
. l3 c' y6 e& `8 @$ {: [. n+ ]/ W/ h1 j
if (iedom||document.layers){
; p) G: }; o: Q7 z' r; Q2 c, o( Zwith (document){8 l+ ?6 M0 ~: C3 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 n4 J( F9 I! [
if (iedom){
7 s6 l2 u' N- zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ K6 a) z, M7 G- h+ D1 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, @3 g& N+ O- Z. o/ ^6 o& I" ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') V. V8 q* [0 Q3 b/ m$ A3 s; I
write('</div>')" T! S* L: c7 A2 l8 i# h
}7 ?0 N2 Z/ V+ i" E
else if (document.layers){+ a" d# g+ k2 k2 _& \1 X6 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 B7 x3 K1 o }2 J3 ], v$ y' Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, Z4 y$ u, h G0 `: _! ~7 R( twrite('</ilayer>')5 s4 ?8 r) w. Z& K' r
}9 x; Y9 G$ j* ?
document.write('</td></table>')
# o4 @# C$ u: E}
9 [8 @/ @8 i$ h9 B}
: N( n- ]% Z4 y6 Z6 E</script> |
|