返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 M; Z$ b7 x6 d5 z8 `var marqueewidth=3008 ~9 ?* h- }9 ]% P( `$ n
//高度7 O5 P7 G$ y! o5 G
var marqueeheight=25
9 T0 n6 f/ T+ X! w6 ^//速度(1-10), \* Q, H  {! |' ]+ l3 J
var marqueespeed=3
! x$ x  Q, R7 l7 U7 n6 d1 S9 t//背景颜色
5 }) j+ Q6 [( v4 y3 Yvar marqueebgcolor="#FFFFFF"
- ~& X+ j4 X/ @( f% E. S3 @" i; O//是否能暂停 (0=no. 1=yes)?
. l# A5 j0 m# Q" ?6 C3 h! w* X, qvar pauseit=1
+ D. O; [8 O  z% f. Y' w* f) j9 N9 R- G9 F" R1 o0 d* O6 m
//修改显示内容
/ B! Q1 w. ]. S: E/ Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ?+ }* y+ m5 r) d; w" r
7 e4 r% Y' t  M8 A/ `
* M9 p) O$ K* |1 r! p, ~9 z
////下面不需改变////////////! ^) J9 g  u3 s# s: K. d

  a8 u$ x7 _; {  nvar copyspeed=marqueespeed- G4 E6 x4 |4 v( d
var pausespeed=(pauseit==0)? copyspeed: 0' B1 j! A  X3 Z1 z: `$ C/ ~
var iedom=document.all||document.getElementById, k0 n7 R. ]* n9 G# E
if (iedom); _) E$ H. {% E! h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% j3 B: h: o: w2 m
var actualwidth=''
* M2 W" V% U9 e/ d+ mvar cross_marquee, ns_marquee
& M* e- b8 q: g! \/ P* T$ q0 M' f% b5 Y, Q: M% {
function populate(){! Q# V7 z% D$ w- T! a8 I# P* o, @
if (iedom){0 J* h  @9 E+ o1 p6 r. v7 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 u, @* @" a) @% u- V% mcross_marquee.style.left=marqueewidth+8" R: j- |$ [* Z4 v" ^9 u
cross_marquee.innerHTML=marqueecontent
9 s- |, W2 N( o8 K2 R) Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- V1 a% U3 N% f- C" {' F) j+ N7 t: B}, x9 K! @$ @! n/ o
else if (document.layers){
9 t( x4 Q- Q9 q* j* M# C6 `) B$ [ns_marquee=document.ns_marquee.document.ns_marquee2( l+ R* K6 A2 _: ^+ Z3 H. @+ `0 S1 i
ns_marquee.left=marqueewidth+8
: @" ~1 P9 ^2 h6 M: ?. Z# ^ns_marquee.document.write(marqueecontent)
1 y" a, h( e9 @2 Dns_marquee.document.close()
, {& g  J$ ^7 ?% o. q/ q' kactualwidth=ns_marquee.document.width
( p, A0 Y) a8 U' y}5 Y/ U0 ^' l5 d0 V) ]. `
lefttime=setInterval("scrollmarquee()",20)
# o  `" m% M2 s) n}+ a% D' R) v9 ^* S
window.onload=populate0 O$ y6 @/ O6 l7 x
$ ^8 E4 @7 M  A0 S
function scrollmarquee(){
2 O4 G3 _  S' a- @5 Mif (iedom){# s! ]& C+ x& R; e( k. t  w/ \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) S+ Z- m5 h% J( Z) z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 s0 `0 o) m. y, A4 o
else
- O! G" s" v# Y# W5 I( dcross_marquee.style.left=marqueewidth+82 \0 a1 @$ k/ @) T: @

$ M$ v# q' G# V}( ^5 Q0 X# e3 p8 e+ U! T
else if (document.layers){
+ a5 t2 x  S7 \9 Aif (ns_marquee.left>(actualwidth*(-1)+8))
9 v& u5 T, _: Gns_marquee.left-=copyspeed
) f3 T6 j% x) t. o! q& eelse
. y" g- [2 w7 w) m7 M5 _- g: x' ons_marquee.left=marqueewidth+8
" q6 Y5 P0 Y: `( G& w}
5 y, _  f; c# s, S$ Z" B}$ o% I: g4 K$ i, h& `- d
1 ?2 f; }7 ?, s. h- b: V/ C
if (iedom||document.layers){4 `0 @9 z3 y7 m/ V) s4 w% h; a
with (document){
; s* M* c1 u; l* ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 f4 n) a. R* r) T
if (iedom){
, m$ U2 D; w; D% Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 J; e6 I. ]2 o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), E* w- s$ |% J+ j/ L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ x& }- G7 \% N7 O; D4 Lwrite('</div>')
7 t+ Z6 r/ C0 M}
, U  O$ S  u: ?0 G0 S+ h3 delse if (document.layers){# x5 P8 b: L; ]7 @6 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' w- N5 _9 @* I8 i0 C) \) _% r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ ~  U& {$ R3 t4 l: _; Qwrite('</ilayer>')
2 b  v+ }2 H; a: k2 T}
' \' B9 B2 i' w: N8 {. m! Ndocument.write('</td></table>')
2 q0 F: d, V5 D}
3 l7 k$ s, |0 V6 k* e9 W: X}
% I( f$ K+ i+ o! C+ `7 F* H</script>

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