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

|
网页之跑马灯文字特效
//修改宽度% z) V( q4 y/ h$ f8 ^% ]' t( @
var marqueewidth=3008 x1 m' I( n. [$ G* j2 W3 Y
//高度
2 e1 w* ^/ O/ F' E D3 a! M0 R9 Evar marqueeheight=25 B" B0 E! B2 w+ |8 b! y
//速度(1-10)
/ t" S5 [. l! S' Fvar marqueespeed=3 h3 k3 g8 v, {: K$ `' h
//背景颜色
# x' x6 J- o- V( C! k- J: K. z, z2 lvar marqueebgcolor="#FFFFFF"
( s/ \6 Z* S2 z& ? ]//是否能暂停 (0=no. 1=yes)?
5 ^- \" e+ X% |5 rvar pauseit=1
: i! Y5 {1 e3 x$ g; ~" K# a7 w
/ B1 L) e" N1 a9 N( U" Y4 m//修改显示内容 ^. f; x! U$ E ~% P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% k0 A Z, J/ b3 v+ T( j- g$ I
9 M) M% `! Y5 B- T% E7 t* ~- V; k4 E+ e4 K8 i% _/ v
////下面不需改变////////////" }) g2 x# Y& l P% e
2 H& f' \4 j0 Y9 g) Q+ _var copyspeed=marqueespeed
4 V2 \1 e8 p) @, X' Tvar pausespeed=(pauseit==0)? copyspeed: 0( E* F8 }2 E6 o* X A
var iedom=document.all||document.getElementById e) D9 m9 _# j& `/ e8 j+ J
if (iedom)& a) V2 Z/ c0 v0 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 Q4 a/ o0 u, q
var actualwidth=''
# U5 Y1 I* x9 \9 j6 Evar cross_marquee, ns_marquee
+ E0 Z3 e ~7 w$ N1 t& f4 m3 p9 O$ B
function populate(){
+ Z6 D; a& }2 N. rif (iedom){- f: @0 ` ?2 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& S9 e; P* c2 j& Zcross_marquee.style.left=marqueewidth+8' l2 p/ x" O, c; M* z7 ]
cross_marquee.innerHTML=marqueecontent0 w& J2 H7 @4 L0 o+ `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ a% V% F% l$ I}4 a( G6 g* `/ J9 ~, Z9 `
else if (document.layers){/ G$ X* K( E1 S o
ns_marquee=document.ns_marquee.document.ns_marquee2, k. _! D; s: H, d
ns_marquee.left=marqueewidth+8
. \9 c- d H, K& }ns_marquee.document.write(marqueecontent)
* o! @- Y+ |, F: z; _" nns_marquee.document.close()/ w+ r- r: I3 D! ^8 [, i
actualwidth=ns_marquee.document.width
# }5 ]% R4 o1 f3 y}' T3 w" q8 t2 Y% t
lefttime=setInterval("scrollmarquee()",20)
7 z: R4 W9 K: u}; U& D, k) U: Z% W$ j9 O. T7 e, Y2 J. u3 ?
window.onload=populate
I/ h7 v* p, Z/ P% |: A. e3 ?9 s, e
function scrollmarquee(){4 _; t$ g2 D$ e9 T% U
if (iedom){
: f( F, ?# U$ c7 m+ k8 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- B! `, ~+ Z$ L9 s3 Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 e6 m9 S% ^3 ]6 e! y' F! {" T
else6 x$ E7 N6 W. I3 k& }9 j
cross_marquee.style.left=marqueewidth+8
4 d# ~- n6 B( o7 D9 I/ ^# A: x1 v4 i" ?) I( A
}5 N4 v4 f) N: U& w
else if (document.layers){
; U9 i. N1 M3 Oif (ns_marquee.left>(actualwidth*(-1)+8))
* W* Q; K7 z# Ans_marquee.left-=copyspeed" c" r4 p. d9 S9 O
else5 d, f' \' ?4 _" [" U# z5 u
ns_marquee.left=marqueewidth+8
9 R3 ?% ^- }9 F7 V7 _2 d0 Z1 q}8 g# [" S1 D5 I5 v" }
}
- V9 P! w& j- G0 A7 ?! o& P8 N) `* k/ o+ w2 B% h
if (iedom||document.layers){; @5 K0 O5 V& g8 b1 m0 ` `
with (document){
- _% _) B. q' B" B8 h7 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" Z: k) @% c8 r5 G6 y! I
if (iedom){
* g. v M/ c) E, h$ f" d* jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 f! r" h: b6 s9 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 i, M* x6 V7 w7 k5 [5 g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') c6 o X* }& E' P+ y! y! e
write('</div>')
6 m% T; l, ?" d- h7 {: O}9 q0 @$ g$ ^9 i; F1 L7 w
else if (document.layers){* L1 y, U% h+ v9 p! U/ i/ i% A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: B0 w9 D, M5 V9 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 P! h" R, h. L( K- Vwrite('</ilayer>')! c, b' X0 o! T1 n0 u8 i) e, A
}- ]9 c0 U) y3 e D1 `7 F
document.write('</td></table>')2 x' K9 q. y0 H3 q& Q/ E
}& `" Y+ H$ a/ Z- e1 J6 b7 G
}9 Y0 @6 P% } T; A, c9 l% G6 S
</script> |
|