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

|
网页之跑马灯文字特效
//修改宽度
+ ^: a" o9 u# [1 evar marqueewidth=300
% o" \) V$ J0 y//高度) [1 r5 u( V) i4 Y1 Z1 l" W; |
var marqueeheight=25
8 }; H1 e* B3 v* D. c) m$ K! i//速度(1-10)
& o* q: M: G7 {- |! @+ p4 K% wvar marqueespeed=3
# B3 [3 t* ?- f q//背景颜色
/ Q8 z, q9 G ^8 t/ m4 W) {* dvar marqueebgcolor="#FFFFFF"2 W. _+ F, x! V* @9 M7 x7 H) ~
//是否能暂停 (0=no. 1=yes)?
4 J0 A/ i" t) N. |7 @/ l. k6 {var pauseit=1
, H/ Z( y( t' y$ I8 c9 k7 A9 V4 [. R* }) Y
//修改显示内容! v5 Z h' e/ `, ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ c; Q- v" E0 `: G, T9 @ E! J( j, o7 O. q* v u/ \
+ [; q) i8 K/ ~
////下面不需改变////////////
$ B' A+ B: v4 H ~( {" y6 @
5 V+ T& Y" E, w. I# B- u6 G7 }" a) ivar copyspeed=marqueespeed5 ~2 E6 M0 k; ^4 r' M
var pausespeed=(pauseit==0)? copyspeed: 02 k. _6 I( _* { s% h+ J
var iedom=document.all||document.getElementById6 B! [7 u% r# @+ ^- m' R1 w' O
if (iedom)
6 u% a) v9 I" @- L' |' Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) s T8 X; B j7 Mvar actualwidth='', c$ P( h0 @& {; }6 q
var cross_marquee, ns_marquee, ^" _7 x+ B& q5 J
+ d' e( `9 a( @5 f# Y& O" W
function populate(){
4 @$ d: I, G9 V I' n3 ]5 \if (iedom){
: ]# t! P- T1 x' Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 B) @+ U' O% m1 P/ @4 Ocross_marquee.style.left=marqueewidth+8/ C. Z' y& Q, j" Y
cross_marquee.innerHTML=marqueecontent
7 w0 v+ t9 G* ^: K/ ~) o5 w( Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: ^+ e/ p6 G% W# L/ A
}' C z, h( L( F/ K! ~! U
else if (document.layers){" {; J2 I$ K9 ~
ns_marquee=document.ns_marquee.document.ns_marquee2- o4 I4 h2 ~; u7 c- \0 \
ns_marquee.left=marqueewidth+8
- Q# x; e1 f5 u9 hns_marquee.document.write(marqueecontent)( ?* Z; ~* R8 j& \- b
ns_marquee.document.close()+ X: i1 p/ ~* Q; E0 K+ M3 [
actualwidth=ns_marquee.document.width7 g: d3 O7 _ i' W
}
: M) E( F0 z2 J! O( }lefttime=setInterval("scrollmarquee()",20)
' w5 A' D) N" y- i# k}
( |; D0 D3 u- c" W4 ?7 \window.onload=populate
( s1 q9 H/ [% [- M
3 W6 f( \) t' u7 pfunction scrollmarquee(){
4 f+ H6 H0 C h, H' xif (iedom){% }0 Z9 E, S$ S* r/ d6 A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* L& X: H9 v- D1 f3 t" O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 D! u+ S- l4 E8 o1 F6 `7 Celse; t6 b/ [3 c# F- p
cross_marquee.style.left=marqueewidth+8 W5 j- E6 ?% n5 W
3 C' j' b4 f5 ]/ b
}+ E. _' m0 I" b4 M
else if (document.layers){6 Q- v$ _! x g3 x
if (ns_marquee.left>(actualwidth*(-1)+8))
, n: P+ ^3 o! I( bns_marquee.left-=copyspeed
- }' o& i( v3 y1 }8 Celse; N# [* n9 U( A: w+ b4 \* V
ns_marquee.left=marqueewidth+8
2 }. e' F( y8 |5 P W* f) a}( {# P" f6 n4 H! ^3 t! h. @
}7 S, m2 a! W1 [' ]$ H& r
4 E/ n( M/ J/ l) kif (iedom||document.layers){
9 A" ~& d) `5 _1 ?0 L* Mwith (document){
6 L" S2 d: U+ r. Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& R) ~ F2 {: R0 c
if (iedom){
; x( e; f% N a# K( h) \8 ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' P! [. y6 s* K( Y2 H% c, Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ ^& P! d% b! R- _9 \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 N" C0 S) _; r v: G2 V# l* F. K8 |
write('</div>')
) l7 s1 w5 w& h) n" R0 }1 @% M! [6 [}
# V! V- f% h+ W8 `) u# uelse if (document.layers){
+ v5 O, V9 t: m- t$ E% Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& C" Z. [( t' o1 o6 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') X" i3 ? l. u# G O
write('</ilayer>')
, [) B5 Y: K, ^& D+ D5 n}& u4 t! V) S: D
document.write('</td></table>')
- f l7 ?* ?( J" X7 ?& ?7 @3 T! @) g}
5 e- _* ^" y3 ^; U% o' K}; G6 F9 d: I8 e3 D- \; N
</script> |
|