返回列表 发帖

网页之跑马灯文字特效

//修改宽度: z4 x4 \* u; g  }
var marqueewidth=300! J. a9 L( D5 L' d; Y
//高度  k# q# I% F* I& l
var marqueeheight=25# t! k2 Z# J. `( `$ u3 G- N* v
//速度(1-10)
; @3 w6 ]' p: T! c0 Z; uvar marqueespeed=3
7 V5 H6 Z5 O2 L- L//背景颜色) K7 a* c8 {! ~+ z3 t; ~
var marqueebgcolor="#FFFFFF"
, Y8 V0 _( S9 G. M//是否能暂停 (0=no. 1=yes)?
/ H! j+ V3 v. q, @var pauseit=13 j4 D+ u6 O$ \9 M& M8 q3 S1 I4 J
$ T6 T2 T( C* G3 L) l
//修改显示内容3 ?- G2 ?; C3 T/ a5 F" p9 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ j. Y2 X, b) p2 Y
0 E# q7 \- @1 C2 ?) q" Z# E
# g  b6 Q: U* _* U% L7 b8 T////下面不需改变////////////9 c' |, p0 U" E% d
, B0 n9 W9 d5 t  E
var copyspeed=marqueespeed8 V% i+ x8 n2 A! ?
var pausespeed=(pauseit==0)? copyspeed: 0' }( _3 }$ D9 B$ w! Y1 I
var iedom=document.all||document.getElementById
9 f$ }& C, y' d' Q. N1 fif (iedom)- a' \3 M5 g3 @9 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 `; w/ c5 b  Y* F
var actualwidth=''; J1 x: C# @0 }) ^2 j0 g! s
var cross_marquee, ns_marquee
8 E; ^" w& d& G& g2 {! X; r: ?; L! E$ E
function populate(){
% q8 u$ y' d" eif (iedom){! H5 \$ K5 @4 }! H& T, S( v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 R( |' ]6 f- A3 j
cross_marquee.style.left=marqueewidth+8
2 M3 P0 N- f! j" ?# K0 dcross_marquee.innerHTML=marqueecontent
( ]+ b3 N: A1 g# i& M5 A5 J! Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) z" A' ^9 U! i0 Z0 J8 @+ o}+ X. @- J# X$ t$ v+ w9 i+ w) G8 q
else if (document.layers){2 [# S1 J9 X5 W# ?- Q) E$ H, ^
ns_marquee=document.ns_marquee.document.ns_marquee2: f$ Y+ e. |" u* {1 y, N
ns_marquee.left=marqueewidth+85 A: ~, }" l; g0 K& ]# r6 O
ns_marquee.document.write(marqueecontent)7 K+ K- {# n0 d/ D9 w
ns_marquee.document.close(). O, \9 X9 Z1 b% |
actualwidth=ns_marquee.document.width
% G) W8 l  u; H5 a( m}
: z1 U# |  W* i9 }" x! \lefttime=setInterval("scrollmarquee()",20)
/ j9 M# m8 t4 r6 O8 G3 t3 {" O}1 z2 G' q& A) A: Y$ n
window.onload=populate0 n% @3 {' n$ h6 ]2 A
8 V  }1 p  r! i! n$ Z3 c& h
function scrollmarquee(){; v/ \% i2 L+ [2 }' w) T, H; f) r
if (iedom){
8 L. C6 x: y" s6 ?: c+ oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' {0 z4 r* Q# {! L" j2 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 Z! Q2 v* |  D9 e4 \else1 t; u- N2 Y2 i% M$ {* Q* Z
cross_marquee.style.left=marqueewidth+8
. R8 g, w3 \& ^- |4 ?$ \1 Z
& @$ H. p+ I" Z% I}
* ~/ Z( H( N2 O+ [7 p( U2 ^4 L: F4 Y) p5 aelse if (document.layers){
- t( Q4 ^. a, v# c- t) Jif (ns_marquee.left>(actualwidth*(-1)+8))
% [; `5 i4 D# d! F; Zns_marquee.left-=copyspeed
/ o  M! r* ~' S& ?. pelse
  G  t4 F: ]; E2 s+ C! }ns_marquee.left=marqueewidth+8
# I& q6 ]' B) V/ Q' S1 W1 A}
) g1 [8 H$ `. C: `, O}" i* ~  Y$ v3 Q/ ]$ ^7 q
: e: T" z/ I- ^6 Q
if (iedom||document.layers){
4 u) r2 I% q8 v' X8 Dwith (document){7 I% }$ _0 |- k+ a6 Q/ F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; q. w) K% g( \8 \! s9 Hif (iedom){+ e( H+ C, _5 @) s. |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): W& Q- j0 I7 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 ]6 U3 K/ S2 K" I( v" iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 F" j" Y7 [7 C3 P2 F: b
write('</div>')
+ R# \$ F8 l0 m' B4 \}
0 `) ^3 o! ^+ P0 Gelse if (document.layers){
! d3 |2 Z' v2 C% F3 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 d$ G- e' O  u9 z$ N/ rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 q( B. g6 B3 D% f7 E
write('</ilayer>')
- y; {& \8 F/ k}0 T; G( h6 U/ R  Z9 |- z
document.write('</td></table>')
% k3 _$ |- T/ _}
! f( c: `; A/ Q  P$ Q" o}
* C( ]; i) Y% R0 \) r6 T</script>

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