获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 `; q# x5 M" Pvar marqueewidth=300; ^4 O  v. K5 V! r9 P" P& s9 f
//高度% D% j: p3 e/ g+ ?5 d
var marqueeheight=25, X" _9 I! D* P0 `- k! O
//速度(1-10)( o; P4 M- _6 f  q2 F
var marqueespeed=3
0 A( [/ ^" p" E+ _//背景颜色! M: A* O& X, }9 ~
var marqueebgcolor="#FFFFFF"$ r4 S4 |' s! J" ~5 B
//是否能暂停 (0=no. 1=yes)?( S  q' e# k8 U" l' k: ~! i6 ?% `
var pauseit=1" P% c% X4 k4 @
! z0 C( H$ ]" K& ?& ~3 v
//修改显示内容
2 K, ]- c' A5 f1 hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 s+ l! P+ |( `# d3 _0 I9 g
8 J( ~$ M4 d3 U9 B( D9 A# u

& u& z6 l: m, G- @2 p, k7 K# \# |+ g////下面不需改变////////////
& s0 a4 n$ j+ f* W! d1 g, W
2 l5 q" X. w7 H7 D/ t- D2 svar copyspeed=marqueespeed5 k) p- Y1 d; D) _; w
var pausespeed=(pauseit==0)? copyspeed: 05 \& B9 D% I; B) I4 t
var iedom=document.all||document.getElementById
+ X( W; m- l1 m$ B: L$ K) Cif (iedom)
; T! H( ^; [) z5 u. G3 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, a$ h7 ~5 R2 `! i: `; J2 qvar actualwidth=''
7 h; z& I% V+ w; k* Hvar cross_marquee, ns_marquee1 l, J4 F8 e, P8 u% F: D( L) q
9 x9 a8 u7 t* I
function populate(){
2 i3 v3 v9 Q- w) }% w% y# ~6 Eif (iedom){; s8 I3 g+ A( M% W8 z# h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ w) D" G; a6 _& f* P. b! x2 s( }cross_marquee.style.left=marqueewidth+8
7 |% T* {& }8 a7 x: f0 B# Z" g3 rcross_marquee.innerHTML=marqueecontent  A4 O8 y! ~+ ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 L! a/ }) u3 `( T9 o, p}6 |9 |4 Q; W% H+ D0 [7 Y/ `) A
else if (document.layers){
, S$ N" l, B7 c- W" e& Q& pns_marquee=document.ns_marquee.document.ns_marquee2
$ P1 O2 [' r% w1 o. Z! L+ Qns_marquee.left=marqueewidth+8
: |+ g$ Y9 W+ x7 j$ Dns_marquee.document.write(marqueecontent)  Q) v( Q5 Y( s* Q3 T( f
ns_marquee.document.close()+ s- M, ?$ }! c% A( f/ t4 P
actualwidth=ns_marquee.document.width2 X; {6 U+ M( j% X" t& o7 J
}7 g/ \- Y/ A. v2 l4 S" Q
lefttime=setInterval("scrollmarquee()",20)
: t: G/ c' }. ?8 j5 H}& v* E5 _# T- ~
window.onload=populate) H% E) n3 i& `* s. H5 ^0 P
# V6 c8 o3 Q6 ~# z: E
function scrollmarquee(){
9 Y- I9 s' k8 l9 V% `+ d4 T( oif (iedom){
+ x( z+ ]% j# Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) A; j& E! Z0 Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: r. Z" \* `* ~  ]& delse
4 R' G  c- i: ?. Ncross_marquee.style.left=marqueewidth+89 z+ T# V: J, g3 C3 Q- _
& _1 b) w& p1 L; W! T6 R
}6 M( K) f8 K/ ~/ o; N" e+ s
else if (document.layers){- S6 T4 ]& h$ @1 N& }& T$ L
if (ns_marquee.left>(actualwidth*(-1)+8))3 R6 l9 t" i8 I) t9 ^
ns_marquee.left-=copyspeed
5 n- b# u, \0 `else+ |' n( l; ?6 U8 t/ ?
ns_marquee.left=marqueewidth+8
; o$ v9 y7 J8 O! E}
8 ~# H9 _+ V6 p; a}" p+ w  h2 C& M% o
+ s2 [# r0 ~. L$ m5 \+ ]% i) u
if (iedom||document.layers){
8 \7 c2 e) z- h. twith (document){. \) b" T7 w6 K' B5 [7 A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, q1 U3 f' K7 d3 ~if (iedom){
9 X1 z2 J3 v  c! S: hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# S3 A: q* I: a1 J! v" N' O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 |4 z% s& m$ G& A5 a, f* `9 Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), B$ ~7 O9 J+ L+ c) }
write('</div>')
) |6 y6 M7 D" D# A: O' ~9 b; ^& k( j}
( \, T! K2 }4 M" I1 |" T& r  Lelse if (document.layers){6 F8 H, O. C, M: y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); }- d  t5 M8 [! n4 I- T6 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 [/ R& v' L. A7 bwrite('</ilayer>')
- k7 C" D& Z  F( c- s}
* W0 u1 y) Y1 K. X' Q% ?& }. Jdocument.write('</td></table>')
" f, W! @7 |4 M. y1 ~+ x0 o}" t% v1 _$ g/ @- T3 k
}* k1 U* R* d$ O* x- j7 s3 ~0 ~
</script>

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