返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* ]  t$ d! P9 f8 p8 K! e3 Yvar marqueewidth=300, y9 p4 C1 I: ~5 u2 k% U$ G
//高度
1 j, x$ g2 K4 Y1 v1 Tvar marqueeheight=25
1 h8 H1 G. y" W( F1 S2 k5 @//速度(1-10)1 {9 ~& @4 F/ k' X8 ^3 F) B1 S
var marqueespeed=32 E, g  M% L6 ^3 O
//背景颜色5 T5 R1 _- l3 ?. D* |4 X9 o
var marqueebgcolor="#FFFFFF"- r& \: d- p. E7 h, D; ~1 B* l2 E' W+ E
//是否能暂停 (0=no. 1=yes)?
' i9 }/ Z" H2 G( Yvar pauseit=1
' @6 j7 V. X; D8 ~5 A, H% G# z3 c$ n, }# ]; }
//修改显示内容
% g) P/ _0 s) {6 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 n6 w1 C2 C( t6 Q
7 p+ W# a! y" A4 J' m% V' r& @& V5 L  v+ y3 y0 }% H, \) W" {
////下面不需改变////////////
+ t5 p$ d; n. ]  V: ?8 D' e8 `& b  B3 p+ c6 b
var copyspeed=marqueespeed
' P( `! M$ k8 H8 }% Kvar pausespeed=(pauseit==0)? copyspeed: 0* u; ~- T. u0 F0 @
var iedom=document.all||document.getElementById; X( m. e2 X/ P  f% Z
if (iedom)9 }- d/ J( A+ A9 g1 M8 t2 L8 {# o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ k3 N" B) R4 v1 f4 A1 }var actualwidth=''
, X) K& G1 i# v3 l- ^/ E5 Q# Kvar cross_marquee, ns_marquee+ J) |5 h( n/ P& u& `: t# r; P
8 v; E9 J" |4 ?1 c( L
function populate(){( C8 |/ d0 A" z; k% S; A
if (iedom){* L% J) e3 U" T+ [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; g5 }( j$ T1 _7 Q, i* p  m
cross_marquee.style.left=marqueewidth+8
& o0 N( l' d4 U( u+ D' jcross_marquee.innerHTML=marqueecontent
. C6 i* J1 y8 U2 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 m) o$ p2 E% a' I3 }, w- Y}8 h; H3 h$ z8 ]
else if (document.layers){
/ C5 j  Y- Y  y7 p# cns_marquee=document.ns_marquee.document.ns_marquee2# @. z5 D' U. i9 L  m! @
ns_marquee.left=marqueewidth+8
+ R8 p% k$ V/ S4 J# X6 Rns_marquee.document.write(marqueecontent)3 s* `9 z  b, t9 Q" G' U
ns_marquee.document.close()
* \& p) n' _3 P/ D1 @actualwidth=ns_marquee.document.width
3 U8 O/ n8 V' _( Z}) k0 @; }  v$ ]* c3 ~1 |) o3 |
lefttime=setInterval("scrollmarquee()",20)5 ~- p+ |5 l, K  `: E- m0 D6 N+ W* K
}2 L  n! ?0 f- _9 |
window.onload=populate
; e5 V  }; n+ g0 g, a. l* P2 H' P* q' Q, k
function scrollmarquee(){
8 V+ b$ U: k, W2 O4 X! a1 |. B+ Vif (iedom){, i) l8 Q: c: e9 @7 C5 @# A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 Y" f  E  x+ ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" L  ]" ~! @& I7 d$ a! a4 {
else
, R; q9 ~. A) Rcross_marquee.style.left=marqueewidth+8
  f! `" j; [1 @5 T: K- \! w) c5 }- |& {# o& V
}
1 u1 r- h' l( |2 L' A9 p. pelse if (document.layers){5 Q+ e" k; g7 G
if (ns_marquee.left>(actualwidth*(-1)+8))
# h6 i1 b5 _& R8 [% E6 cns_marquee.left-=copyspeed
2 Y" x* E4 t; q7 Z3 selse. B, s0 A/ `* D4 ~, K
ns_marquee.left=marqueewidth+81 ?2 m; q: U. X
}/ i- S7 I+ l4 e+ ?9 v/ e! k
}' d0 _3 w# `" X. [5 G, x
* ~1 L% N' p# }7 P' P: v
if (iedom||document.layers){
- N1 c' s4 ~8 R" E5 b9 Mwith (document){0 }8 q# f+ H9 l1 b2 ]' [4 `5 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 H, c7 w5 U1 }9 G4 q2 yif (iedom){& f8 i8 d; J( a# t" l4 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* p) j# F( u9 B/ zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 h% ~6 c* R6 u  S4 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): t3 v% ^& H% T. X8 k
write('</div>')
4 Y: I. G" f0 {# T}
* g7 R8 M8 F% C- f2 B+ Eelse if (document.layers){
2 }) W8 c4 l0 Q6 X: g$ f$ Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); q8 \9 _' J4 U& P  [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; v* a& W) Z0 w3 |6 q) ]write('</ilayer>')
& g, b, ~$ V% l}2 B; u% C: h! O$ A3 q# q
document.write('</td></table>')5 j0 I1 c" n  ~& q% H+ g
}
/ k' M0 R" h3 o; p6 h( Y}
* ^3 `8 R  {' v8 M$ Z</script>

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