返回列表 发帖

网页之跑马灯文字特效

//修改宽度- S9 w' T* n: X7 u2 I# |/ L
var marqueewidth=300
7 f4 d8 D: k) N1 |" z//高度) U. _. p' |9 V6 A& `' Q  \
var marqueeheight=250 G) J7 p3 _/ E
//速度(1-10)4 N; D; t% ~" x; M) O
var marqueespeed=3
3 A1 b; Z2 _  r5 ?) `% _//背景颜色
" }4 v! u9 F& F4 q& X+ @var marqueebgcolor="#FFFFFF"
8 q  k) I8 h7 M//是否能暂停 (0=no. 1=yes)?* `- c* R8 J6 |8 H/ E9 v9 j: J/ m6 j
var pauseit=1, r$ ^1 z7 E: C! ^

1 |. |  |$ L& c/ r+ n6 ^" d//修改显示内容6 [6 e9 k7 y% F; {; y2 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', X) r! p5 u9 e. e
) y+ l* ~" y# b9 u% ?; q# N% Q
( n5 ~9 ?1 z( p
////下面不需改变////////////
4 g& ^  v! J4 a% j/ ]5 }7 C
- \# z7 X( D$ k6 h+ dvar copyspeed=marqueespeed! [9 m5 M( `4 ]' J+ R
var pausespeed=(pauseit==0)? copyspeed: 0* q. r# L% P  E: P; s# e
var iedom=document.all||document.getElementById
, Y$ h* F( p* H  E" Nif (iedom). `. x3 V: u* v1 j) O0 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% m$ |+ ]# f- vvar actualwidth=''- c8 C8 P5 z  {' z. F4 P# q
var cross_marquee, ns_marquee' a; w( @# X+ D$ ?

% ~7 t% B& l( g( [6 Y) A2 Cfunction populate(){
; C; t4 ?% u, {if (iedom){5 D" N, g0 _) p% H3 O. m# x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" N  c! @  Z/ i1 F% |3 E" Rcross_marquee.style.left=marqueewidth+8; X, W3 h7 Z, i" p% B. m$ b
cross_marquee.innerHTML=marqueecontent7 G3 O3 ^4 I* Q6 d! j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" {9 [) T4 R; c* E6 e  r5 c0 c
}
- W6 s) L! o$ z7 o! qelse if (document.layers){( H5 m- s" f, q6 R( A& [4 [1 r' T$ y
ns_marquee=document.ns_marquee.document.ns_marquee2. [  v* s6 [# O! l: ]% T
ns_marquee.left=marqueewidth+8; \! `) U) J8 Q# ?  Y: O! }
ns_marquee.document.write(marqueecontent)
/ I  ]3 n; ?  H0 N) `& W* ans_marquee.document.close()7 K0 z6 }' I) K. W1 C
actualwidth=ns_marquee.document.width
, d7 r) \* |* W1 k5 L}% O0 |; O* H2 U7 ~( p4 `$ y" x
lefttime=setInterval("scrollmarquee()",20)
/ I6 d0 x4 A  f/ S}
. T: d9 u7 m1 a, Wwindow.onload=populate
( V' H, L. S0 D  f& y$ p+ g% W. `6 \* l+ Y% Q
function scrollmarquee(){
( y* V# U9 m3 o. Z4 m/ gif (iedom){
5 E7 z& `# `1 O& j9 s) Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& W' ^1 B/ g' J; {0 B1 c; W1 B4 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 M4 r( ?$ \( n0 ]) Y
else
/ Z% t# [7 V0 D2 @cross_marquee.style.left=marqueewidth+8
7 P" a0 D6 x" \* p% N! I
6 q! w9 @5 x5 S! B7 M+ ~8 `}3 H1 l- v( y0 g/ D  Y! C9 |+ J
else if (document.layers){
/ o* z$ M3 g+ @5 ^2 ~4 r6 w# r! {if (ns_marquee.left>(actualwidth*(-1)+8))
& E- h7 r/ |5 y. {* \2 S/ Uns_marquee.left-=copyspeed
1 {: G5 m' I8 i$ v) ?else4 u9 k2 n8 N& L1 I: H/ }
ns_marquee.left=marqueewidth+8! F  ^2 Y: g& M# {! A* {" F
}1 M# d6 c2 A+ X2 p: p8 Y
}
. R( n& j) A; U' _0 Q' o+ {$ ]& i3 Z! E
if (iedom||document.layers){
5 z% r# N4 Q) U9 zwith (document){$ o. I. _; r% x% r0 g  K- Q2 }' f8 t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 j/ f' c# [) Z, iif (iedom){4 R. Z6 |. e6 Q( V5 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% s& A% r6 V2 R7 S% J, a  pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: i. r5 X7 J# {  \! S7 R8 uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). i3 P; `5 X  P2 k" o
write('</div>')
* E1 C/ U8 N; ^- K/ \6 C}3 A! D* U/ I' d
else if (document.layers){9 a& V' B( W& @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 E, P1 S" h2 u# L0 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). \8 G* j, n6 a) J# s: X( A& U7 {
write('</ilayer>')0 M$ D% N: r5 I( J* M$ b, v* E! u
}  s% w' w8 k6 O9 A
document.write('</td></table>')
$ w+ k7 U  d% j- s5 Z/ M}
$ \1 R( d3 R" o" X$ w) F}
: S( a8 a6 Y) F& F: e5 R% j</script>

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