获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度' `' U2 R9 w& @" {7 a5 v
var marqueewidth=300
; |/ m; g1 ^* `+ k//高度; T8 J6 P$ w* O5 N: d1 S9 l
var marqueeheight=252 R0 _, a" c3 h3 C/ H$ N! ]
//速度(1-10)
, C1 F! ~, L) _5 c: `7 [+ W4 G# r/ Ivar marqueespeed=3
8 I6 V+ k% I/ U- k8 T/ x//背景颜色$ f$ _9 K' A, S# g; h& y
var marqueebgcolor="#FFFFFF"
# i5 |9 _/ k' ?5 ~( c) }5 v//是否能暂停 (0=no. 1=yes)?
- @" I+ H3 [3 @/ jvar pauseit=1
( g# ^4 |" |5 y" o3 l: O7 P
# W8 z/ e* T$ ]# U+ `1 A  @3 e//修改显示内容6 r; R- w: ~* p9 s. t' ^/ @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 e0 R+ F; j/ k: ?- `; B5 R' Z. b. S" x' p

8 o% N1 `* G$ ^: I$ i////下面不需改变////////////& \2 z6 M& [0 Y- f

- i4 P) D; ^$ l/ H+ u& W0 H! f" Wvar copyspeed=marqueespeed
, Q* Y# w& Z, Z3 n; W; p- [6 wvar pausespeed=(pauseit==0)? copyspeed: 0* F" q* Z. l2 D' ^
var iedom=document.all||document.getElementById
4 A+ y" P' F! f7 yif (iedom)4 B$ A- X% _7 Q3 l" K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' R) i0 l' \1 V' I+ N3 |var actualwidth=''
* ~/ A4 m- s# }var cross_marquee, ns_marquee
/ }  B9 p- ?/ P) _3 K7 ?
6 [/ ], ~8 q. d$ n% [9 efunction populate(){$ g0 e1 `. e# ?* U  {
if (iedom){5 h2 J& W) _$ Y/ {4 }% W5 s! S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; A& b, u* O' f) q1 }4 xcross_marquee.style.left=marqueewidth+8
) w2 s0 r- C! g- t2 d' ocross_marquee.innerHTML=marqueecontent
6 L) k+ l2 ^1 ^/ X+ Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& C( k# A4 T) K' K; B" w! F" U}
0 N+ e: ^7 r  W1 j5 Qelse if (document.layers){
. _( @9 [; x  T5 j6 Rns_marquee=document.ns_marquee.document.ns_marquee2
/ E9 b2 W7 ^& P! \& @& ?* I+ O6 U' @5 @ns_marquee.left=marqueewidth+8
' \3 \+ ]  I* [, {; f1 pns_marquee.document.write(marqueecontent)
  Q9 U& p/ A1 G: m9 ?* ons_marquee.document.close()
. F1 E, j$ v" m& o5 lactualwidth=ns_marquee.document.width& Q8 ?, [" H) y* Z- i
}
% Z/ y! _$ B5 l& i1 hlefttime=setInterval("scrollmarquee()",20)9 p" h; c6 a$ j  H
}) H0 W+ i1 U  F9 i" X  B1 R) j) S
window.onload=populate
# ?, ^; ~  A, S4 y: `+ M8 Q& y7 C5 X+ q8 q+ }2 [
function scrollmarquee(){
& o2 D- n  V6 v4 m) \if (iedom){
3 j' D2 E/ N5 F# K% [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, z4 t  S* {) @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' y- B* S7 H9 o. T+ F: S$ O+ s
else9 z& J- U$ B0 f
cross_marquee.style.left=marqueewidth+8
" ]( f8 p( y# @8 C3 J, a  o( C; q" y3 e
}
0 R9 n$ e2 g- a" U) e3 _else if (document.layers){; ^, [& o* P% b$ D$ \
if (ns_marquee.left>(actualwidth*(-1)+8))
' j" \7 ]) g: v* q3 E3 C: `+ C! gns_marquee.left-=copyspeed
4 F4 ?0 |4 _+ P0 Delse3 s# ~" d% `0 u8 ?# ]# V
ns_marquee.left=marqueewidth+8
; ?* M2 R8 K* \. l}. ]; ~2 U: S& |$ d: G+ j# y$ r
}* K" _* P! U* H! s, N3 f
- u, M9 ]+ l! y' d) i
if (iedom||document.layers){
* O: F& ]& H! j1 t+ {with (document){: J  i- D3 v7 f& U* G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- w( V. D2 \, x6 Aif (iedom){
2 M& U5 E" b9 ]& `0 ]# _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) i% k# n$ M, q3 Q! X  g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 N+ i9 j5 l- A+ A+ E4 }( ]  f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 m  Z. ^; J" ~& u* ^3 _6 I5 \$ h! i
write('</div>')
) g4 J/ p3 n+ z; R3 U* Q' G( K! t}* G. y) f% N) Q  y
else if (document.layers){
# u" O; `- G% i; j; L' rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* _* u7 r& H+ W! ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 g0 ?  d8 E2 d, `, V
write('</ilayer>')/ Q, h) b3 F, u, u. ^
}7 V  @' L  e6 n/ R) l
document.write('</td></table>')" [, I' \% e5 U  B( J% ]9 H, }4 N2 d. U
}
! K9 w. j) @0 j/ p& `8 M}
, O! `8 S: W  ~</script>

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