返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 n0 m8 R% `9 j
var marqueewidth=300
& i/ j, l8 E: m; W- G//高度
, Y$ o6 b! L% Tvar marqueeheight=25' A/ ?' u( n* Q. I
//速度(1-10)2 `" v& ^& n, x
var marqueespeed=3
* O+ W  \" D' a- P7 @4 {1 W- ~//背景颜色
% ]" W1 v: |' |% d. @var marqueebgcolor="#FFFFFF"
1 `6 T/ ^# w! W5 p/ \' F; o//是否能暂停 (0=no. 1=yes)?
9 z- w0 g$ o, Evar pauseit=11 b2 a0 l: U$ C$ k; }

# O- l# `0 |$ W//修改显示内容: B* p) W; X# Y: _6 Y5 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; C; g4 f) v9 o- O5 R  d

. l/ k$ h5 n8 r" d# {( \/ Q% z
+ d# g4 p8 u9 }: J5 ]////下面不需改变////////////+ E) u- @# T* R! r0 p

6 d4 T3 N1 _- q' Fvar copyspeed=marqueespeed
' n: S) k" o0 j8 H8 C& `  Fvar pausespeed=(pauseit==0)? copyspeed: 0
4 N' f2 I; Z  r1 Z3 X1 mvar iedom=document.all||document.getElementById% U0 S, j  j4 y- x
if (iedom)
  t: n) i+ f/ P* Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 w- r/ n6 i  W) U: W3 K
var actualwidth='', H5 V" P* y7 Z' z3 D
var cross_marquee, ns_marquee
1 X' b, e% ^) T0 K4 T- w
& o0 i6 w% F! R& n& d) xfunction populate(){5 X0 i# d" U! T# ~3 N5 S$ k
if (iedom){: P7 d, ~9 z/ k9 K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 f5 q$ \; c. wcross_marquee.style.left=marqueewidth+8
7 ?2 B& k* L1 b! t5 Jcross_marquee.innerHTML=marqueecontent
: A5 T; O% O$ y3 f8 h& F" _( ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 H4 G1 k. v/ R. U
}
9 ~+ d+ k9 d& E0 k6 f+ Velse if (document.layers){
. P( ?; F# n' c7 nns_marquee=document.ns_marquee.document.ns_marquee2& {! ?2 P" D8 G3 B
ns_marquee.left=marqueewidth+86 o) r; [% Q: D5 E
ns_marquee.document.write(marqueecontent)
* j, v5 y0 J: n4 {ns_marquee.document.close()
( l$ k1 e- k( K* dactualwidth=ns_marquee.document.width
% r! z! _& D* [* F6 m}
+ I' s$ f7 ^! [% ~  L. Slefttime=setInterval("scrollmarquee()",20)% _; ?( x4 [" {) I: P! e
}
9 e* u4 a" i7 ^9 f' i+ Ewindow.onload=populate  y, f7 s) \. c) b0 a

, @: s& `) C5 B7 z% U4 ~* Hfunction scrollmarquee(){' q, X3 n0 Y' x; T
if (iedom){
% B5 L1 b9 }- D- p$ T4 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  n7 B. m: \$ d6 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) h: h& m, ]+ C+ Melse
$ p1 p) B# ^. K9 T# C) pcross_marquee.style.left=marqueewidth+8
; Q( @" ?1 x& V3 j
  `! O0 w/ i/ F0 W# l; W& B1 [* i" J}
7 L; h6 \9 N! p/ W$ l* d7 E% ielse if (document.layers){
; ?' e% f5 @$ C9 P; Yif (ns_marquee.left>(actualwidth*(-1)+8))9 f" n1 z0 f" N2 P# h
ns_marquee.left-=copyspeed3 U' j$ F. X* R) S
else# ~7 _! L( O9 g- K: \
ns_marquee.left=marqueewidth+8
% r, Y# q/ L7 E: I  {}+ @& b+ {2 m6 o. C; l+ h1 @
}
+ d' N6 V3 o1 v) ]
0 D( ]! M  g3 {5 S- z- Aif (iedom||document.layers){4 ?% y% L8 \. ^0 t) h7 m, {3 O
with (document){8 ]& c4 [# w  ]7 V4 j: D+ p8 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% t  \8 F+ h2 q1 Y
if (iedom){( }  R  E: E2 t' \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 S2 f( ~  d& [: P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: j$ C) ]$ g1 J! Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, a+ s- Z, E  O; \write('</div>')
! R& m* P* {- t3 ?! c}
. |& b/ U! T. R2 y) p/ e* Selse if (document.layers){! F% D4 c2 u3 r" _& P6 R5 I- G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 M( |  Y' U: w$ _; I% ^- g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 c& h/ ^) x, I- l% ~+ P4 i( N
write('</ilayer>')
. O2 G; u9 ?3 j+ n7 W}$ x7 G5 \) X* B+ t. ^
document.write('</td></table>'): L1 a% L7 `- \# X3 M1 C
}
' r3 b% H% O" R$ \1 r: o" G}# X; |# [) A* \2 z% X* q% W3 F
</script>

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