返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 N  M6 Y& L( T6 M  p) q) D- L
var marqueewidth=300% l& e2 u6 E( l+ V  n
//高度
0 c7 U! s2 h) m; J  S: j, ^. fvar marqueeheight=25
3 X& z) N9 d+ o/ V- }3 D//速度(1-10)
9 |0 o5 b: o% r& kvar marqueespeed=3
5 y, H4 r; x- V2 n//背景颜色$ y6 _  o5 {( E! Q( T- m: L  N
var marqueebgcolor="#FFFFFF"" E& c8 G" [- \- N9 M
//是否能暂停 (0=no. 1=yes)?
6 y' y5 K. ~$ P4 ^/ X/ d5 ovar pauseit=1
' G/ e% T+ o' l
  ?7 t' M9 _* l9 ]//修改显示内容
% d3 M5 z' Q9 E6 o0 v4 \+ jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', }7 w: f% g" o' }7 E" f. U

8 U! y# I, \4 Y, t- o& G/ m& i; O+ D) y$ U( r' [9 U
////下面不需改变////////////8 @0 e5 _2 D0 A5 ^( W* [

$ E" F; Y& t6 A2 }: dvar copyspeed=marqueespeed3 J( f4 d/ b/ ^- s2 I
var pausespeed=(pauseit==0)? copyspeed: 0
! a: o' y" K; \0 a$ Yvar iedom=document.all||document.getElementById
. c/ \( u' ^( ]( g" pif (iedom)6 d1 w( }/ h2 N8 g( z4 f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ m; K$ F6 A9 t0 p4 V. {7 Ivar actualwidth=''
/ ]0 D7 S, e$ Q- I% h. ?var cross_marquee, ns_marquee
' w5 P% L9 r, Q+ _  H' `; u$ r! t  @  {0 `$ [/ {( t! J- e) O
function populate(){6 D1 u$ }  K: q
if (iedom){4 H# x& K/ m5 x1 B7 Z* N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# D( r2 y, _* Y' H) wcross_marquee.style.left=marqueewidth+8& T- v/ h' R! l. b
cross_marquee.innerHTML=marqueecontent
. q0 P+ p9 C' V9 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 a2 N8 w! F2 T9 s}9 c) c  Y2 P$ H  r  _/ n" d8 Y
else if (document.layers){& ?+ k2 A2 [% z5 H0 e/ A/ ]
ns_marquee=document.ns_marquee.document.ns_marquee2
$ B! U$ n2 _  ~/ ~7 E3 _  K4 ^$ t1 kns_marquee.left=marqueewidth+8. D5 {+ d- \, U) I, v
ns_marquee.document.write(marqueecontent)& _% S: `5 j7 D) `
ns_marquee.document.close()( z* T5 j3 S1 V5 P% H- [! N/ |. Y
actualwidth=ns_marquee.document.width
  d: j, z  P6 p' m: n, G" _. R}, y$ B1 F) q! ]& d2 O$ q7 Q. H
lefttime=setInterval("scrollmarquee()",20)% l8 ?2 @+ x3 W% U( U0 C7 O/ F
}0 i* ]; b8 R' T/ p  A
window.onload=populate# K7 T2 l+ V+ J7 k% U2 [& p" L

2 f" Z/ j) |4 T4 g! t0 ~. N; Hfunction scrollmarquee(){
5 @) w+ f' Q. G) ~3 k$ P1 Wif (iedom){: |* N/ o) q- ^* R8 S+ N- }6 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 S) B+ M$ X. t2 h8 \$ L1 x, Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 X: J2 ^3 l: K. r: E5 aelse4 t' d1 W; _/ h# L& W& s) z
cross_marquee.style.left=marqueewidth+8- O. ^5 ~6 y& O- Z! N
- c/ B; X% X4 L& T8 Q  a
}
) Y" X# r/ i5 \else if (document.layers){
* w! o2 C4 W3 o. bif (ns_marquee.left>(actualwidth*(-1)+8))" j% a; i# ?# J
ns_marquee.left-=copyspeed
& k; u  f$ W7 V6 _  g* ]else: _7 R1 h+ v' C; t! V4 O: Y1 f
ns_marquee.left=marqueewidth+8
2 D0 f6 w0 O/ m2 [}
3 t- b- {2 l: N6 v. Z4 V( `}
6 `. W) r* ]" n7 r% m/ B% _# x. w8 h, o: K$ Z" P+ ^2 I8 G7 h! i
if (iedom||document.layers){" ~+ m$ R" S* c
with (document){
4 f7 O9 M8 v7 W! Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: h# F0 h3 B+ nif (iedom){$ g$ }# @5 [$ q* O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: ]9 Q( J7 k. Y  Q3 `8 f) xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). o/ g6 ?, {! N* a2 D5 J/ P1 h% [8 `" f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 \% ?% y8 V/ [write('</div>')9 }0 I8 c' l5 G6 L; ]5 A. p8 p
}
  k, \3 V5 d. Welse if (document.layers){" _& P+ v( r, K! Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 Z9 Y) d& ?+ x+ d- g: Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( X& G9 B: j  c4 L& F8 x: |+ `write('</ilayer>')  F0 f# H6 w4 i- w; O! A
}
9 H% f3 X8 q. h$ a/ Xdocument.write('</td></table>')0 E2 e2 J, K) H$ l- y
}- Q0 j, z1 ]2 D8 s; _) i
}$ s9 f5 c$ P$ O: [' n$ H: {* ^. n
</script>

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