返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  k8 u' R9 t. e; S% [3 @var marqueewidth=300
$ F3 Q. Q! [  s$ P& p; X% A//高度4 p+ U  L2 i- T2 N+ o
var marqueeheight=259 Y2 n9 E9 s2 j0 S8 {+ V) a
//速度(1-10)
% [! {! {4 k3 {# m3 {/ c, tvar marqueespeed=3) A9 H% X( ]/ _- C9 @2 A' U; b
//背景颜色
: G& y1 H7 d" u  L; {var marqueebgcolor="#FFFFFF"
" [7 P: C- v. K7 a* M  u: U! |! a//是否能暂停 (0=no. 1=yes)?
4 q% D: A9 j' K* i0 c8 }1 Tvar pauseit=1
7 T' J' G+ W) _! z' K$ {, M! ?3 Y- c6 Z
3 J- d3 T/ z% H7 o) K//修改显示内容0 I  s5 [" o+ O8 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  v, q, v! L& f4 L8 |3 _  P/ r( u

( c8 j- s; B. ]! X////下面不需改变////////////* R( I' \% V7 X. _( H' ]' s

, N6 q0 N" c. [8 X3 m/ f7 Lvar copyspeed=marqueespeed
0 O+ @$ J$ o! O3 m* ^' Cvar pausespeed=(pauseit==0)? copyspeed: 0: i( v& y; L9 l! @9 a6 P& ?
var iedom=document.all||document.getElementById
( S) K0 _5 w: q& z# {7 b7 @if (iedom)
4 S) P! h: k1 ~7 D, d: m4 {( ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 C" J. U- j' {5 K# ^3 w; Mvar actualwidth=''
" C, G* @# E. U+ [var cross_marquee, ns_marquee. `3 U3 D+ z) M! N9 w; I# B

/ `; Q' x# f# O- e: [1 @function populate(){
& g: G8 D% R" ?if (iedom){
  E! L, i# i- a4 z1 i2 vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 X  O% k" F. J2 R+ R: y5 I: E
cross_marquee.style.left=marqueewidth+8
  z. G4 h$ G' M6 Ncross_marquee.innerHTML=marqueecontent$ U) H7 V  C. y( \6 R5 a4 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& c( |2 T8 T; r  K& c0 O4 U}7 Q4 x+ D4 J, J: A  G  `, x
else if (document.layers){
9 O4 k5 H- u2 U# H$ L( Q& e$ ens_marquee=document.ns_marquee.document.ns_marquee2
9 [0 |( ^2 h2 t# }- Kns_marquee.left=marqueewidth+84 o9 n, C" U# ~9 Z7 y- S" j) Q+ W
ns_marquee.document.write(marqueecontent)
. H9 b- G$ m. f$ Z( U+ w1 {ns_marquee.document.close()- p& Q% P! Q% x. |' }
actualwidth=ns_marquee.document.width
$ V0 T' M, V! V& q}' O/ N" ^5 B0 h; h1 X& T4 j& H
lefttime=setInterval("scrollmarquee()",20). K( ^/ z7 Y: @/ g
}
7 n/ l# U6 f' |% J; \) u1 Pwindow.onload=populate# C! l% f6 Q* X  i. Z% A' ]4 }& _
7 z) ~; ~/ P+ x( I4 i% P
function scrollmarquee(){
0 c( D3 p4 l$ i1 y0 Zif (iedom){
3 K/ ^7 W8 Z" P$ ~5 ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 }$ d" u5 Z2 _7 D5 w8 [) t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" [: ?' x" ~) v% ]else
" x+ r5 q) F+ V, Bcross_marquee.style.left=marqueewidth+8) h7 G0 F1 R% z

$ I$ N  [/ P, C. l6 I}
- G! [- u2 @7 f1 D- yelse if (document.layers){
. s2 [$ F* F5 T- \& S( ]' Jif (ns_marquee.left>(actualwidth*(-1)+8))$ y# o9 [" ?6 T! {+ \5 w
ns_marquee.left-=copyspeed8 l1 D, \) i- U/ g! R
else
: n$ U! i  f# p8 f: W7 |2 lns_marquee.left=marqueewidth+8
& Y' D* _1 q* ~. X8 x& {}
; g6 L! Y. o% j* S' x) `% I& L2 h}
! p+ H" F! T7 {; r6 O
* [" z7 E6 G* y% Y, B$ Uif (iedom||document.layers){
2 s+ T! {5 P; _6 T5 I3 Pwith (document){
- F# v' F) s  [4 f( z0 t1 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ b1 Q* }9 F) Z/ U2 s1 M
if (iedom){! f, W: K/ s8 U5 p7 `: r! ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  H2 i: M& G; }1 n, ~! }7 F$ Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 G6 n. G; G+ [* u& Q( y7 N, ]/ K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 J3 {* _4 d) @/ ]2 E' ]9 x& C
write('</div>')$ B  U7 L* n; b9 Q5 N
}
* q) I. i/ D3 Q+ g* a# J+ Zelse if (document.layers){
" W! t4 c: k# D1 d8 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& N6 t0 v9 Z' o$ f+ C- Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 E* w* I% P: K, G6 g; h5 zwrite('</ilayer>')0 N$ V1 D$ S3 b4 D1 p5 m5 M3 F
}
* [9 ?! b9 _, idocument.write('</td></table>')3 [8 ^! \9 e& X( F
}% M9 y; R# q" ]
}0 f8 n1 i# b" u8 w4 b
</script>

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