|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
. S8 j+ P5 s4 z5 r5 l) W/ M' A* ?var marqueewidth=300' |( o6 a9 Z$ i$ X& L' Y- O" `
//高度. J- b0 I! W" c1 U1 ?
var marqueeheight=255 j. k+ A0 m/ t' G# N# J, P( {
//速度(1-10)
: e; ^/ L) u+ u' H% L1 Gvar marqueespeed=3$ o3 a$ k3 b* A$ u1 u
//背景颜色
; J8 Z( x, U: p& ]. c6 \5 vvar marqueebgcolor="#FFFFFF"
$ E7 ~7 G/ V. d" [8 X- Q% k//是否能暂停 (0=no. 1=yes)?
% }) ^1 T6 u, Z0 g) ovar pauseit=1
4 ]& l- g; m j; u) R& q
6 f% t# \* x$ x! {7 u& d//修改显示内容( N& q4 N+ d% x0 y3 m) ~! H. Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ i g+ h2 I+ @/ D Z
+ E1 z0 _/ K) U0 ~4 r& p v+ q3 W; z u4 c) x
////下面不需改变////////////
4 p4 E5 b9 @3 x
: U. l( `; I$ nvar copyspeed=marqueespeed
( W. m; U9 w. H1 K5 zvar pausespeed=(pauseit==0)? copyspeed: 00 {1 z3 Y; d) R* i: E
var iedom=document.all||document.getElementById- M% [% Y, V' P9 m
if (iedom)+ J; O: l8 R' B! M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' b5 t0 B! O# P* @. R
var actualwidth=''& Y! W! m+ v# O7 w$ ~! ?
var cross_marquee, ns_marquee5 z' J. U5 \' K8 R
2 j6 A' r N$ ~2 E
function populate(){
- w# H/ F" V* }1 c( n- e+ E9 I& d d( x) kif (iedom){
9 p6 p' g- M2 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ P; A; l# T# @* T( s" {* W
cross_marquee.style.left=marqueewidth+8, \3 l% L4 d% n# }- R* ]0 ]
cross_marquee.innerHTML=marqueecontent
F" G$ r9 g. K5 W8 G% Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ T x9 I2 f) g
}1 T }. r6 I9 C/ K
else if (document.layers){
$ ?0 W+ N% l* l$ h0 }# qns_marquee=document.ns_marquee.document.ns_marquee26 f: l1 A- P1 o- B7 Y, h( p+ L: j; p
ns_marquee.left=marqueewidth+8
! l5 V/ T/ ]7 \( w j- i; |7 Fns_marquee.document.write(marqueecontent), ^' I3 y8 a+ Y
ns_marquee.document.close()' ]: F3 _* e7 N% D! v( W- u
actualwidth=ns_marquee.document.width+ R* ? [$ C& @
}2 [$ r/ I7 T/ [% V4 T9 b
lefttime=setInterval("scrollmarquee()",20)4 S5 E5 i* b" c$ ]4 A: U
}
* h e I7 l1 Y `window.onload=populate: S5 J) b. n% {- L
1 ?9 P; ~/ f8 L
function scrollmarquee(){+ t& U% ~5 ]: D1 T$ C; p- t- h( L
if (iedom){- J& p7 Y& V3 f# q# `3 h H# ~) x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- p0 s: B3 u' l5 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ y q( e0 r ?7 d3 M; t T5 O. ~else6 T. @) T. p: i ^4 |1 [8 t2 f
cross_marquee.style.left=marqueewidth+84 m& @0 p. Z( B4 X. H
$ q/ a" V1 m. b7 \) n- @( n4 a
}4 o2 v2 Y% A6 h4 p/ O2 ?6 Y
else if (document.layers){
3 d& ^& c% X `if (ns_marquee.left>(actualwidth*(-1)+8))6 n0 v4 f( n+ t6 b
ns_marquee.left-=copyspeed
4 ?# S/ Y" l( \else
# i8 a7 `; s! h3 _2 nns_marquee.left=marqueewidth+8
0 {, h" g$ ^; }0 D0 C}; M3 {( j7 T- K a
}
J& r9 h6 M6 J8 L# w5 E
, ?7 i N2 j. w2 i" uif (iedom||document.layers){& V: r$ q: b7 {) q1 t) t
with (document){
/ ]) ^9 r! `9 U6 \+ M. e( ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ G1 e& ?% ^6 s: X
if (iedom){
. [9 C2 K M0 }7 g4 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); u: n- o. k* w% H, J: e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), X$ e( ~: i" n0 n. r3 d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# f" R% B, [3 m3 R: l/ o' Jwrite('</div>')# a7 b: _/ A1 F* O* ~
}
* j& q# C( o; f& U, Lelse if (document.layers){6 F% m+ c! i3 Y- t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). h9 @, b; E. S9 j0 ^+ t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 e7 t# Y9 t' v+ Q& l* f
write('</ilayer>')
' W3 H* }( k( f, j3 o}
1 }2 W3 [0 A5 f0 f# v2 ~% a) `document.write('</td></table>'); S# c* Y" M" ?3 F+ |
}! ~/ `- q3 G( C" Y
}
* h6 R! g7 ^ _, R& N4 B</script> |
|