返回列表 发帖

网页之跑马灯文字特效

//修改宽度" i3 {! m# R: i5 w6 c
var marqueewidth=300. z8 E+ }1 J& ^2 y9 L; M
//高度7 W. a2 }& I# `
var marqueeheight=25: x/ o4 C! a0 S/ a8 A
//速度(1-10)2 P( D& w$ A+ n
var marqueespeed=3
; Z- A  s" H# y& Q//背景颜色
7 [9 w9 u8 w" c  W( M- Yvar marqueebgcolor="#FFFFFF"
0 j: g: V) j) `. a( [3 u//是否能暂停 (0=no. 1=yes)?
& J" ?9 \6 x4 c8 H9 }, m) V/ t* M7 x6 `var pauseit=15 {; T; C7 x7 O  c! \
7 n4 L, h7 ~! f  h1 d% }6 e
//修改显示内容* n3 d# J5 v# V2 @. a' G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* Q3 a6 M6 O+ r4 c' e
& z/ [4 r4 c, x
+ f# y: @: S  V, Y) `////下面不需改变////////////  L" T4 |& S$ m0 v' \2 Y

% o; W+ m% t$ Xvar copyspeed=marqueespeed3 |/ Z) g+ q# `/ F7 O% E! q0 H
var pausespeed=(pauseit==0)? copyspeed: 0- b6 `; p" L: ?  N
var iedom=document.all||document.getElementById( E4 e9 ^+ I( f# T" T
if (iedom)
% e/ `* s% U1 _" U4 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! ]. d  ?8 G4 W6 wvar actualwidth=''0 w' ^- [: \& [8 D, Q+ I
var cross_marquee, ns_marquee
8 M# B7 l: S/ y0 q5 N
* I7 i% t1 O: {& L0 Q  Bfunction populate(){
' w& f% z' `/ aif (iedom){
' z1 }+ Y$ D4 t/ U/ A$ Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 Z8 c3 t4 U3 k8 g4 v
cross_marquee.style.left=marqueewidth+8
/ Y6 y% Q2 ^5 N; \; p& ~9 lcross_marquee.innerHTML=marqueecontent$ Y: X7 [5 E0 E" ?  m/ z  J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% j# g4 E5 q' {3 k& v2 }
}
1 p( U; [! j0 Kelse if (document.layers){
& N  @6 A9 M- {4 Fns_marquee=document.ns_marquee.document.ns_marquee23 L! i' L% g+ c9 U2 e/ M
ns_marquee.left=marqueewidth+8
# ~  C; w: P* Y' x- ans_marquee.document.write(marqueecontent)
: C( Y& P; ?# s" \& [* e# ans_marquee.document.close()
  f% b' C" K3 G$ r, }: t  Cactualwidth=ns_marquee.document.width
! X+ Q  Q$ a% J' G7 o. }}4 q# L* U6 d+ f, j# @9 }3 F
lefttime=setInterval("scrollmarquee()",20)
! V/ M; j. L) ^}, y+ s6 S6 J6 x. {0 G
window.onload=populate" h/ |& x0 e3 h7 z& @) v

& c, A; [8 [2 Y1 k5 gfunction scrollmarquee(){
) F' ^& |. L, S* W# v- X1 `if (iedom){
0 I$ s% S3 e! L/ cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* M& s5 @4 V$ d: ^" q5 V5 D; Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- @0 s) r4 _8 x6 t$ N  V' w" L( f9 V
else- g8 b7 ^2 S* G1 X
cross_marquee.style.left=marqueewidth+8
8 ]& q; ?. g6 q3 h6 |; [
. S7 V  V; o2 @3 p  q0 y# E, K" F}/ L" J  I; p3 N/ y
else if (document.layers){
- C) M0 w( a: z: W7 B8 m/ ^/ tif (ns_marquee.left>(actualwidth*(-1)+8))0 |- r1 |7 E( }, H# r' p* l
ns_marquee.left-=copyspeed
! `4 ?- @4 A7 a; _; xelse  u  d: s' n! N* V4 I6 p
ns_marquee.left=marqueewidth+8* r7 U" y8 j) |% {( a- F
}; m( m) i8 I1 V9 b3 L2 c0 K/ m3 _
}" u' X5 r* h$ H; z! M) E
$ [- S' v3 u: K1 Y$ ~4 P& Q
if (iedom||document.layers){
5 E/ x# V4 ~& S: c' D* jwith (document){) H! o7 p8 L/ U8 E& M# a5 |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ L0 ]/ F6 I; V( ~0 O$ y" V" H# Iif (iedom){' i$ S  C' }$ P' r1 A, u  `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). T% q8 r! h+ {8 E+ ]" d! g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' ?4 Z' F8 K. C3 i; Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" c: i2 ?  ~* q4 h7 j- D5 J
write('</div>')
8 L5 z! n9 k0 D2 \% A0 Y5 \9 Z- Z}
1 G3 ]" r( Z+ t- @else if (document.layers){
& [" l0 q/ t8 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). ]1 r" b7 \- h4 y5 s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 u0 E0 F5 z6 K
write('</ilayer>')
9 a7 d! q8 X, X# j+ R$ d}2 ^' z- ?; Z8 C6 G" Q, D7 n
document.write('</td></table>')
2 F' J* C4 h& T  w' L- U}# v% E* @8 Z2 C" U% t  W" G
}
( B4 T- r- F: j3 B7 O</script>

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