返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 M' v/ y4 _$ B* M, K9 u! u
var marqueewidth=300( X7 X' M. L7 T
//高度: k; ^; T/ W) Y' E( u
var marqueeheight=25; j1 k* j, t! f& n" M& y
//速度(1-10)2 w% M5 Y8 ~1 J
var marqueespeed=3. [( w: S2 J" v/ A, W
//背景颜色
9 q: ]. k; m) q9 c& g3 D( G6 K9 _; Jvar marqueebgcolor="#FFFFFF"
3 W+ l( D& l$ `1 |5 L' ?//是否能暂停 (0=no. 1=yes)?
* A( S! J% h4 O" lvar pauseit=10 N( g8 J6 b1 J1 p  X$ U
. M$ o8 N0 V6 A5 H7 j4 `
//修改显示内容! I' U% q+ E6 S3 d* ]* {% f. n1 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 e3 b; F! j) B# o" A3 S$ N( k/ b& y% c1 R; G3 P

+ P# w8 y9 Z3 Q* i- Y- w$ {: n////下面不需改变////////////
/ n* e; P! m# P7 n5 U# k1 c8 G, Z9 q% E( }& ^  g4 T* R
var copyspeed=marqueespeed
+ p; O) ^: c( d& V: ]! ^" Hvar pausespeed=(pauseit==0)? copyspeed: 0  `" v" `. s; i1 V
var iedom=document.all||document.getElementById6 {6 s  ~/ f! l; W# M* `
if (iedom)" S9 k, A. a3 T5 _0 Q" j/ M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& `0 ^" N( v/ d& Cvar actualwidth=''/ z1 E' o  n! R  i
var cross_marquee, ns_marquee
. `& I7 W9 u. ]( C2 y: _) y6 K/ D8 J& R0 u
function populate(){( l4 U: {' e1 J6 Y9 j4 _: b
if (iedom){  N  D% K7 M; l7 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 W, e# ]5 ]* Q' k6 r3 \, a, z
cross_marquee.style.left=marqueewidth+8
  F4 T8 T/ _& {5 Z$ Fcross_marquee.innerHTML=marqueecontent
6 x  n+ J$ d4 N* w" qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 M& o3 C0 p6 s8 W5 ?( q3 i}
6 e" Y  K/ {, [7 j. selse if (document.layers){  Q) s) j* Y" X) B, X3 i" h! o
ns_marquee=document.ns_marquee.document.ns_marquee25 b4 X1 |! X  M! B% @3 Q
ns_marquee.left=marqueewidth+8
/ B& Y. |- A% ]3 X/ G0 v5 gns_marquee.document.write(marqueecontent)3 L7 U  j3 C4 r: q/ _0 W0 X
ns_marquee.document.close()
5 y: r% J2 e. eactualwidth=ns_marquee.document.width. m6 c4 J2 E7 I7 q0 U8 ]
}
' j2 i7 `/ m* |. g( I; a7 n& L) Ylefttime=setInterval("scrollmarquee()",20)
' E+ m/ y6 }, x- P, R}
/ J2 D- P* v0 b" O2 ?; m3 Ywindow.onload=populate
8 H- F  _5 i+ y* g. \! b9 c+ V' [# e% u  R4 H
function scrollmarquee(){
' ~- c6 t/ k; t; Iif (iedom){5 X; n9 x7 ~0 T; N2 P. A7 \- w- r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' N: n' A+ _' d, i. K/ i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& @: Y8 n- o$ _/ V+ Ielse  ^4 ?) J+ V  W' {7 ?3 R8 V; O
cross_marquee.style.left=marqueewidth+8
/ T+ w: C5 W6 F* v* C
. a" D+ r+ f( W8 @! G0 ?}
4 N* m* O& f' ]else if (document.layers){
4 G2 g3 o1 Z2 Rif (ns_marquee.left>(actualwidth*(-1)+8))1 r; Z) W3 A+ N3 g' K3 I
ns_marquee.left-=copyspeed
5 k) E. c  \, X+ B( O2 helse
- s: n8 W4 k3 F/ V3 R8 `6 wns_marquee.left=marqueewidth+8
4 N; J: O. V  R) Q5 Y. I- `}* {  D. h$ r$ ^7 P3 e! O1 }; ]% V6 G
}
" f% `6 t6 _& A- e4 N6 w
3 F& i# _4 Y; ~if (iedom||document.layers){
& U4 B% {" L  ^* Uwith (document){
* I/ J" Q! v- K' pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- a- s- L- Q7 r8 I  e' }4 V* jif (iedom){
: x+ L0 T6 `/ w, G% u5 i2 d9 swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( x6 M$ d3 k5 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 g* b3 l& j& F) p  xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& \5 U- {2 t' H) s2 N* p
write('</div>'); d3 p+ [8 |) T6 G' n! E: V4 n& m% p
}) O% a8 Q8 v: k% g! }& L# I) M6 z" q
else if (document.layers){
2 {2 \/ i7 Q, P' p1 _8 @0 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 S+ ?# _0 Q$ m* O9 P6 [0 b5 ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# Q4 d: a8 h9 Z2 ?3 E, Z! H
write('</ilayer>')2 S; i" s4 F* X& @* b
}9 U* P- o* v# l1 z5 C) V# \. u0 {
document.write('</td></table>')0 ^6 f. s3 ~! R4 L* Z
}
* q" A  ]1 i$ k8 }* c4 }}
( |: u$ X+ i3 q2 `2 u  O9 Q8 B+ y</script>

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