返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 n5 R- {8 N) Avar marqueewidth=300
! _/ X- R8 s5 s% V1 |* `9 R//高度8 q) W) w8 D% n4 c
var marqueeheight=25; n/ Y. j$ P2 J7 a6 X
//速度(1-10)
8 C9 Z9 H8 |' J" O# v4 Jvar marqueespeed=3
3 R) |% P% h  z# \& x//背景颜色; @1 C& }, W* \- Y' c
var marqueebgcolor="#FFFFFF"
4 I+ E1 G' i4 p2 k2 v5 c0 Z" i//是否能暂停 (0=no. 1=yes)?
3 w3 c/ @) e1 K- |7 ~* W9 uvar pauseit=1
0 |' ?) L7 c; _, ~' [! `2 A
  G" \1 q7 {$ J1 o8 {//修改显示内容& B! o3 d) ^$ r# n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 f2 u6 [! b, e" A9 k4 `* X

6 T/ ]' A) R1 Z
! J, X; D' G: M2 Y) T- E8 h* a: h////下面不需改变////////////
" q. t/ _) D6 u7 f; y) }" w; \
4 z" z+ I- @. t( hvar copyspeed=marqueespeed: `& h; t5 W8 R& Q7 c, ]
var pausespeed=(pauseit==0)? copyspeed: 0  L7 H' k" Y$ O: x# I3 T. N+ k
var iedom=document.all||document.getElementById
  `" x. ~$ z( M0 O. Sif (iedom)
$ c/ Y" M0 u) z. hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# t% p; D" G# Wvar actualwidth=''4 A' v/ h0 S# y2 R' t! I: `
var cross_marquee, ns_marquee
" g5 @% a  q; c9 v2 |" n! T6 ^% @0 d) m. M
function populate(){0 a4 u; U  M  {6 x
if (iedom){$ r1 M; A8 j% h. i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 O( }# q4 |. w: r# g, E: f
cross_marquee.style.left=marqueewidth+8. V9 L4 @6 H% F- ]" {
cross_marquee.innerHTML=marqueecontent
. P' M6 [& W8 k$ vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# P1 U+ A( _2 q2 u* a
}: _5 S+ ~  e/ D  m0 ^' w% _
else if (document.layers){
6 v+ |& v% n* ]* \ns_marquee=document.ns_marquee.document.ns_marquee20 F6 f$ X, \7 e( c- r( _( o7 a
ns_marquee.left=marqueewidth+8
1 Z: i: z2 t' z$ i+ i" F) ], r% Xns_marquee.document.write(marqueecontent)/ \8 G# Z. F! |2 M5 X
ns_marquee.document.close()" X- ]1 c& ~+ J! j7 X
actualwidth=ns_marquee.document.width# v- c: U. V$ p) q3 c" V
}
, w* P+ y$ Y( @+ X  h7 plefttime=setInterval("scrollmarquee()",20)
4 N" W# @2 n8 f  c' L; ^8 o}# W, B8 @1 r$ E- A, j! m
window.onload=populate$ H( ]) E# K0 N% b% v1 n

& Z5 q3 Y; b; E' T& Afunction scrollmarquee(){
) I, \5 @9 N7 {5 A( V8 \3 [. m. `if (iedom){
' H) U) b, i+ R' |/ pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ n2 |* q3 e8 t) i. ^/ z, F9 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: q# e+ c' J. Xelse6 \2 ]- c$ w# P& |: ]! N' ?
cross_marquee.style.left=marqueewidth+8. N. P7 U- ~* J9 y
- T% M1 ~/ M; d/ V1 X
}
( P" S1 s/ b8 jelse if (document.layers){+ O2 B3 ^0 J5 B$ k, @; K5 Z
if (ns_marquee.left>(actualwidth*(-1)+8))7 r) q2 z% a1 x* ~) v$ B
ns_marquee.left-=copyspeed. \& I3 @% U, I  L
else9 \% x- W3 M" i* e8 H7 `- T+ `. v
ns_marquee.left=marqueewidth+8/ r9 h' I9 g/ c
}% O5 {- |/ [) I3 ~
}8 h$ p: W+ A: S1 A% T$ k9 v! S

- n1 p5 J* w2 K# @# d! O+ I& Wif (iedom||document.layers){# E% U* z4 I5 y6 ~
with (document){; W& e/ k! e8 S4 S5 I4 V0 F7 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; z7 L' L5 Y4 E- a9 R/ @if (iedom){( s1 h) r3 K- v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% p! n* @8 Z" nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 t  C* {, p; O. x0 _+ U) \2 V% Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! I8 T0 K* w4 h7 o) m9 Iwrite('</div>')/ f+ D6 B# s" Y
}
4 d3 Q: G7 v+ }. ^$ ~; ]else if (document.layers){$ r+ U6 ]* s- r: Z5 F- Z( L2 V: v0 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! F; M) ~8 A* ~" k% Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); e8 y6 e( \: h
write('</ilayer>')
% e/ w; F) C1 y) G4 [1 r}
4 y; V! W; Q5 I0 K  R$ J0 N. Kdocument.write('</td></table>')
. Q0 T* b' E" P: G( B- S& w}
$ L, I( A# W7 \2 B1 f' b$ |}+ A: P& I5 P0 A
</script>

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