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

|
网页之跑马灯文字特效
//修改宽度' c8 _0 X) ]4 A- w
var marqueewidth=300
% z2 ^; g6 d2 V" i9 p0 P//高度
; F" d& t1 C! @. v( hvar marqueeheight=250 F6 n- t. ? k* h
//速度(1-10)
/ [. |3 k+ h$ \6 u& P' Zvar marqueespeed=3
, Y1 n8 i B: h6 s( }) w) y) ?1 v7 P//背景颜色
1 w3 a h4 b1 ] Pvar marqueebgcolor="#FFFFFF"
7 k2 J% b: n' _( j7 x//是否能暂停 (0=no. 1=yes)?
- r, Y3 s" Z& [1 R" a% Q7 w/ w9 _var pauseit=1% o& [3 g: c6 X' p( u! p. _
( Y8 V5 L3 P1 V) Z
//修改显示内容
" J8 X$ x+ ?. X/ dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 M! p" E5 I) m! G. {+ l) B
q+ v X6 X, _
+ v" s" X# g r; Y////下面不需改变////////////* ?5 a+ Q. _6 W* w) V
5 J, a0 y9 H' k: x* B; M
var copyspeed=marqueespeed7 I* Y% e$ p U/ }& m* N1 d, T4 a
var pausespeed=(pauseit==0)? copyspeed: 01 u# _8 R5 W" v% b1 Z. j
var iedom=document.all||document.getElementById
/ Q1 e8 P }5 `+ N# H wif (iedom)
# T" n8 q4 m6 {( |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ \6 [$ T. D1 D. c- \7 s; u
var actualwidth=''
; o' B) Z6 H# G, N3 jvar cross_marquee, ns_marquee
! C' q5 W' p0 y# B5 e# B! d. } X$ k2 i, T+ c% F3 t
function populate(){
; J2 K+ L) c. N! Xif (iedom){1 v, l9 F5 z: k. {/ P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% x' n: K8 S; g5 P0 n( R6 s6 h) t1 ycross_marquee.style.left=marqueewidth+8* Q9 p3 p& p- r4 g( K. `
cross_marquee.innerHTML=marqueecontent
$ K/ O; _( Z! a8 g+ ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) T9 k, i( | w% Y( b, j}
7 A' k# L. I5 c) T# y: }else if (document.layers){9 O( Z( X. s( B% @4 i* L. F
ns_marquee=document.ns_marquee.document.ns_marquee2- z# q3 A) I. G9 [& P
ns_marquee.left=marqueewidth+8
1 R9 e1 S/ U/ r7 K$ D$ ]8 `) S8 Lns_marquee.document.write(marqueecontent)8 B; Y% G+ o$ y3 @) ^ Y
ns_marquee.document.close()
" Q8 @7 ^8 z& |7 @/ u# B& ?actualwidth=ns_marquee.document.width
5 u! F' s) F, [4 f+ ?}
4 M3 U# U. u, ulefttime=setInterval("scrollmarquee()",20)
! Z7 [& e$ `4 @: t}
6 P) D. \2 [8 nwindow.onload=populate
4 N4 {8 \; i9 w9 A, M8 H" C
. D6 R* U. U: k8 afunction scrollmarquee(){
+ B9 N" z: D2 O0 yif (iedom){
7 `8 m6 E. h$ h: vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 \! e2 O4 g* _$ b M9 X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( o% ^: o6 K* }( x" zelse
9 w s& x- j' q9 Ncross_marquee.style.left=marqueewidth+8- N0 R% z; }: O) c* M# k" F
, z9 x) H+ q0 h. `+ x
}
5 u( u6 {( c# y+ W: m n1 Uelse if (document.layers){% ^7 d" g! ]8 _4 Z4 I& b) ~# C3 }
if (ns_marquee.left>(actualwidth*(-1)+8))
h' p) {/ P% l3 R" L6 G: @) Q0 Ens_marquee.left-=copyspeed$ I/ a: I, R7 H3 E1 v9 o
else
8 s+ a& x+ b0 jns_marquee.left=marqueewidth+8
8 W/ C' P- K j6 X# o}. t, o! m/ v. k
}
/ S2 F1 M; G/ s4 v( A! G3 ^" Z1 v9 {, C9 }
if (iedom||document.layers){
1 A* N/ B4 z- t4 q4 Y1 H6 E8 d7 jwith (document){
; L* [9 ^. C Z' ^1 C! sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 a: t5 b5 G7 N- h ~% f- b9 E
if (iedom){
( I8 N; u; O( \% f6 Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 }7 h- Q/ o: Q3 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- S! n/ T- j" k) }/ _' K. F7 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* l7 s6 M! U; P, c8 F n" s1 Jwrite('</div>')& p e3 W; @! } V$ P- ~
}4 [& [8 S5 q7 Q9 I9 U1 l$ J
else if (document.layers){3 X, `" Y1 E. M$ r0 G1 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), q* \/ q, @+ y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: @1 c, Z, g6 ^" h+ J& Cwrite('</ilayer>')! Q4 K4 \$ L6 J w6 W# E. U
}% K) K& m( I4 Y3 {+ _; l
document.write('</td></table>')/ ]7 @1 Y6 P6 s" M& A% w
}
1 I5 U8 S0 [8 B7 ^}
7 m: K" l9 c' U" j6 I' Z% f</script> |
|