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

|
网页之跑马灯文字特效
//修改宽度, E9 ^7 Y- u! A6 Z! l
var marqueewidth=300" R, C& e/ N2 h/ T2 U
//高度- k- W) H. a4 D# b- G( l$ f
var marqueeheight=25% I- D4 ?' y4 W2 f) o. C
//速度(1-10)
) \: b' A) V: d7 @. J, Z/ [var marqueespeed=3* K* z0 G/ Y3 _- p- E/ U
//背景颜色1 L7 F! ~" p. V! P& [/ e3 b' }
var marqueebgcolor="#FFFFFF"* g- [% \1 R3 b
//是否能暂停 (0=no. 1=yes)?
, [6 k: V" Z/ Z1 h9 m# M3 v( nvar pauseit=1+ _) F& z7 j" D ]1 m
1 j( u0 k; V/ J8 C/ }//修改显示内容
- H. e4 w) v* {% U0 q9 Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' N9 R$ M+ { t2 Y
* k0 y$ ~, M% J3 R* ?2 d& w
- b9 Q9 { ?2 B" |( I////下面不需改变//////////// h. u( f# v/ X, W' e
) |6 V) Z5 D( s) G, F8 h8 t* O& Dvar copyspeed=marqueespeed
0 @, C3 t& ~9 l& ~/ J- C8 ~5 Qvar pausespeed=(pauseit==0)? copyspeed: 0% u$ Z6 L: V; \8 q4 Y6 N% w
var iedom=document.all||document.getElementById& _1 c3 D, S8 Y% N) g6 Y& Q. C+ G
if (iedom)
# e2 S* V: L+ Z% i* a9 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, j9 I( D# ]9 Avar actualwidth=''
; R8 D9 y0 V8 x ^) v: rvar cross_marquee, ns_marquee
: O7 u+ ?/ d4 O+ [! `4 S4 R T
/ F) v1 d# C' N+ L6 tfunction populate(){
: F" ?+ N) {$ G. e& ~( _* E! yif (iedom){, P+ I9 q5 U9 w \0 T3 _6 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! p7 K+ @5 r! ]) e2 I
cross_marquee.style.left=marqueewidth+81 A* O3 c3 w8 T
cross_marquee.innerHTML=marqueecontent, R* T; D: k! v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( l) u% z+ g$ p! p, m
}
0 p6 B4 p Q: S$ d% Q, ~! Pelse if (document.layers){ T3 m+ Z! ^: n$ J
ns_marquee=document.ns_marquee.document.ns_marquee2
2 C3 Z* ?( ]* qns_marquee.left=marqueewidth+8
$ Q1 p/ @* j8 q4 ~' X8 p/ \ns_marquee.document.write(marqueecontent)$ M5 u. O: g% A6 _) v% K6 u# Q7 ~
ns_marquee.document.close()0 b. j- N' Z4 Y5 Y7 K1 u/ w
actualwidth=ns_marquee.document.width
9 Q: P: y( K+ A0 K8 T' Z5 e}
6 A9 C7 B# x" `- s' ~4 W! L+ Ylefttime=setInterval("scrollmarquee()",20)2 c) y! a9 o3 u6 s' k- ?! l& E
}
; ^3 a2 s2 K% F9 d! Q' Mwindow.onload=populate$ }& _, T+ {! R8 O& ?
. X5 x$ G( @2 K( z6 J1 c' Bfunction scrollmarquee(){- p+ ~2 M: z" {) o( O0 v1 O2 x- Y
if (iedom){
/ x- R' T- g1 p2 H4 l) w4 C9 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ J# k5 y( ^5 F$ Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% F6 r* N$ v# m5 M, n9 S$ t ^else
4 r l3 P3 G+ Q' ~ m- `3 ucross_marquee.style.left=marqueewidth+80 Y( ]2 m" r- N; s( O, N* n
8 J4 M M5 |; O0 e}
, ~6 E1 p6 L# z, g' Helse if (document.layers){7 c. J! R" J( y0 m( W
if (ns_marquee.left>(actualwidth*(-1)+8))
( `* x% L r$ c3 d- ?ns_marquee.left-=copyspeed/ [# r2 } u9 I" D
else
2 E# {* ?1 V- n, ?1 C3 p: Bns_marquee.left=marqueewidth+88 ?6 \$ }% s" K' C5 T
}
& E) ~+ D: Y2 p3 r7 S2 j$ ?7 v}4 N8 x+ n" _% c0 E& K9 r/ n
! _3 q+ u; y; ~4 J* h
if (iedom||document.layers){
|# X- t" p4 u; b( qwith (document){
7 H r; y( y: e2 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! c0 @% M" K5 N5 Z2 X( W
if (iedom){
, y# c! w% g4 p3 J& Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), e- D" G0 `* K1 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 K7 t4 ?! M8 C( R! U: x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; u) ~; r% u* Q% ]+ {* R/ jwrite('</div>')
& V7 R% ?7 K# l. t! n* H}- J0 n* c. r& q, ?3 g
else if (document.layers){
) N3 f+ S: `5 c% _* K) owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) |/ Q+ a1 K& {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% ~4 `) V. M5 s/ R6 M1 m( q
write('</ilayer>')
2 W* R+ e9 T$ Z, Q" K& |}
0 E8 [' [2 J% M6 M3 ndocument.write('</td></table>')
8 z& G0 J. d+ w. S: U S- a}; S; D% O1 T; f/ w& A9 s0 H0 P6 T) |
}8 l/ F; X9 v8 _% m9 t9 @' J |
</script> |
|