返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 K8 C4 ^+ I! n! U$ P3 V4 S7 b3 Z2 T% ]
var marqueewidth=300# R6 C+ [* T# a& B3 U% F) L& i( ?
//高度9 P+ y2 c; N! k$ r8 ^* U4 V
var marqueeheight=25" R7 |1 h) ]0 i9 }, q
//速度(1-10)
( L6 u: E0 W' _var marqueespeed=3
/ p$ o  }6 R5 D//背景颜色# |% N+ i( ?" \" s
var marqueebgcolor="#FFFFFF"
: M( ~# u3 m, k! [6 z1 n//是否能暂停 (0=no. 1=yes)?  `% B) s  g" P0 h
var pauseit=1! t8 j- d$ N, @# M5 I& g7 R7 `2 O

' I4 I& H2 K+ v7 z+ t//修改显示内容
0 p9 b/ S6 D0 A  e& o- l: }2 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') k; I% i- h7 j, }  P

$ r/ N$ u# F! I8 V' V% J' ]% L/ d
6 Q* {7 j" T. @- ^# k////下面不需改变////////////
) R% s% {% ?/ O. x! v' @, `  v+ R  i7 a# r" m/ m) u% |$ D
var copyspeed=marqueespeed
/ F# K: M7 d9 ?/ R' Ivar pausespeed=(pauseit==0)? copyspeed: 0
6 R; }3 S6 ]  ^var iedom=document.all||document.getElementById
) {% z3 E5 k& X" u: G4 ^& n6 `if (iedom)9 j+ G0 P# n' L8 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ A+ `$ _& I! p+ }
var actualwidth=''
3 D  R) _5 L5 N+ T8 d2 Gvar cross_marquee, ns_marquee
9 E3 |0 Z8 }4 |0 w$ F: J* M3 s+ D- g
function populate(){! @# s; Y4 ?- N$ f  f4 k$ a
if (iedom){9 K( `  {- |. \3 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ E) \4 D, c8 U7 u
cross_marquee.style.left=marqueewidth+8& q! Q! S  U* [5 v
cross_marquee.innerHTML=marqueecontent
$ R7 j8 f) f: R7 O0 C; q$ Y* Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ \$ W( R' a# w. D}  @7 L" F; v' |: |! _7 m3 I
else if (document.layers){
0 |! P2 _7 {; ons_marquee=document.ns_marquee.document.ns_marquee2
+ r2 @) |# K+ h' s* L3 ^ns_marquee.left=marqueewidth+8
" o& \% e- h+ `: \ns_marquee.document.write(marqueecontent)
6 ]' O9 n+ m4 t: Zns_marquee.document.close()( u3 O( C6 Z& i) ~- M
actualwidth=ns_marquee.document.width
3 c$ P: m: D' `7 _1 b2 R}
1 r% L: a, ?+ l: V. Jlefttime=setInterval("scrollmarquee()",20)( \( k- Z% i! j7 H
}; h' b0 }  \$ ~
window.onload=populate
) A4 Q; J1 k/ o/ H  p  K) K0 o% W, k1 D' |8 R/ ?
function scrollmarquee(){
0 O1 G4 M* R1 ]$ b: Z  h0 A6 U1 wif (iedom){
* G+ w3 j5 d/ ]& I/ q( ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 Q2 _: h3 F4 q% Z# Y0 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ V9 D% `0 e( e! h. r. _  belse
# i" I! Q( q/ _, Jcross_marquee.style.left=marqueewidth+8$ `; }) k. Q2 S7 c4 X* E! B, V5 _0 \
, b- ]6 N- d: t
}  K( _/ N$ D/ N+ [. ^+ p4 y' _
else if (document.layers){
, c8 V' k" x: `; c6 Cif (ns_marquee.left>(actualwidth*(-1)+8))2 {$ P- ~- ?7 N; k7 S9 {+ Z$ U
ns_marquee.left-=copyspeed# J/ h% M* h/ u8 S1 y
else; v: N7 y& e$ h
ns_marquee.left=marqueewidth+8/ n& w% `9 A2 ~; S2 r$ x2 V' Q
}. h2 E7 p# g* e% F
}
6 ~! Q% m+ v5 _: D0 G+ g0 @4 o7 \  q- Y( m
if (iedom||document.layers){; h, o7 G6 b5 I2 m0 E9 a
with (document){8 ^9 b) u( n, V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" ]% t& O2 v% C! z1 b# Oif (iedom){  L1 l9 \2 z" r: ~4 N% ~, j1 {/ |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, m4 n4 a9 c1 T/ d5 b2 Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 g4 j5 s" _$ M+ O0 z) W( ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 a0 B0 U' {, s, x7 S7 Ywrite('</div>')
% V9 q$ a: F# ^6 A' N, P}, r9 `4 S' X/ P. l! V
else if (document.layers){
# O1 |; o; m0 a. N- Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ M- Q' Z$ @" V: R$ {, _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  |2 e% D8 k$ ?7 ]8 P- O2 X5 swrite('</ilayer>')
3 I. R( E1 A; R" n$ U3 X: u; o, D}
. T0 g2 R, E: \document.write('</td></table>')- ^' }& ^2 i7 e% u$ n
}9 k  |; _" W1 |5 N- `1 }1 p8 A
}' Y5 T1 f4 B" u
</script>

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