返回列表 发帖

网页之跑马灯文字特效

//修改宽度; B2 a4 s# ]- k0 Y
var marqueewidth=300
2 L) l# d* _3 F3 @2 ]//高度  e# }) f$ k7 E, J- {' h1 z- h1 a
var marqueeheight=25- e% C7 O9 A. K) b
//速度(1-10)
5 I3 z0 F, B1 s" e* Y0 Fvar marqueespeed=3
( t9 V; @& S$ h2 s$ E7 W$ G0 ^//背景颜色
* \" _; q0 [0 X4 f7 r' k* |/ Fvar marqueebgcolor="#FFFFFF"
; ?! r* A4 e/ A+ d//是否能暂停 (0=no. 1=yes)?/ k( C- u0 y$ [+ r1 G$ ]
var pauseit=1
& N4 t" ~& M3 r+ k
0 W% p0 W  E; T: B/ t$ l2 [//修改显示内容! t. n) x- k' T* [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ u( F. l8 @5 M+ ~
8 W8 q" U5 {6 V5 ^( J) c9 g4 N% ]4 N% t( [6 W' S9 n# g
////下面不需改变////////////
$ S4 n. O( s/ M- r  b% g9 B( C" ?7 X$ _2 E0 n0 {' G  L" n
var copyspeed=marqueespeed
0 B7 \* V2 v, [+ e) A2 }( F, wvar pausespeed=(pauseit==0)? copyspeed: 0
0 F8 j0 z) \6 L% W3 t4 _9 hvar iedom=document.all||document.getElementById: X( b1 O( J8 `- t$ M. _/ i
if (iedom)
( h: r/ c5 {; y, W$ K+ ?5 H) I0 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' o8 M3 Z1 |5 r0 M2 H/ cvar actualwidth=''. n6 H' V) `. S8 _+ ^3 h: C  i
var cross_marquee, ns_marquee
9 n1 n  I2 H6 ?
& r! h- W3 G: R6 e2 b6 Pfunction populate(){
7 S, |: G7 O4 b9 v. u! s, [2 b5 r4 c2 Oif (iedom){
- ^) G$ B7 M- H6 B& Q8 r2 B+ n$ dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, _' y/ n9 b  j* p, J3 v# O# R. Ncross_marquee.style.left=marqueewidth+8+ d# M, _8 C8 u/ b$ K+ e" L3 J
cross_marquee.innerHTML=marqueecontent" w. x  [4 A1 _) }4 u9 a& W  ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 ~7 Q! ^( e. l7 s, Q}
2 w$ u, ?: D# w. d5 |else if (document.layers){) k8 J% X! X: l, o& A; Q
ns_marquee=document.ns_marquee.document.ns_marquee2
; H# m5 x0 Q' m: \ns_marquee.left=marqueewidth+8; ~! v3 l5 \1 w; ^, v
ns_marquee.document.write(marqueecontent)
! ~  k# q- _  u( P7 E( Qns_marquee.document.close()5 ]1 s' T3 l' ^8 Y2 K/ x# C
actualwidth=ns_marquee.document.width
8 ?9 t0 t0 ^! H$ R5 P}
( c, h2 O2 n' s  E5 S0 qlefttime=setInterval("scrollmarquee()",20)
1 G! T* r# [+ t6 V; S}
0 \. S0 O% |8 I2 F2 s. W* Z  \window.onload=populate
2 L" {* F8 H7 p6 l& F; ]  d& q3 B& p/ h. j: X! O1 g* ?1 o, u2 E
function scrollmarquee(){
* O0 V* i+ E# @3 U* \$ Qif (iedom){
) }' L# }& f- H7 _1 F3 u: o4 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( {- m  z; C3 x4 y3 _! ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* [1 o' w5 `2 Y, Z) i; l4 c
else# Q$ N& Y% D5 e' L6 U4 `
cross_marquee.style.left=marqueewidth+8* O. I+ I& c% h) w
% W  _* d/ ~% n; o& G* i
}" H. {! c4 W2 Y" i9 y- Y
else if (document.layers){/ v6 b9 E' ]. ?- b* Y
if (ns_marquee.left>(actualwidth*(-1)+8))& E5 ~0 c* e6 ?
ns_marquee.left-=copyspeed$ G7 c  w7 a9 a4 [6 ~+ M6 y+ n
else! m9 h# d* l  K9 d! K; v2 B# V
ns_marquee.left=marqueewidth+8
) H% f. Y2 x, `: B, K) s6 ?}
8 V$ V, t& J) F8 g( b$ t3 {. {7 R}. Q0 n$ o; K3 q; G& r1 E0 s: ~

+ d9 H/ e. F& V5 Y7 Z/ E; {! xif (iedom||document.layers){  ?9 J7 R1 H4 V9 ^* M
with (document){
9 y" _, w# x. {7 {8 t+ sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ w' d5 d& k& ]( \2 j. {if (iedom){0 J7 {- W! s& i$ }* _7 F. I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- y- u% N) ?3 J$ l& s- x! Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 {8 V( {4 ~* i$ A; D' K# G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 e9 e: x) [, a- d$ V# ~
write('</div>')
8 H5 p3 k' _9 x1 C. q: _- d; u}8 }" l$ j# ?" N6 {9 I- t+ O' V8 \! h, w
else if (document.layers){" \6 k! P. h6 g. @- ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- D6 R  _5 p) H/ Y( @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" s. C% A* ?: H% x7 t  z
write('</ilayer>'). n) w, R5 v- P
}( P8 {5 }1 r: x6 c5 i6 ~
document.write('</td></table>')
0 }, ?& j1 y+ _  r}
+ _# s0 T4 ~4 r}
9 ?2 A" U0 G# s" I. o* E</script>

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