返回列表 发帖

网页之跑马灯文字特效

//修改宽度' N0 K3 M9 i9 u2 d* {
var marqueewidth=300
! _- C$ U! A; C+ k$ ~//高度
; X6 ~! S% ?& F/ c: Ivar marqueeheight=259 _3 l# i& t( m( O1 ^. f  L
//速度(1-10)6 |; c8 i2 n! S7 B' H4 I
var marqueespeed=3$ d+ z6 {) l9 |) E
//背景颜色' @! ]  G) w) k, `1 ~4 o
var marqueebgcolor="#FFFFFF"
5 Q" {+ X6 r5 {9 R+ H0 ]//是否能暂停 (0=no. 1=yes)?
4 E+ @" }  T5 q# mvar pauseit=1
' B1 ]- Z! _) [& Z: {
& Y8 x. W; w) [1 `//修改显示内容
9 N5 |6 G! x0 T" Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% ~: f4 i3 {+ z: j% R
. X6 u  G3 a5 ]* H& X% W  d8 F+ \0 ^( ^5 P" X: n3 L
////下面不需改变////////////
& y+ Q, S: `6 d& i( f0 A4 T9 G* [! Y" {& A3 h' M, x
var copyspeed=marqueespeed3 C6 K. @2 k5 }! E( Q3 D* S
var pausespeed=(pauseit==0)? copyspeed: 0: Q* {4 m( X( Q, g/ U: D
var iedom=document.all||document.getElementById
/ R. M* v7 j  s0 D: e5 u( h, A# Mif (iedom)5 O& [! ]  z2 u+ A# @6 x1 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 ]5 v: |+ L1 R9 ?9 o5 E
var actualwidth=''6 a4 p5 R6 k0 @8 n3 v  W0 V$ P
var cross_marquee, ns_marquee. H: q5 y2 u9 c

7 l# ^- W: o' ~; z0 q( rfunction populate(){6 n; P8 i) }$ s' E
if (iedom){' u. S. s$ n: c- {8 b. q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# \9 `$ v  R2 m1 e
cross_marquee.style.left=marqueewidth+8, M/ _! F+ ]; y6 `# N, @
cross_marquee.innerHTML=marqueecontent
6 u0 N$ {8 H4 @5 h% J5 e  h" wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" y( O6 p# l) Q1 I3 C' Y5 [}
% V- I4 m& D! S1 pelse if (document.layers){
  r3 ~2 ~1 e% v, o" ]; L* u* ans_marquee=document.ns_marquee.document.ns_marquee21 H6 V+ ]" a1 t
ns_marquee.left=marqueewidth+8, k2 N/ f# {& B& P7 S
ns_marquee.document.write(marqueecontent)) u* p, S* e+ Y
ns_marquee.document.close()
! r% I$ f, [2 H" I0 N$ sactualwidth=ns_marquee.document.width$ G: T$ ]3 ]8 I3 W
}
8 N# a0 x- J( M7 v' ~lefttime=setInterval("scrollmarquee()",20)
, U& W+ m& O: z4 ^& Q3 _}! Q: ^: P$ h$ C* G: o
window.onload=populate
6 ~! s6 r: \; ?* l
8 G; w( j5 d7 `5 Efunction scrollmarquee(){+ Q' Z/ F* _+ g7 U
if (iedom){
9 v) p9 x4 \+ G& `" x* `% P2 [. lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 s' R8 x- O2 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) S3 q' V* T, Q) N/ q1 b
else
" B" O7 b' Q9 ^cross_marquee.style.left=marqueewidth+8
: X# s3 N' a. B# v, y0 B# V
; m1 u% x0 [; @' f, p0 x}; a- J+ c" ]" i8 L$ z
else if (document.layers){4 a/ _& m" |" \1 p3 J
if (ns_marquee.left>(actualwidth*(-1)+8))
& Z- N# D2 f6 F0 I) [ns_marquee.left-=copyspeed
" P4 m; l) `1 w* K, ?- m6 Helse
/ y% V8 ~8 D# D- ]ns_marquee.left=marqueewidth+8
( K& ?' }& J& W# ?" s8 c. S}0 R0 f  T4 o. q  S
}- d% Z3 U0 V$ E9 l
9 [9 D: O/ J. ~" D
if (iedom||document.layers){1 [. O! `- N) l0 ?0 I
with (document){
* b' w3 F+ A' \( I) \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  D9 n, \5 Q' b" K1 |8 d5 Hif (iedom){
/ C' D( G+ x, W0 c) Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- Z1 ?+ A1 q, H( Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  g, a; n8 C6 \( @  G# gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 x. F2 ]5 J. U3 x3 G
write('</div>')2 |% L  p7 b( E% E
}
: u7 \: U% i  A1 R% q2 Lelse if (document.layers){5 T, {& c+ l, e0 z8 ?* ?/ a; J4 U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 U: l. g6 ]. b$ v: _) Y5 X. S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- q7 |+ w8 Y3 {, N# ^, g& @write('</ilayer>')9 @  f- A, T2 g- c
}1 N( |/ D( v+ Q" ]% t0 U! b' m
document.write('</td></table>')
/ }/ S& n1 L% a9 c- W& ~! M  t% k}) ^: J  L' f% u8 r
}2 l4 F8 \8 H/ \% y
</script>

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