返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ q* X' [- F2 H5 K6 z
var marqueewidth=300
3 H7 y7 M8 g/ a- F7 f//高度" Q1 P5 T7 O. r* q6 g2 O0 t
var marqueeheight=25, h  f; w. ~5 g+ n: B+ u
//速度(1-10)+ z1 B" o( U( r' a& v5 U. h
var marqueespeed=3
$ L( n, z3 S+ [  h//背景颜色
) S: a( N; o( H- m" m2 ^var marqueebgcolor="#FFFFFF"9 d. q" ?, t9 D9 B! ~! n
//是否能暂停 (0=no. 1=yes)?
4 L! [# d' m- d* fvar pauseit=1
: ]( h; A0 C: e7 ?/ m6 |  c* p# x
! `( p" @/ o8 u  G- W' f//修改显示内容. X1 \! B6 j* X$ V; N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ s4 r3 U% Q$ R) y; X( g  w" ?0 x. [

# e3 ]# c) v2 t% y////下面不需改变////////////- |$ i. v; A7 b1 {+ Y7 H9 E

' ^; q) G! D/ d# U/ ovar copyspeed=marqueespeed0 C8 Z# W* Q: |: K/ _6 F4 `
var pausespeed=(pauseit==0)? copyspeed: 0
' M4 B* }0 ^" U3 L- ^: Hvar iedom=document.all||document.getElementById4 p( d( z5 ~/ a
if (iedom)
5 F' ]5 q. V' J& P2 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ }, L6 N5 E8 \1 Z9 e3 ^+ Y# ~+ ~
var actualwidth=''/ l/ s9 t9 K) b6 i3 Z* |
var cross_marquee, ns_marquee7 W- {' v: D5 d) o1 W5 Y- `
. `& P; d, A9 X* W7 _, C
function populate(){! ~, {3 p* B( q' p/ }
if (iedom){
: ]  ~8 B* ?2 D5 E) ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ W: E5 i2 Z. p7 m6 p/ Ccross_marquee.style.left=marqueewidth+8
4 @: S  l6 R* wcross_marquee.innerHTML=marqueecontent
5 f+ F) Y9 B5 ]$ ]" [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% D8 j9 t4 i$ K4 a}
5 G  U+ {7 f  i8 I8 ~  @else if (document.layers){
2 h- H  k. Q( ^9 H  k$ qns_marquee=document.ns_marquee.document.ns_marquee2# y' p; _0 z7 _1 A
ns_marquee.left=marqueewidth+8) k. B1 F: C8 a9 M. n6 p
ns_marquee.document.write(marqueecontent)9 W$ X0 [: r8 w3 d- p) m% C9 f1 D& w
ns_marquee.document.close()6 B  @$ f1 t6 \
actualwidth=ns_marquee.document.width5 H- O& T/ t  Q% n1 c: x
}% {! D- q3 L0 N* M/ x  e9 T
lefttime=setInterval("scrollmarquee()",20)
3 S4 N8 `) x/ E0 d$ t/ X}2 a( o; u- ?' V  m! P2 P+ i5 m1 b+ X
window.onload=populate
/ l+ i2 r' P8 e
. u+ q9 A. I5 d' q3 T0 W; Jfunction scrollmarquee(){
2 c- U  F9 D1 F" r6 r6 Xif (iedom){
9 {% a% b/ `1 s  P9 {0 oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ I) J/ S5 d, V0 B* lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' h, _  B) B$ O: M* `
else/ ~  l  o! m, w3 A; W+ _
cross_marquee.style.left=marqueewidth+8
  N/ j& l6 w" @. w7 d
  T# t( H7 s+ k' {2 N1 U}
. v/ G) V. O: \( G4 v$ u+ qelse if (document.layers){
4 H$ F' o! Y7 H3 |/ a1 j% pif (ns_marquee.left>(actualwidth*(-1)+8))
8 ]7 L% A& b/ ]! x' Bns_marquee.left-=copyspeed8 H, E( A& m2 a% `- |
else% v* _' x. y0 j" W! B) Q% z1 `
ns_marquee.left=marqueewidth+8! T: l: c; S+ C6 x( }2 T
}! I3 }% f4 V( U7 L3 X/ M! b
}
: ^: ~1 f! y/ l: q/ X% S5 y+ T, p) b3 h+ g! n. A8 h2 v6 m& r+ ]$ L: ]
if (iedom||document.layers){$ w1 p  m- n9 V9 C, l7 n) K
with (document){
5 l% T, N6 H! ^+ X. Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ F4 p, S! e/ Y0 x- {; G) N1 Cif (iedom){1 v9 \* t6 l. O3 O$ X0 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& R$ l4 I& V& r; ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! {  E7 u: H& N# F) r) Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! _+ }2 H$ c/ H- ^; |7 v
write('</div>')
% {; S) u: y! v! P& k}) |' ^2 q% e7 }' m7 |  k: ]( L
else if (document.layers){
( {% V3 C' d* T9 M% ?/ l; ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: V* L; x$ s3 l/ C- l' rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 |+ N& G& `* f  R0 K7 Z# {' ^9 uwrite('</ilayer>')
- t- w( C9 `$ g( b}
; U5 ?2 Y; k9 _document.write('</td></table>')0 A: i/ f8 s  [
}; p0 |7 ]* l% M( ^7 K3 H5 H
}
$ s5 Q1 ?0 G) r5 V( i1 K</script>

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