返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ `0 g6 L4 Q- j/ [1 g" nvar marqueewidth=300
$ J% x9 m/ N, X, V//高度8 c' L: b% Z( G7 B) v
var marqueeheight=25
2 e/ t6 j5 g% i//速度(1-10)6 y6 V" }& C; \& k: a4 a, i& d: E- q: J
var marqueespeed=31 _  h' F, v8 |
//背景颜色8 C' }; `9 n9 B! r/ i
var marqueebgcolor="#FFFFFF"
+ ^1 B1 `0 s1 \+ O//是否能暂停 (0=no. 1=yes)?; A4 S* i" J  u' J( p5 j
var pauseit=1
% J& j$ u6 \' O7 `
3 x0 k4 B% l) a//修改显示内容0 i1 t4 J5 R0 u) I% T' [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ]+ Q- S' M6 h+ l3 t( G

& c  L! X3 g. ?' D. X9 `; e- R/ G" e) ^0 b% Q2 T0 q+ |) v
////下面不需改变////////////* w6 K- {3 N) c; j/ C+ q, k8 h
/ s/ J# l3 ]! m7 f/ B
var copyspeed=marqueespeed0 Y( Q5 A+ X0 ?: s/ ?/ b
var pausespeed=(pauseit==0)? copyspeed: 00 [" }: t; M  ~, F
var iedom=document.all||document.getElementById4 h, J3 n$ X- `9 c, E
if (iedom). a. b  D+ _, n  }$ c2 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. K3 z/ F. c2 n- Evar actualwidth=''
) {: M" U, J, H7 {: f8 ]' o' lvar cross_marquee, ns_marquee
" q+ P& B$ @* G. R; _1 l& v( ?& V9 ]& Y4 c9 C& l7 O1 [# Y5 h: d
function populate(){
  S3 u$ ?1 l- U9 m' s1 Zif (iedom){6 h& `- m/ x0 T1 t3 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 c% U' B4 h: h$ i) R. O
cross_marquee.style.left=marqueewidth+8, n2 w7 e6 T  J) k- \9 T7 C6 A
cross_marquee.innerHTML=marqueecontent! j; X3 z" m6 i; O6 A1 Y5 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& F" u7 S! C' G8 ]; o! B1 n. X: t% A
}$ n) y) L$ x4 @8 I' F6 S$ E0 L6 B
else if (document.layers){
  P1 ^5 Q* y1 P1 g- H$ @ns_marquee=document.ns_marquee.document.ns_marquee29 C% A) `% c# g/ m, K$ w1 b
ns_marquee.left=marqueewidth+8
+ E# |  d3 C7 h: zns_marquee.document.write(marqueecontent)7 r( ^! B  x$ X: ^4 l2 A' h( i
ns_marquee.document.close()9 a1 m. k3 @; c
actualwidth=ns_marquee.document.width
( r. a$ i& _' o% H* |4 }# h}& b$ F3 C- t6 a: [6 R
lefttime=setInterval("scrollmarquee()",20)
! Z7 w, @5 R9 f% i}
1 j4 s) `" G# rwindow.onload=populate5 x" [( E# K2 V: _! S+ Z
( B: ^" l- c$ O  ~
function scrollmarquee(){
& m/ F, _" s& Y' ?1 u( Pif (iedom){
$ ~0 i+ v  V% {! s9 c7 G& Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- D3 v& q* l$ H! G1 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) l8 s5 K3 I# n' l$ ~2 Z( k
else
& n/ ~7 T% _$ C8 C3 @cross_marquee.style.left=marqueewidth+8
4 {4 @( d" L, J% x* y% a. k
% ?1 F- _2 c( C. q}- k) O5 D8 B& W) `7 x
else if (document.layers){% n1 p' a# g) g
if (ns_marquee.left>(actualwidth*(-1)+8))
& Q% n4 n* d. ^5 O' Q  kns_marquee.left-=copyspeed
5 z' ^/ x" E7 `' k3 \else
' L$ @4 f5 P7 g5 \7 Sns_marquee.left=marqueewidth+8
6 |" m6 p6 S& p! F}
! i  Q9 I% q# r; d9 U" `1 w# \}
( f" b8 r1 K' A3 I7 [+ Y" G; q/ j( p$ i& P
if (iedom||document.layers){
: Z% b9 {) W( j0 Z9 A' uwith (document){
1 y+ D; D* }, @; q+ |) L4 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) V7 c8 I  R5 O: Q% pif (iedom){
( X8 g1 z3 V+ i' J2 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- o9 h: f: j2 ~" E4 Q& E" L8 Y$ A- T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* n5 Q4 [. J5 Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 [: p+ w5 ?- p& u! zwrite('</div>')4 r1 ^" V2 r( i  `# [( m9 D( T
}
8 ]* M" W+ s% W, `4 delse if (document.layers){4 _! e; O9 i5 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( a3 L8 _# b5 y- C/ mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ h$ J- |8 r1 i9 V: }. y2 twrite('</ilayer>')) N! m7 p" i: n  W0 s
}
( p9 s2 P, Y3 w6 Ydocument.write('</td></table>')
7 s- O8 D' y5 L9 w  T: A% p}
1 t7 n8 c9 k2 }4 u}
; v- Z3 \! m( {0 {% T7 ^: z% L</script>

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