返回列表 发帖

网页之跑马灯文字特效

//修改宽度& }% d& b" B! F- g5 F0 Z* z$ ^+ q, C
var marqueewidth=300* g+ u- J0 f  Q  c: |
//高度
- i) F+ t0 W0 T$ v. |9 Pvar marqueeheight=25
: D  M' o% ]2 b6 Y6 J' \+ |//速度(1-10)
/ H6 O# A0 c6 r8 ^5 Wvar marqueespeed=3
- q8 {6 P% E$ i" _1 g//背景颜色% c$ o- v: \* Z) |8 {; c4 q! |! |: a
var marqueebgcolor="#FFFFFF"6 w* w  m5 s5 R4 _9 b& N6 n
//是否能暂停 (0=no. 1=yes)?, x3 u# Z& \; V+ n
var pauseit=1
8 j, C7 b7 f9 y  L  w! Y- m( _2 R
//修改显示内容2 ?0 J9 c  Y0 Q6 _2 |9 Q8 [4 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 l. \& C1 j) G+ u) Y0 W
. V6 W8 M: V8 z& o5 Z9 a5 X

" X: }/ ~( o2 z- q0 P4 i////下面不需改变////////////
6 m. }5 e4 U4 q2 [) H
* e( G/ y/ t+ R# t9 @8 q$ |var copyspeed=marqueespeed) B5 ~( w& P$ {1 q9 a. u
var pausespeed=(pauseit==0)? copyspeed: 0; Y: _7 k  ^  h# U
var iedom=document.all||document.getElementById
  \0 r' J/ }1 s  z  l* hif (iedom)
. `2 T& A. L1 i. p7 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, }; M3 K6 n. i( [4 g1 Wvar actualwidth=''
* f  q* S4 ^& A7 K9 J; [6 ovar cross_marquee, ns_marquee' p: t: D/ B$ V/ i% a# b

' Z  f7 a. ~2 Y% f8 u( [3 qfunction populate(){
  e' N( b" g2 t. \! Nif (iedom){& Z4 y  Z& m7 b5 m: n+ J  d1 m; U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 F  S5 ~2 l4 q; `; fcross_marquee.style.left=marqueewidth+83 B2 h! Q, S' @8 z9 v! Q8 @6 c$ Y' [
cross_marquee.innerHTML=marqueecontent1 g. T" M. N! n" g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 B5 F, z7 N$ \0 Q' e; F}) ]# H7 b" _' X
else if (document.layers){
4 v7 o) R! F9 {. L% u$ Y  fns_marquee=document.ns_marquee.document.ns_marquee2& A. T! L$ M* i( I2 t
ns_marquee.left=marqueewidth+8
! p! I+ K: y& D$ [% Mns_marquee.document.write(marqueecontent)$ f' V$ i4 J0 R2 \, o' ^
ns_marquee.document.close(); ^% I* K9 m; w) n% Q
actualwidth=ns_marquee.document.width
# x0 n1 {# o6 o. }6 `/ Q}' b. M. w7 T* p# {9 @$ N& M/ {+ o
lefttime=setInterval("scrollmarquee()",20)
" Q2 ~* \. A: w; v9 I* {}. G3 a/ y" l5 f
window.onload=populate; O1 g) ~! k1 ^* n2 e; L& f

/ ?* a! V4 O- bfunction scrollmarquee(){
: v; i" I! {* S) |/ ?+ lif (iedom){4 t; i3 b  P: A% {' O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); U4 G8 H/ }/ `* X. L* T9 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 I3 O2 c  l( j" k7 ^4 l$ b5 helse: K. u, B; E' P. m# x4 s( Z
cross_marquee.style.left=marqueewidth+8( m/ r# b# l( {( A8 ?

1 h& n/ d6 C  e) ~* x, _/ O}- f2 Z) i6 ~6 @% S' _
else if (document.layers){
9 F5 E& L/ o4 Z- `" c" zif (ns_marquee.left>(actualwidth*(-1)+8))9 G1 C2 h' A+ O9 e$ h5 H7 M9 w
ns_marquee.left-=copyspeed2 H# H; \: e4 F: s' g% S: @
else
$ p) K2 X( S5 w8 g6 Y8 n$ A) p" Ans_marquee.left=marqueewidth+8( Z! ^3 P( e4 E+ V- o- S
}" S# b3 \6 B" j8 G1 u. c/ x$ P
}
% p% k. Z; w& S6 _7 s" v. @8 H0 T  w# ?/ _4 X: |
if (iedom||document.layers){  y) E) s  i3 `  Z' {4 m& s
with (document){" @$ g) T6 j2 q4 F, d1 ]& }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, i6 [+ S( U; |8 L6 z: jif (iedom){
* v6 K, s/ Z% x- bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 X* I" N/ z9 c! I- L- h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 \9 o" X9 k" M% w4 L$ @; Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! V* a, _8 |2 |7 j4 q
write('</div>')
3 J0 k6 ~) {. a* H}
8 H; N6 C/ A  p6 A; ]  relse if (document.layers){
' d& X; k3 ]1 W# G# F* uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 g& T/ Q8 R. [! a% _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' l! q" K8 Q% b+ F
write('</ilayer>')
# ?6 f* J4 o( J7 ?; _}
4 F9 z& [4 X: M5 w5 t1 J2 e% Wdocument.write('</td></table>')' I7 c1 @, b( z- _8 ^7 \
}3 I% _3 F" Y9 B. @
}
  H( v3 L" L3 e+ ]8 h</script>

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