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

|
网页之跑马灯文字特效
//修改宽度
. s' h! \9 D/ @+ X1 B2 ivar marqueewidth=3000 U; V. U. N! m6 Z, E
//高度& f4 q" q/ `4 X; n% C
var marqueeheight=25; {! b' u* I, d, m: d
//速度(1-10), B) |1 M# D1 ~3 W: z
var marqueespeed=3
5 Y& t# a6 p1 k( v//背景颜色. {, |3 g% I- w- ? |
var marqueebgcolor="#FFFFFF"# T @. [$ D' @" W
//是否能暂停 (0=no. 1=yes)?
$ H f4 P/ N# G! k" Z: ~6 xvar pauseit=1. D/ w8 \" x7 t2 z) s2 d4 h
$ F7 C- k; b6 f1 @
//修改显示内容
! q7 C# T) g# xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 t/ x3 h7 B6 H0 Q7 }' E
9 D! W+ s+ [( K/ v+ ]; r$ P! ?3 B/ M9 h2 B, O m
////下面不需改变///////////// ]" \; k& |2 R6 D% ]+ i
+ u: G" W: [& m( ~& g- y- ]4 _var copyspeed=marqueespeed
8 r. `$ f7 c) N; v5 V1 S) A1 r2 svar pausespeed=(pauseit==0)? copyspeed: 0) Y. g) n3 a _
var iedom=document.all||document.getElementById$ i; u4 _& K6 e, b1 P( M
if (iedom)9 c, R5 Q/ F1 ?0 |) t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), c' Q+ u9 L( `; _6 G4 l
var actualwidth=''& b( i4 p D- X! W' {2 @) P. X
var cross_marquee, ns_marquee3 j* ^5 q& G9 l* p) q
I1 c) R/ H4 G$ K f1 e& i5 \- Jfunction populate(){$ h' B2 R0 D ~& ?0 e
if (iedom){' I- @ o7 B- H! v& B! M8 P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 Z8 x3 v& l! q$ E
cross_marquee.style.left=marqueewidth+8
. `+ u* q/ b& e+ E) F6 {) gcross_marquee.innerHTML=marqueecontent
' c1 }) l$ C' dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: [- H1 i5 I: p9 B9 |# ^# W+ Y; ^; M}
* g3 \* h- F! `. I( t4 g: Kelse if (document.layers){# Y( R3 [) S* y0 e$ d
ns_marquee=document.ns_marquee.document.ns_marquee2
5 T- Y' N; V, Q# G, Vns_marquee.left=marqueewidth+8: e8 c9 W+ I* Z" Q
ns_marquee.document.write(marqueecontent)
* J5 O9 o" x; t1 b; pns_marquee.document.close()
' U5 l2 f5 _0 `, ?+ F6 tactualwidth=ns_marquee.document.width
/ @1 z6 y1 m/ |0 o7 O}
+ t9 q' ^, F% q4 J4 ^4 Q% }/ Xlefttime=setInterval("scrollmarquee()",20)
1 P8 P4 |+ O2 \}
4 K! ^2 m' N5 d7 R% W [0 k4 pwindow.onload=populate& q6 P3 |$ d' q. X6 ~0 ^# M8 Y
2 h% Q% A2 p9 `5 z. S4 G
function scrollmarquee(){
* p% {* h2 b, e) T& ]; M) R9 yif (iedom){% x; y6 m# M+ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' e" W$ @* Z% F8 Z. v* u6 k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( `5 ]4 Q: g2 U# N( B0 v0 A" kelse
& v6 | }& e% H" v6 _cross_marquee.style.left=marqueewidth+8: E( ?3 K) B4 y) Q: R' i, b
\$ a ~# s8 y}" u8 L' ^" k' P+ s8 w
else if (document.layers){
' k# u+ I4 b% c+ t: k0 O* O' X8 Zif (ns_marquee.left>(actualwidth*(-1)+8))
; i- {: K) J$ p( b) X+ G3 o6 uns_marquee.left-=copyspeed5 O" P3 i( _8 @: q
else# H1 s& l7 J# B, M# O( `3 Z) V9 @
ns_marquee.left=marqueewidth+8+ Y3 y* p- e' ?2 b3 a# b; ?* j
}
7 ~ G% y% l% e, K+ a; a: J6 s5 Z}4 a. n* O+ t4 I
2 K3 @$ L% K$ Z" m% D Cif (iedom||document.layers){% Z) p2 z2 S A) a+ J) s; C) Y- s
with (document){9 m: C8 g x7 c9 x/ a, _1 q& v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); t* j+ x- k( Q+ v/ k- e/ [9 s
if (iedom){
9 d1 ]* t4 P$ w1 W, Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! w. v6 U1 L' E `+ n1 |% W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 Q( s: L& h$ {) S- h6 ~. Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 g* m8 l- H; r0 t. r* Xwrite('</div>')1 A: v M: P. c! Y2 R1 b* J
}
0 Q& ^: B4 F7 q& felse if (document.layers){
+ j ~3 R1 H3 o% @$ o( ]# D# Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: M5 k# a. h5 ]. i( H& Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ W4 {4 M6 s# a5 V0 E- p8 z( O; D
write('</ilayer>')
8 D8 w" b4 E8 m, N; q' } y8 v}: J* Q0 I3 ~8 ?) u! b
document.write('</td></table>')+ y( b. f2 p5 u: k
}& l' i* f# p$ k. F; ]9 c! p
}5 p- F; Y) i% V
</script> |
|