返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 J6 j' R% ~9 M# J, r+ b. yvar marqueewidth=300
! ?1 {" {5 \3 [$ o3 N7 |# \//高度3 Z1 D- m' h8 S  ?& o9 L4 K
var marqueeheight=25
( {% q0 d9 A/ `4 H/ H3 |* p//速度(1-10)+ L3 R7 }; x( O* m4 V
var marqueespeed=38 ]' z5 w- R" U% X
//背景颜色: h: t" p$ ]2 C2 ]. h; I
var marqueebgcolor="#FFFFFF"
+ p6 P, N/ t' ^( \* y//是否能暂停 (0=no. 1=yes)?
) Q3 ?) D0 j2 r& x! Wvar pauseit=11 x" f* b4 M8 o/ h: d' `. w( T+ G
9 N- B( c. Y8 _/ ^0 x2 {/ o* r
//修改显示内容3 F: q- K$ M- D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  g6 o: X' C! L( t5 Y
7 E. {: I( C: w- T
; s& X. X! b" ?
////下面不需改变////////////
% P6 s! K/ S9 m. p, v/ K0 W* _- Q" @, ]* ]7 ~- X6 h6 l
var copyspeed=marqueespeed9 f, A, X* c6 `; ]
var pausespeed=(pauseit==0)? copyspeed: 0
  ~, o0 a( p/ h2 z7 \# Lvar iedom=document.all||document.getElementById) t1 e& c2 X& F5 r
if (iedom)5 W2 t( v( r% T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 K; _$ f3 h5 i1 x2 \& d% y
var actualwidth=''
9 y! T% ?  }' c( Cvar cross_marquee, ns_marquee* y6 g& y2 r/ j" W) c6 o9 J
4 g2 |/ `. Q/ @/ F3 T
function populate(){
: w4 m$ U& d1 B) ?; \1 ^if (iedom){
& X: F  ?( n' o- K" X, across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% ^0 f$ M5 o. p! S% l4 k) h
cross_marquee.style.left=marqueewidth+8
; h+ v% }& B0 ~  g1 qcross_marquee.innerHTML=marqueecontent
+ E% }8 f6 M+ L( Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( k6 b7 W: v% v7 P
}4 i9 X# x1 G0 b" ~; }+ N5 Y1 E
else if (document.layers){0 G0 p5 I8 ^7 `9 L1 Y% O6 n
ns_marquee=document.ns_marquee.document.ns_marquee2! ~& u; z3 x5 H- E# Z0 U
ns_marquee.left=marqueewidth+8/ I4 A8 b' z! i  x6 d* x
ns_marquee.document.write(marqueecontent)7 h4 {1 |$ o( F5 _
ns_marquee.document.close()
9 ?- B4 u& j9 J6 @6 N# K$ z3 Uactualwidth=ns_marquee.document.width' l- I( m/ @+ C" N8 D0 X
}0 ?: W# C6 L' k# |1 P
lefttime=setInterval("scrollmarquee()",20)9 w3 m8 b9 q9 ~: [: N
}1 C8 s9 u3 e7 A' ^7 D
window.onload=populate5 }! o# o3 D( k8 P$ l

% s$ N8 K: o( {% F# ~function scrollmarquee(){
1 X* O3 x1 W: Z. A" Z% Uif (iedom){
" E; N, [, Z" H. S; c. lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 M$ q% t& l( I% ?: d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! ?, w% r: i) F5 D1 n0 Z
else
3 _& J) p" b1 L$ f' c  Ecross_marquee.style.left=marqueewidth+8  u5 K% H( [- {; c, c( Z: B7 M

% A. R( e0 ^2 V2 c0 e, X}6 b1 E& X' t3 v% P1 x& N6 S1 M  P
else if (document.layers){
+ J4 `0 |$ @% x" l# R# ?if (ns_marquee.left>(actualwidth*(-1)+8))
9 F" r  N( ~1 A" |# }8 jns_marquee.left-=copyspeed
, J  u2 Q8 D+ [* v3 d4 y7 oelse
  h1 {, k+ O; y7 w. P& F* xns_marquee.left=marqueewidth+8
1 J5 f3 L% F2 g" S- Y2 ]& t* @}1 c. k$ s. M1 q- h& @+ x4 B1 F
}6 w$ x- l* K/ o
& _2 ~( w. Q/ `7 F% |2 Z" S4 [
if (iedom||document.layers){
/ Y; z* Y+ G% l6 s# F( Owith (document){
. R5 J$ u: ]- k# t8 |7 q* C2 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 E9 F+ c( x" z
if (iedom){
6 u0 Q9 e( u( Y2 q' Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 Y* n9 R7 m/ T' \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  k5 G# g! i( }! V+ q  \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* p1 ~# k  c8 h" I5 V8 \. |6 Iwrite('</div>')# E5 |( p* ?/ T2 ^" a4 h
}: x- }$ Y# j$ a5 I% w
else if (document.layers){5 _  u: i2 b( [/ d; z# `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ P; {+ A/ H  f4 `' K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 r0 x  S, ]% X* D  J7 o  }/ N9 \
write('</ilayer>')
) s* p0 v# H0 W/ \3 {: v}$ B$ R" L  O2 |8 ?4 m6 E, W+ l
document.write('</td></table>')
1 f% D" R+ }1 Q2 X) ~}
( _$ h1 x* X- v: O5 s' A}5 Y3 Z7 `0 N! x+ C3 [
</script>

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