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

|
网页之跑马灯文字特效
//修改宽度! ?# i7 y' t0 Y' q
var marqueewidth=3007 u. W7 O) x7 q$ {
//高度
" D- D/ l# A, P1 M+ G7 p! F4 X' F bvar marqueeheight=257 w$ @$ j3 k W% J: n/ I+ C
//速度(1-10)
4 X/ e% {2 E0 y( l- Ovar marqueespeed=3" M) ^* f. L# ^5 W$ W; O9 w# J
//背景颜色
( R- q7 v; O7 o) k bvar marqueebgcolor="#FFFFFF"& z2 t d6 ]% M T6 e, k) J
//是否能暂停 (0=no. 1=yes)?
' p9 Y! }: y5 u# v9 G+ }var pauseit=1# h& q B" L- {- [3 ]( Q Q% C. g
/ N$ z6 u: H' y% I, E//修改显示内容0 l1 i. C, M/ n" A) Y! h6 f* d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' B" B# _" F8 o
. F7 C* t6 e2 z
6 j: m6 B0 z. U1 S5 L1 C2 f////下面不需改变////////////& \2 f* f4 a: ^0 h8 v# s g8 z
0 E7 _, E+ F- x- t; H' lvar copyspeed=marqueespeed
# O+ i) Z% z5 S0 Ovar pausespeed=(pauseit==0)? copyspeed: 0$ \( {$ ? J3 r9 ?/ r1 ~
var iedom=document.all||document.getElementById7 t- h+ h+ @) x% f' K) ~, ?) j
if (iedom)) \) I7 E8 b! A) r6 w7 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* o& m* q' V: V2 @var actualwidth=''0 r% V% e; I2 [1 B7 W8 p
var cross_marquee, ns_marquee& k4 ^4 y! o; B% x' W: @
0 ?* Z' P" t/ g- h
function populate(){
+ u+ I* N: F8 B2 W# ~0 d9 nif (iedom){% F* K8 q0 I+ _# j8 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( B" d" M9 F3 x4 m1 X
cross_marquee.style.left=marqueewidth+8
. H' G! I- T! w( P I' D& s8 bcross_marquee.innerHTML=marqueecontent
6 G6 e$ f, L+ ] h+ qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 h% u$ Z" {6 a" L8 G3 F
}
" [9 J% T8 `# t6 J0 O5 ~else if (document.layers){, ]; A6 Y* n* q( t+ p$ v+ g
ns_marquee=document.ns_marquee.document.ns_marquee2
" g+ R: h6 z$ R! \ns_marquee.left=marqueewidth+8) p' i, Y$ t$ u3 V7 T5 C
ns_marquee.document.write(marqueecontent)- D+ |' k& o! `. E
ns_marquee.document.close()9 X+ J# P7 w9 K
actualwidth=ns_marquee.document.width4 x) V& _) _; U: j
}) q1 ^' V/ W# i' m# k
lefttime=setInterval("scrollmarquee()",20)
]; ~8 h$ |, T, t7 q: S}+ [% ~5 }4 n) c1 i! g
window.onload=populate
" O( M! w' B8 L, B$ p5 k; C% x6 L% ~0 j! { h4 v3 m
function scrollmarquee(){
% N0 a, V3 O# t) p( Vif (iedom){ Y, c; J7 H' R H: m |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 R2 B9 l( ?7 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 x, ^8 I; t2 s5 n0 j- O$ n) O
else9 z7 {& B5 J; R. X& ~
cross_marquee.style.left=marqueewidth+8- t# Q% z2 _) }, `: x' X- N2 q
2 [$ {" m. Z& o x# W, V5 ]
}
# i: [# r, ?' k0 B$ S5 Lelse if (document.layers){
4 q; N% @) w: z. C# E8 j4 sif (ns_marquee.left>(actualwidth*(-1)+8))5 N( n! F; D0 j: n; c& M
ns_marquee.left-=copyspeed
2 ~6 @' D6 q& l- B( b5 zelse
2 q+ Z! X# N: |5 Y* N1 Cns_marquee.left=marqueewidth+8
" R |* Q, h% X3 z* N& V}' W1 [) g. r+ Z+ f
}
! b# d) O* N; P2 E n# [, d7 c( U& Z; L0 l
if (iedom||document.layers){- C7 ^: | c+ P0 T7 ?1 _. X
with (document){, V5 v/ |. { P+ l% V& i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, A3 x9 J m: cif (iedom){- j1 q1 f. w2 G" l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 S+ }. C% r% s8 ?3 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ Z( z7 T7 z- ~8 c1 Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* B+ h* y) |/ o& L% qwrite('</div>')
) f$ `% x9 L7 c: l. T; n, ^% q1 v}. a/ I. b" I0 |6 H
else if (document.layers){9 Q, W, D8 U) [8 K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' s, j# R8 C; w' D% r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. E$ \) H, H3 {+ S; ~write('</ilayer>')
; ]0 |5 n& n6 u, T" @0 q7 Q}
8 l' k+ d+ D% |2 |; H" S( ^' [document.write('</td></table>')' G5 d5 C7 l# h9 w: K- @7 _
}
9 M1 W; Y3 b; f8 V# |}4 h" M% v0 x/ n4 P, \& o1 z3 w
</script> |
|