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

|
网页之跑马灯文字特效
//修改宽度
6 H' v) Z* [, v1 s4 ]var marqueewidth=300' ~2 h6 Y) \) f }; B
//高度# C0 ~! Q ~2 S
var marqueeheight=25' a( ^3 `' C( I' ?) \, F; G) B; e
//速度(1-10)
m. {8 x# y2 a, M( ivar marqueespeed=3- ]& t/ V" Z) F7 }; n
//背景颜色; q f* m; D' m r P& s
var marqueebgcolor="#FFFFFF"
: R- C8 g% t- `//是否能暂停 (0=no. 1=yes)?
# p6 e# z" j# H0 {6 f2 f: [( w. tvar pauseit=1
9 I% N. J) r# B% z5 s ?$ t, m5 Y" l
//修改显示内容
( y+ s/ S. A" g" c/ D# [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' q/ T& K; o: {- Z) m9 V
7 p" @' b6 h: e- S& X
1 @8 C, }& l% l T/ }3 s( |////下面不需改变////////////" T* _) a* S! y% z) Y3 s8 @6 }& v0 C y
8 Z1 ?9 k* ?' o
var copyspeed=marqueespeed
[; A9 x# C9 _+ v$ F6 Cvar pausespeed=(pauseit==0)? copyspeed: 04 r0 K `4 L: p/ d- I* ^" x
var iedom=document.all||document.getElementById' j" e R! ?; |$ R( z5 C) E
if (iedom)) }2 `8 ~9 V* g. ^! b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). f+ u, ]; o; u2 Y0 g
var actualwidth=''
- c, `+ c# \6 y+ f" s7 {8 R+ Yvar cross_marquee, ns_marquee& W# f% V G) E
% @$ i' g+ N4 s/ Q: x3 L% D2 I2 \function populate(){
8 z! W7 Q5 `7 |6 ]' Dif (iedom){2 H+ }. h7 r) A+ e, r: i1 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ d* T$ b- x. ]
cross_marquee.style.left=marqueewidth+8 g; z5 D( X# p6 v+ D
cross_marquee.innerHTML=marqueecontent
) `5 C, I! J2 s1 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 i* M2 R2 U* k7 b ~ f' @
}
+ m+ V9 I F% i- J( o8 Pelse if (document.layers){
7 e: A% d! x1 T+ J1 [" V/ uns_marquee=document.ns_marquee.document.ns_marquee2' U, Q2 i' q0 ~' N# [4 C5 l
ns_marquee.left=marqueewidth+8
- R9 B4 M% V) \ns_marquee.document.write(marqueecontent)
) ^- c7 S0 k2 y! E. b1 tns_marquee.document.close()
9 z' [/ [ ]2 r* P. ~actualwidth=ns_marquee.document.width
8 N/ M' Z2 v/ t0 S: T8 @! B5 m}0 r5 N v$ z. R) Q4 r1 V& {
lefttime=setInterval("scrollmarquee()",20)
$ k/ a G' O2 r6 [. S6 r}' {5 i% w3 P& x. @# y% a
window.onload=populate
- a0 b6 ]& ?. s+ |% j9 ]. s( q2 j$ `
function scrollmarquee(){
6 ~0 G+ z5 f% l9 F9 W. ^8 _* \if (iedom){7 A: ?/ W9 [& n+ A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). W' j+ i# t' P' }% M9 P0 x3 e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 v# k/ {3 j9 `# m8 ~else
" t+ t. ?/ |9 o$ w3 v' vcross_marquee.style.left=marqueewidth+8( U( z, B* H. D; F
. p7 I* U& N6 i) E; U! ]
}
, X7 A5 N6 P( ~else if (document.layers){
1 j( v0 L& g8 t5 _' U: Pif (ns_marquee.left>(actualwidth*(-1)+8))
9 i- [, \% X; zns_marquee.left-=copyspeed
. R. k" f+ O) n) `2 `+ o# W& S- _9 melse6 B$ ~5 O# T* k7 r
ns_marquee.left=marqueewidth+8
; Y6 q7 o6 m: z0 `# ]& I}
. P; X3 G/ w% _9 k: U$ l7 p}
2 I5 ^0 P. Y) _ ]9 L8 u% p
5 r: S0 h. z( [2 M# M) Tif (iedom||document.layers){
/ ~! m. Q" P6 o) x L7 Rwith (document){
: V) E, ?3 Z( P7 J6 C, edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) n! V' m$ J6 {6 y) Y! b! G& dif (iedom){
) w7 L, {. ? _3 W- j3 H$ owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! n3 ^9 o& V) v9 q9 T: M1 g6 f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 K0 R5 K3 |* i$ Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& K9 l% K5 E/ \2 o* ?; gwrite('</div>')
& r* d. M: X) @$ U}
! O$ V( o' r" ^) n$ [/ xelse if (document.layers){
( f4 d/ E! M/ X, E1 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 `3 ~6 U: T1 Z7 l7 d$ [0 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" E4 q; W1 R* S; ]8 Qwrite('</ilayer>')$ Q7 V- N8 k) Y* w* D2 d
}0 O1 _$ e- r2 r# X) ?6 I5 E
document.write('</td></table>')
9 X( P2 u- S% k- K3 ~# W}: {$ D/ z z5 q# U. l0 f" |& [
}
5 ]! L1 D. x2 k4 w</script> |
|