返回列表 发帖

网页之跑马灯文字特效

//修改宽度: E* ]* R) U  n3 m9 N5 ^& K+ |
var marqueewidth=300
4 f1 Z' p3 X' B" v7 t, P! }3 [//高度0 f' Y) U- X, ?* Z# M2 \  K+ c
var marqueeheight=25
8 O1 q9 k" b7 V3 t# g% c7 a7 I! K  @//速度(1-10). i/ g1 q8 N8 A+ b, e! O; c3 W
var marqueespeed=38 h* T7 ~& e& U) S
//背景颜色
  T1 \& ?0 V! ~- gvar marqueebgcolor="#FFFFFF"
4 V2 y5 l: y7 B//是否能暂停 (0=no. 1=yes)?
& M$ n5 S  C/ L  U/ q" ~/ ]3 X6 tvar pauseit=11 v! _9 z8 K! a9 c  ?

* @6 r; X# G, \( m) Q5 s. Y//修改显示内容
, }( l% o0 K* H5 l: f2 c8 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 D0 A7 ]2 z' v4 L" K* F6 T+ I( Y$ Z, f3 {1 ^

* H1 ]5 \+ i+ B" x2 C////下面不需改变////////////
1 y. U. W) T7 @8 V; e5 b4 H$ K% R+ K* T% h' j. A+ n
var copyspeed=marqueespeed
+ [6 Q8 f+ e, u. [var pausespeed=(pauseit==0)? copyspeed: 0
% q9 V* [5 E+ T, g% E: a1 d; z+ Lvar iedom=document.all||document.getElementById
  E0 m5 {% f4 X9 `, f3 Pif (iedom)
2 `* s0 C, |* F8 U" x% Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- k& c' A4 U0 a9 m* |
var actualwidth=''
/ B0 R& j: s$ A3 E6 a, ^0 ^6 f8 mvar cross_marquee, ns_marquee
8 @$ O3 v6 h$ l
' l# P- e* \  W- u6 E" p2 x4 Jfunction populate(){
% s( W4 z2 W6 V! d" gif (iedom){
/ Q6 B  y0 D0 F2 M; across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- o; B2 n5 r/ j, V
cross_marquee.style.left=marqueewidth+8
) m0 P4 M& L% i; ~( }; q: [cross_marquee.innerHTML=marqueecontent% m( `* X2 Y0 F1 c1 ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ B- u9 G7 E; q& R& D6 O6 ^! K9 L}% t8 o+ a+ c2 W6 ?! G, W
else if (document.layers){, Q/ i) W' N. `5 H1 S1 r
ns_marquee=document.ns_marquee.document.ns_marquee2
8 M/ @7 z$ O1 T. a' f6 z* {% e  W3 Xns_marquee.left=marqueewidth+8
( B0 Y6 B8 Q/ ]1 S% O9 {6 ?ns_marquee.document.write(marqueecontent)+ g' l. Z8 L0 Z  Y; p6 R
ns_marquee.document.close()) C: f4 F* `5 ]# ^6 f
actualwidth=ns_marquee.document.width
- u9 N/ P# V! G3 T}; O# p5 Z0 t" Z# b. y& V
lefttime=setInterval("scrollmarquee()",20)
$ q1 d8 u, Y2 g( {1 V7 F}
% n3 b; X9 q2 H5 a; M1 D! Vwindow.onload=populate
& L; E! c6 o, U' N
& o: {7 Q! J5 z# A0 afunction scrollmarquee(){
3 b6 |# x; {# uif (iedom){
8 [6 R$ c4 i, c1 h$ Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) g/ i3 \7 G- N: D( Y1 [5 v7 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  ]% ~$ K# o! T9 q1 h- Uelse
, Q1 A4 q" C8 w1 p2 Qcross_marquee.style.left=marqueewidth+8
, v0 |; o+ a( {' {) W/ M+ I8 Z; i# V- [/ X# N, X: R: W% y
}8 f5 @' w, V% O+ v2 S5 O4 ?
else if (document.layers){
6 y' M9 Y: ^- X- ^4 Fif (ns_marquee.left>(actualwidth*(-1)+8))8 F) N# ~2 v1 @
ns_marquee.left-=copyspeed
8 R0 @+ N: P$ Z) i& g: Qelse
6 E; N) q% S5 e# F( H" t9 Z# ~0 Bns_marquee.left=marqueewidth+8& A. W) I* @9 ^% f1 o
}
3 r( X! L& @9 O3 o$ [}- s. g  e  l8 P& `* |" L9 z$ k

. b* }0 A% U% J( Zif (iedom||document.layers){/ n* C; Z( q1 H5 D+ M
with (document){
2 _$ m% Y3 o; C: K* e% Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 Z8 \2 D* A* y1 P( K
if (iedom){% ~. i3 l' z- ~& u/ k) l& f7 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). T: y9 \# R5 e4 h" l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); @- e/ A- q3 ~- N) c5 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); z3 Z: m* e( O
write('</div>')' d) i9 G; h$ [$ a
}
; }6 S0 L, p, V! R8 s8 Zelse if (document.layers){" t! Z( Q' \( v0 C* u, s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 G! @7 j: a8 H  R+ }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& T2 a7 v: B" K2 Q' R; }2 m, [write('</ilayer>')
5 E) n' Q4 a. s. o' A}
( h6 H- i  h% {, Qdocument.write('</td></table>')7 X( [+ M% D  ?1 l1 ]% O
}
- s$ y# q% q6 Y5 b( p# E}
# F7 m, f" Q+ R/ R' g</script>

返回列表
【捌玖网络】已经运行: