返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; i$ s3 `& s! e+ `1 X8 \var marqueewidth=300
! U- |% ~$ k: i5 b' X//高度5 O$ y+ _7 T/ P  k1 c# N
var marqueeheight=25
$ T6 j- O: p2 f6 p4 d$ z/ D//速度(1-10)0 _. @5 C0 @0 S4 f! w7 T
var marqueespeed=3
$ T  v( _0 q% R1 n//背景颜色! M2 x5 C4 A# u5 ~
var marqueebgcolor="#FFFFFF"
6 J4 m% W+ Q) W) D% j# K, E8 L//是否能暂停 (0=no. 1=yes)?
3 l& W" B" k2 [& mvar pauseit=1
8 m# D$ g5 h; ~  w+ N. t( x  c! z# ?' `& q
//修改显示内容" ?# ?) W- B- W0 A& t* Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', S9 d7 {# a" z: H9 j7 y1 R0 L
/ d% J; ~+ P$ K; V
) p' Y( e$ P0 r# N  {' _8 V( U) e
////下面不需改变////////////3 K8 q6 y; Z9 W+ z, M
" U* _5 W; Y' h  B$ E
var copyspeed=marqueespeed, k2 w) h; k3 v, T" ]3 [
var pausespeed=(pauseit==0)? copyspeed: 0
- U% z3 D% z2 a8 J7 p8 N6 b1 nvar iedom=document.all||document.getElementById
* \- n3 S4 b# Zif (iedom)
% d; f6 h7 p7 ?" z* |; wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* x' h0 j. l5 m( O, fvar actualwidth=''4 w  x# B4 r2 x; q! n& ^% I6 ?" }
var cross_marquee, ns_marquee
* B; }6 ^% C9 k7 s+ W
, E0 T/ j: Y0 c$ x3 Z8 A5 Nfunction populate(){% z1 ?5 l1 |* n. _
if (iedom){: S# y) a5 _& S7 ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( U( ]( p0 J0 u1 x( n. Hcross_marquee.style.left=marqueewidth+8/ R- R  I# K8 }1 x
cross_marquee.innerHTML=marqueecontent
4 ?! g6 E- v1 a7 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 `; H) k* i, `. B. W4 G4 t, q
}
( j2 |8 p- S# L2 [' _' r( n& m; a" B  |else if (document.layers){* {* A& m: N+ Z/ b: P
ns_marquee=document.ns_marquee.document.ns_marquee2
7 Y6 N# _  ?. O* c- y3 [% G( `ns_marquee.left=marqueewidth+8
$ s3 _+ Q# v/ l0 X. _ns_marquee.document.write(marqueecontent)
3 q$ G* ]7 q; L' A! s2 Ens_marquee.document.close()& d$ t- `, u3 p1 D$ Q
actualwidth=ns_marquee.document.width
: }+ h' z4 Z  q* m/ U}& I  t% _: t- N0 x4 u
lefttime=setInterval("scrollmarquee()",20)
& j+ G& e6 p4 y% O% x" v}) @! {7 ]2 }2 V9 T4 l4 w/ U/ }
window.onload=populate
$ m) v& ~# C0 {9 M7 H* l4 d# d, o/ n  O0 H0 \
function scrollmarquee(){
" f7 y9 d) E! q/ Dif (iedom){
& W# t. X: G9 A) k8 [* Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% |; d& Q& u+ {! _$ O& O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) x" J  l* i) L7 L2 V' F, D$ ?
else
1 }" a8 l& D! }cross_marquee.style.left=marqueewidth+8) g0 L8 z3 g. h2 p
% b+ O8 b6 T2 h) e
}; O( E$ s4 s" y+ x* D4 U
else if (document.layers){- n) c% E  a8 }% J/ T4 ?
if (ns_marquee.left>(actualwidth*(-1)+8))
: c$ T3 R3 `9 Rns_marquee.left-=copyspeed# o9 X7 O. t9 a
else
6 G3 Y0 E7 j6 ^, R+ sns_marquee.left=marqueewidth+8
3 V* S8 p; T8 o" N; j: }8 {}
1 x# ?, v3 r, S  S8 Y, S, E7 k}
  \2 ^! v" k- x4 z8 @( [6 o+ Z
. R6 i: k6 o2 I3 {# p% Q7 J" [if (iedom||document.layers){
; v0 P+ V6 ~$ S# @2 s: Cwith (document){
9 F  s& n+ r3 \: udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 m* d; F8 U) L9 Y1 o! D: Sif (iedom){5 z5 \0 H0 i% |' o" w3 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 T8 U3 ?2 a, \! zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ u" }- o) z% V# a' e1 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' t4 j7 g( f4 H& A: owrite('</div>')
: f& M/ _8 u, W+ f7 `" q# T}- y/ `  z$ R# ~" i2 @7 G
else if (document.layers){
, Q( i, f& ]' Q6 Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' E9 ~' _" |7 ?9 U# F; jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ `& E: e7 P7 z' d( n! f# o& A% N+ K
write('</ilayer>')
9 O6 |* H% U% @. F: n* c}) T+ p& m( x) j4 _
document.write('</td></table>')
9 B. I; _/ K% W6 g}
/ L! t5 @) k$ @}3 _; t4 w+ b1 G& {* b# F6 Z
</script>

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