返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, y5 v+ M3 x. n" O; [var marqueewidth=300# X, D9 {+ h' z% ]
//高度. p3 x1 l' U, q, _4 G# W: T1 {2 R7 T
var marqueeheight=25
" x+ s. Y0 l% {9 ]- ~5 m" o$ g//速度(1-10)3 P; H% s/ B0 y  H! v  |. W
var marqueespeed=3! R9 V5 A4 {# e' I. F
//背景颜色
- R( G0 d$ m4 g# yvar marqueebgcolor="#FFFFFF"
8 S0 J4 X) j, M; p; ]& L/ u//是否能暂停 (0=no. 1=yes)?- ~7 n- J' e; _  P) B3 e( @- p
var pauseit=1/ g- g. M6 o2 A
& A' s& v0 g  b
//修改显示内容  e4 W5 j* J6 F: X/ X$ w) M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# Z9 j/ g" L( @- l  s0 \7 H; D" d' {

' j7 x2 i. I# Z1 K, b* T
* v/ A! A' k, ~, c////下面不需改变////////////
( H, h6 s+ r# ?  N! r
  n+ q8 u# S" t. q9 S1 ~5 }1 b* I2 Xvar copyspeed=marqueespeed
. W- t! R0 b& s& Dvar pausespeed=(pauseit==0)? copyspeed: 0& i5 g5 G! J, h, |. |$ @" Y
var iedom=document.all||document.getElementById2 _$ Z( m# U6 k6 u$ t( ]
if (iedom)# z1 W4 V% v" E2 l. u9 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 J: M' p- S$ R' c% `' Tvar actualwidth=''
& |$ F( }+ f  Q( Y, ^# Q+ Rvar cross_marquee, ns_marquee
) A# k% t: e0 I8 b8 Q6 ?- G/ l) S; q8 M  j: _/ ^
function populate(){
" n3 i  C5 {6 v, D. ?' [& I" xif (iedom){- `2 Z  j3 d: g; _7 b2 `3 l; d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" H  h% u2 h% `! @# c1 J" Tcross_marquee.style.left=marqueewidth+8: ~5 @0 X- x/ Q1 V) p
cross_marquee.innerHTML=marqueecontent- |: v( o$ n2 |! Y9 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- @6 \  V) @& q: |- l! B
}; i  U) T& P, n8 J- |, r
else if (document.layers){
/ s) S) q# @' ?* p+ b" X0 zns_marquee=document.ns_marquee.document.ns_marquee2
3 `2 s0 p0 f* F  z" O. K( Jns_marquee.left=marqueewidth+8/ \6 y$ j( o4 P4 o) ^. z( h
ns_marquee.document.write(marqueecontent)) A9 I: c  X- K* q
ns_marquee.document.close()
3 p) U( W$ q3 x! U+ X4 nactualwidth=ns_marquee.document.width
0 U5 i6 A9 w1 G) h( }  H; l( }; H}3 M1 Y7 o3 E/ [0 d- f% y
lefttime=setInterval("scrollmarquee()",20)2 V) I: E1 @: _2 p7 R5 ^6 G! w7 _
}6 B! t' j% ?3 t
window.onload=populate7 o' e# M9 F' {" f/ Y
# v6 T4 x+ x$ b' b6 x+ D
function scrollmarquee(){! l6 K/ b5 ]: L
if (iedom){4 L7 `- D9 o6 o" b$ ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ |+ L0 r+ j3 r5 F( @7 E) r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# D1 q$ S' d  I2 }else3 @, o0 {; O5 J& E
cross_marquee.style.left=marqueewidth+8
" Q% H9 b# [, ]% F3 z% k" X1 a5 G4 I- M3 N, |  U2 B
}
& V+ k2 V$ H8 p5 t" Eelse if (document.layers){
5 L( k9 M2 f, h/ x8 [5 w$ G' aif (ns_marquee.left>(actualwidth*(-1)+8))
2 y1 |( h" j* o/ x# Cns_marquee.left-=copyspeed
; I( i6 g9 w/ V$ X" G7 q) felse$ O: _! @9 g* n/ o& W9 Z. R9 k
ns_marquee.left=marqueewidth+84 J7 X' {5 d4 Z, L  B! Y( R3 J/ V" q
}
" B# G3 k4 L8 b/ c+ \}
- d# z! x- W, g
- O$ v& f0 I! d( j5 I+ a1 Mif (iedom||document.layers){+ y- g: J' [. m) k9 f! [& h
with (document){
) k% W$ o4 H" O/ ~. Z& [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ S0 V$ z6 t# A. ~2 r8 C7 L& ?if (iedom){3 i7 {" f' ?( ^# s. X/ g+ j  T- T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ ~9 }5 l! N% `" E1 K4 nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  f6 u+ v9 x) H; k, jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ u( G5 i. Y: L% p& l6 N; R
write('</div>')
, u( B; z; p6 C$ z3 n0 i+ l}
, h6 i6 s! W5 @' [& F# ?+ ^else if (document.layers){9 \( e! ~: R0 }+ u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 r+ B) @% z1 u9 Z7 j3 Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) `7 M/ J8 K/ o, ^9 T! t; c5 Y& Y* M5 ?
write('</ilayer>')
. b2 i$ p! g' ?5 Z9 l}
0 L: ~6 C# G# _* p; T  ~document.write('</td></table>')% F: W' _& M2 H: [: Y
}
2 i9 m' J: s: k) q: T# n}9 u  d* x; y! X
</script>

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