返回列表 发帖

网页之跑马灯文字特效

//修改宽度; Y/ ^9 i# K. A2 N$ O" L
var marqueewidth=300
3 m4 V: {- Y( a5 \- [9 Z1 e% x' K//高度
6 v$ t3 E! W6 d! _; Wvar marqueeheight=25
# g0 N: x# n0 r, O0 r2 c//速度(1-10)) e! {) t- W& D  S% @/ N
var marqueespeed=3
  ^8 c0 B% w0 o; M//背景颜色* p, ^/ @4 J! d: n7 b
var marqueebgcolor="#FFFFFF"
+ B6 R- e6 K/ I' |% Z8 X; U: V+ q7 s//是否能暂停 (0=no. 1=yes)?
* x% ?: A# J1 B" Kvar pauseit=1
2 h+ _9 z7 q  e$ J9 R) s/ i4 c  \( e8 [* D, n6 q, |, K( E
//修改显示内容, u# u2 C+ G4 C# J! p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 `: u" B0 R% E( W4 Z. |+ u/ P
* L! z7 `( ^. r+ Q
& o( @7 k" ^; Z
////下面不需改变////////////$ Z. y4 m" P# Z! a$ n0 ], o
  B# T! e8 f2 S
var copyspeed=marqueespeed. a) O0 q2 P4 b" y) _6 H
var pausespeed=(pauseit==0)? copyspeed: 0
; U4 h! d/ Z5 z7 S% ~var iedom=document.all||document.getElementById
7 M) n; t5 E" m; E* x3 H5 I9 M" Lif (iedom)
; U$ w- V% f9 W( E9 Y; d/ G9 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- j: c' T/ Q9 j% Mvar actualwidth=''( A% B1 {* ?4 h% ?3 k
var cross_marquee, ns_marquee. D  c/ ~/ m" W( l/ m: }6 S

! b: k6 J# p' r' e6 z3 J+ Kfunction populate(){
+ T) t$ R6 `1 a: aif (iedom){
, h% T6 c- T9 Y- J; E5 K: ]/ X3 T& P% Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) v" I$ k* @% G5 n9 G' |
cross_marquee.style.left=marqueewidth+8
* V- V" ~. K1 `cross_marquee.innerHTML=marqueecontent
; V  B* W# @- D, [& |9 T- v: r/ xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# j+ f# |0 C4 Y, W! O
}
9 A. e" H: d, Q! Zelse if (document.layers){5 W1 c7 O& B: ]) \7 Q  z
ns_marquee=document.ns_marquee.document.ns_marquee2
) Q# D( s+ |) f3 fns_marquee.left=marqueewidth+8
1 c9 h& p0 {' W  d2 @ns_marquee.document.write(marqueecontent)( l4 w& d, [+ }. w( `
ns_marquee.document.close()
( b1 q* Y. w% Mactualwidth=ns_marquee.document.width
; E0 k" U9 O' t9 t- l7 S4 u0 P* T}
0 v" m' a  [/ U9 R' blefttime=setInterval("scrollmarquee()",20)1 v' ]. e( l& c7 M1 s
}
8 e9 A2 }2 w+ mwindow.onload=populate
$ S0 z; Z/ E/ _! p2 o$ L& k) z7 \8 c: q  I
function scrollmarquee(){
, W  k  J7 y5 b- A; l3 _/ M( lif (iedom){
9 [& n# V: T: L5 H' cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 q$ F: S7 v! L% e# [5 h* R1 @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ ]1 E( ?; W3 _' H) O  i1 C/ W" Felse  \, d$ m1 h6 q% j+ m/ n5 @
cross_marquee.style.left=marqueewidth+89 o: [3 e1 A: L' v
" ~" _5 n9 R2 P( e* F  X- E, {
}8 c9 _- y" [7 E, U0 _" {
else if (document.layers){, |, Y' r( j6 u/ s0 C0 G) D: t+ v: ]5 q
if (ns_marquee.left>(actualwidth*(-1)+8))3 R! E) S3 I+ Q' A
ns_marquee.left-=copyspeed) j  A4 r/ k6 [3 Y
else' S' @/ ~7 F% c+ ]* T
ns_marquee.left=marqueewidth+8/ v; J+ x9 V5 J7 [9 x+ y; o4 E
}( ]3 a5 ?: T1 k
}: Q* O- N' b% P8 B8 F

+ y" a4 X, r- n5 Oif (iedom||document.layers){
1 w4 h2 f6 @& L( k; @with (document){
$ P3 I" z! e0 g! r# [, }1 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* U& y; G7 a. r5 t% Vif (iedom){
, z* ^7 @+ X# p$ n, Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 [4 J6 R# ~3 o; D* _. z8 I% W- x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& j& c( Y" L7 N/ E' Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' R: _4 \; ~  ]; P
write('</div>')& d" L7 S/ q9 b: a: \/ j- n) ~. E
}  j& j0 L9 n- `+ z/ y6 o
else if (document.layers){' q0 M* c  Z. C; x* R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# q' d' u# _- E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 U! `& u6 ]( T7 `- k7 Y+ \write('</ilayer>')
" z# X! p. T* @' a  _}# W; R- g/ R) i
document.write('</td></table>')% C' `  d1 c2 t1 K% j: ?  M
}/ {+ h6 }0 ~" {" G& R5 H
}
1 L) l1 B$ n7 j- _* E, Y</script>

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