返回列表 发帖

网页之跑马灯文字特效

//修改宽度. H. Y5 z# z( S5 M% U
var marqueewidth=300/ b2 ~% `% G6 _6 A' y
//高度' X4 b1 _3 R3 R8 ?/ C
var marqueeheight=25
: m! m$ x# `$ e) g) l+ _//速度(1-10)
0 D/ Y3 m! i5 c4 `8 y7 _var marqueespeed=3
: K* N; \" B" u' W//背景颜色" @  ]$ U8 b* l! A: {+ b3 _
var marqueebgcolor="#FFFFFF"  |! w) W  `( U+ T8 [- Q# G7 @
//是否能暂停 (0=no. 1=yes)?
" j% Z2 _5 p- Evar pauseit=18 _. a( ]$ f, }* K: b

, s: s( A$ ?# S+ [5 S. q//修改显示内容7 w: e0 f0 H9 D+ ^8 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& E8 ^% o2 O& A
+ r5 V+ j5 m2 ~) d# H9 K" ?- u: J; ]0 R9 X, i$ B
////下面不需改变////////////# b0 `8 q0 M; z' S
; V4 Z' ~8 X/ ]" y
var copyspeed=marqueespeed
4 C6 N1 x- n( z; I) N5 M) v; [var pausespeed=(pauseit==0)? copyspeed: 0
" i; z) w! h- I6 v2 }8 ]! }  Jvar iedom=document.all||document.getElementById
$ V5 g4 q1 E' @$ @if (iedom)* q- t: H! b; ~! `# `4 u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* L: U# c# S" ]2 D( ~var actualwidth=''+ k) s, D# T  O% _; ]( \. R0 g' e
var cross_marquee, ns_marquee
4 n8 D+ _3 {3 n
) B5 z" P6 ~- V. C$ jfunction populate(){/ D$ k" B  i% c  f" W2 R
if (iedom){5 f5 N1 I! E' y- A1 i9 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 T' `: \5 k3 V6 @1 H
cross_marquee.style.left=marqueewidth+8
/ h2 s: O0 w9 [! U$ j* S. Ncross_marquee.innerHTML=marqueecontent
4 T6 G8 X3 L) e* u1 w5 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; k6 ]% u  _* c9 I6 o( @' F
}
' ~* F' A; B8 {3 |+ `else if (document.layers){
7 ]8 }/ A; q$ w6 Cns_marquee=document.ns_marquee.document.ns_marquee2. t$ y% h( e3 {/ h- z: q
ns_marquee.left=marqueewidth+86 A, m) n6 e% d0 l& K) W9 o6 `
ns_marquee.document.write(marqueecontent)& y0 z5 b! S+ p" H. Q2 h: u. r4 P
ns_marquee.document.close()1 j% ?4 o4 o! z6 I* E/ ?: r% Q! V) k
actualwidth=ns_marquee.document.width% o7 U: ~1 W8 K; }: L$ k5 o
}' \# C/ [" s1 W6 n9 C9 j& F% p* M6 T1 A
lefttime=setInterval("scrollmarquee()",20). {) ]/ r' X" a0 U
}
; o5 X& ^- P6 ~! L' |0 C% b; N' k6 X$ Nwindow.onload=populate
2 k8 n  j6 W8 H; m( W* x+ S, O8 b7 o3 }: h; E
function scrollmarquee(){
  I% ^0 r9 q# u$ M+ e% d1 rif (iedom){/ E& J8 w0 f  y+ w. w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" f" @4 W. ^" \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ s1 D( j2 Z, r2 N* [* @else* N' a: D& m; v' A
cross_marquee.style.left=marqueewidth+86 Z4 J2 x( o9 M

. t& r- i7 s. x2 U( i. _5 h}
2 e" A( G5 r" b0 u' velse if (document.layers){* s, o8 }6 J9 z6 y  V% d
if (ns_marquee.left>(actualwidth*(-1)+8))4 [: d5 r$ S4 F0 o3 V/ d& ^
ns_marquee.left-=copyspeed
5 P7 d$ \! X% b5 i4 Telse% }" f$ {* p) v# W8 P
ns_marquee.left=marqueewidth+8+ L1 W: z4 h& J# }  u
}
3 U' C% U8 U- \1 V% y4 y' `. a}1 m5 Y" w( L7 U3 q9 f! I! A

/ i- ^' |7 B; Nif (iedom||document.layers){
" L' q7 l1 |/ h, S/ d7 r/ D1 Qwith (document){
3 @8 j6 L6 |4 y+ d  \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 ?# e) l  g0 z! {) M# A  q: O% }if (iedom){
" M3 }3 Q; Y6 p, e! ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; p7 C* @9 F0 `5 A7 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 x3 R9 s6 A/ @2 J$ O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 _  ]. W$ v5 ]9 i9 ewrite('</div>')
, _) M( o- L; v3 L7 ?/ d}
1 I9 c  x& q9 R8 W" _else if (document.layers){  h' X9 Q1 f  \( r8 ]$ u: \1 g5 o1 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% C8 E4 z7 S8 t( @) A7 G- a$ rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  d) }9 T( o- o/ W8 y
write('</ilayer>')
! G0 ?1 S0 K0 H) ]' Q5 |$ _# g}8 M; D3 g- D1 L2 l
document.write('</td></table>')& m$ L; b; g0 D3 W. `. m5 \
}
' P9 j; P1 v, h0 b6 }1 H3 T" ~! ^}
; Y2 p! r2 `; U; A; G2 I</script>

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