返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 Y0 Z# p  w3 _' Nvar marqueewidth=3000 l0 o' X$ {; K; e$ }( _4 a: }4 n7 F, V
//高度% Y8 W: V2 L* E0 M# Y
var marqueeheight=25+ N3 |6 s% n( d; m6 E
//速度(1-10)
1 W6 ^5 x3 ^2 y& a* G( @var marqueespeed=3
. x$ S% x6 l; {//背景颜色
, J* \. f" T" Lvar marqueebgcolor="#FFFFFF"
' N3 f3 |; R* T3 n//是否能暂停 (0=no. 1=yes)?& O& P* p% s) C: V
var pauseit=17 z" t4 Y- h  _  p1 q) q

0 u8 Y7 l+ y5 u5 p//修改显示内容
; D; X& E% T0 R7 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; d3 m6 }- A5 I: z8 u# i1 g9 J

" x) k; ?) u3 m6 _. _: H7 ^1 g; N7 g# N0 d: ~2 P0 I
////下面不需改变////////////
8 E  F9 l, I* P: r3 f0 A  R+ F* C  P/ Z
+ P5 O6 H# ^" Q/ y8 Dvar copyspeed=marqueespeed6 W6 |; D/ a2 [2 c! k+ X8 `
var pausespeed=(pauseit==0)? copyspeed: 0
7 O8 ~9 Z, ]2 ?; P: `2 c. I0 C0 w; Jvar iedom=document.all||document.getElementById
+ V( k2 |/ {/ s9 L7 H+ X6 l  qif (iedom)
6 Y1 s& H- C8 \! ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% D0 Z- j; a" W4 T- t+ f
var actualwidth=''% c7 G' N. t1 Q+ t' Z, s
var cross_marquee, ns_marquee. r9 X0 o+ f; ~& H. M0 }

" ]' R+ J4 M- a' M) L0 J8 Dfunction populate(){
, S2 d  Y% Y( z9 Q2 Dif (iedom){
8 l: Z/ Z, t7 q4 l: m9 B3 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( p0 d, R+ w/ P7 [: g* D
cross_marquee.style.left=marqueewidth+8
6 l" E  ]9 h, q  F" G$ J! k2 }cross_marquee.innerHTML=marqueecontent' Q8 p0 d" [' j- F) `$ b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ Z+ V* G5 f. x% [9 [6 m. U$ k}
( S+ G( h5 z/ P3 j0 A/ zelse if (document.layers){2 q+ o+ Q# q2 l, R  p, E
ns_marquee=document.ns_marquee.document.ns_marquee2
* R9 S& W: ~" Z7 ~3 z2 [ns_marquee.left=marqueewidth+8& s3 ~. M4 T$ B( h' i) \& ]  [% e- A
ns_marquee.document.write(marqueecontent)3 x6 V/ u8 J1 V8 a. \4 S6 }1 C( ~9 z
ns_marquee.document.close()
0 P& Z) r" Q: x0 E+ l$ uactualwidth=ns_marquee.document.width' v- j* t: R; E7 d* g8 I
}/ c8 s9 z3 U' G" s
lefttime=setInterval("scrollmarquee()",20)
' y6 j& i9 s& x9 P6 s: K  V  P6 C}
  I4 i( d7 \9 B" W) A1 j; E9 R+ o- }8 Owindow.onload=populate
# e' f# C0 t& }- ^3 i- l. H" e/ u! T5 ]* n. V' }/ v+ G
function scrollmarquee(){
- _0 G* f- n! G" u1 O3 R$ _8 ]if (iedom){
3 r' _/ B+ f) `8 W. Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ L1 I3 X% V3 @" J) c/ Q, Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ m7 k- R. X8 [' P
else- \: n& ^8 ^: J; |) q( L4 i
cross_marquee.style.left=marqueewidth+88 p* l* H& P; l! G

, ]/ ]* S( p# X$ F}
, V* Q# ~3 {7 }' s! Z: v) welse if (document.layers){1 o- y! h9 j5 J1 }! A4 W) h
if (ns_marquee.left>(actualwidth*(-1)+8))
& X; j' ?% r$ y& E! l. Qns_marquee.left-=copyspeed0 p, V& I  c- A; G% K# n% F9 S" e
else
- n# s9 A& f: P* E" d) Pns_marquee.left=marqueewidth+8
1 {6 r2 `# h* a/ \, B5 R}6 g. ]) l% W  ?- {
}
3 |, K* L# a' o5 \( L: ~
+ K; d% m1 {, wif (iedom||document.layers){, L5 [5 {4 U' d. v1 O& {2 ?; x
with (document){- L3 J  r, l6 r+ A; S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. h3 O/ [& s) h% d3 Gif (iedom){
- [2 |# B7 F$ Z0 Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ z# h$ `# s) S0 @6 ~% cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% R+ b/ z4 Y9 o4 g& ]1 i$ W/ |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' G0 j+ g1 v- _, b+ j( K
write('</div>')
" Z- F: ^4 v& Z2 t}8 F- i' O) J) k0 y
else if (document.layers){' J( }+ ]4 b" A* S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 Q1 a! W! [( g; E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' p1 V1 f/ c5 ^
write('</ilayer>'). W& i9 e6 h4 F
}+ v. j. E/ f2 \4 I% V" U
document.write('</td></table>')( Y3 y/ C. T( C4 e3 ?* e, k
}
; `$ y* c0 B' t0 L) d1 B}
/ {9 F! M, Y; F" N1 \</script>

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