返回列表 发帖

网页之跑马灯文字特效

//修改宽度, K2 X, j5 ]. O
var marqueewidth=300$ h# c* h- J' [% H& U' r( h
//高度
& R; d# F* q+ e6 j6 _* Mvar marqueeheight=25" v, ]; @! `# b
//速度(1-10)! ~. b  |! b& `+ ?% ?5 e
var marqueespeed=32 q, g8 [/ s2 p8 T; t7 y
//背景颜色
! y. q6 O& n; h1 |+ Jvar marqueebgcolor="#FFFFFF"( p  C$ {9 D1 n  W5 ^; m
//是否能暂停 (0=no. 1=yes)?2 I+ I0 v* R" K" W% Q" _. W4 S
var pauseit=15 [6 b7 k! _5 H; _) y1 c+ G. I; s$ U% A" N
( u* k( H% l; a, u$ B$ B2 U% [
//修改显示内容
4 F2 X7 H  J3 z! v; dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 M" M, y* c3 T8 y  w# `
0 L: ]% X2 \0 _# @' d9 ]; ]6 P( C3 J  b
////下面不需改变////////////
/ `& ^1 f" W' S. F" g* K6 J, \
9 U1 k! B( o" \: Tvar copyspeed=marqueespeed5 t# R; M+ ]' z( t- M
var pausespeed=(pauseit==0)? copyspeed: 0
( i' b5 s' E# J5 e$ }var iedom=document.all||document.getElementById
7 p8 s& d) a  o0 ^# D& L+ Qif (iedom)
7 G7 R/ ~0 h( Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* C+ M4 X. n0 W, z  j* c
var actualwidth=''" R8 k. f& c) g; m3 H" G
var cross_marquee, ns_marquee
1 U9 U. I! `) w
' D* r9 W& l& q& V* [) r) afunction populate(){; N/ l2 C% \+ Y' `3 c* u
if (iedom){  b7 R% X( b6 ?6 _( z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ ]+ s1 Z* a# i3 Z
cross_marquee.style.left=marqueewidth+8" J2 u& w' \* X* l1 P* u" J2 _
cross_marquee.innerHTML=marqueecontent
# D/ _/ l# {1 }) [7 J9 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* o! ]6 r3 T8 m* B) ^1 V: g
}
0 p1 p2 T" q6 m4 D5 Y+ @else if (document.layers){
# F& o% c1 |% C- W8 S; Cns_marquee=document.ns_marquee.document.ns_marquee2
& k/ N, B0 h/ qns_marquee.left=marqueewidth+8
  U2 o! I+ [: ~  qns_marquee.document.write(marqueecontent)
9 y' @' L+ Z% }6 Ins_marquee.document.close(), t! z9 u, a# N. P  e
actualwidth=ns_marquee.document.width
7 @% q5 M% `$ D/ m}- a8 y" c$ C0 C8 n
lefttime=setInterval("scrollmarquee()",20)4 f. o5 P8 j# w( q9 O9 c/ e0 q
}
) _8 V% S2 ~4 x+ d) Z7 x! H8 \window.onload=populate  M% b4 n# V4 C) u; [" z
, Q8 q  o8 @! ~
function scrollmarquee(){
+ A. q5 B$ N4 T5 j+ Tif (iedom){6 Q: S" ~7 v5 Q* W( p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 l, `: K1 P/ Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& r4 e( P6 h" E$ v; k, @9 T$ delse1 V5 c' {+ _& D' ^( e  j) b6 n
cross_marquee.style.left=marqueewidth+84 S, q) L! |4 x' {0 p

1 j/ m; U0 O+ ?3 C. e}; V: I% o4 w, [. h/ T% S. t+ {
else if (document.layers){, B2 r6 l3 f8 l& }# T
if (ns_marquee.left>(actualwidth*(-1)+8))
! y, n# F8 D5 }1 _( P5 n: \ns_marquee.left-=copyspeed8 {. Y" {0 K8 t( @, I$ \
else" U: V, r9 {, [( k4 U
ns_marquee.left=marqueewidth+8
, t, _% U+ Q4 Q9 N4 D) p}
/ R, m9 Q% R! Q5 \}. P4 k  p/ T$ M+ y
( ~1 ]& d' q: l8 y6 W
if (iedom||document.layers){1 m" |  Q6 K" ?3 N4 y3 e: V( q1 j
with (document){
3 q! V& W6 ?" _. J4 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. ~* O* M) h* l: ~. oif (iedom){
3 U/ S+ j) @% r" r* u' Z* U5 j+ Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ R8 u& B( @2 X3 O1 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 _4 f' X& |% f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 q6 i, c9 L7 S" i1 {. ?write('</div>')1 C# Z0 a3 o) Q9 x- w- V& @
}
2 N. j6 M+ g( n- V4 B* Q" }  V. lelse if (document.layers){0 o1 |  h& P6 c( T* _# p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( [9 p3 H( c; U* I( `& O5 Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( ]+ [1 u7 V6 p- c6 `# q! S" e2 N
write('</ilayer>')
9 P- d% Y: ~; I7 i. X5 E/ k}
7 [1 q7 z8 q( Pdocument.write('</td></table>')# B5 [0 g' v" F9 ^4 X
}
4 a1 v; @  n% Q- n}
9 t: Y8 W: f8 g5 P+ Q! x4 I</script>

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