|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度5 i9 v! a9 o I8 s
var marqueewidth=300
4 [4 E# }3 \2 Q" b, z. [0 l//高度5 F2 @9 Y( ^- g: H3 T
var marqueeheight=25' e! S: U, X) R2 C% q; L; j
//速度(1-10)' D3 M. K4 K5 y8 [
var marqueespeed=3
% k+ W% @0 W- ~# m" e//背景颜色
/ Z5 O/ N, e/ Yvar marqueebgcolor="#FFFFFF") O2 p' j. g" ~0 e; M
//是否能暂停 (0=no. 1=yes)?6 }! k7 O h' g4 H- T; e
var pauseit=1- y$ E3 ?; Z3 V6 T2 `" e2 K
) |* o5 A, g, O8 q) i# D: E; e
//修改显示内容
' ^0 U3 a3 C+ Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# x3 V2 \( \9 b S3 `& J
: i: k: |" R. q3 [* k' C& X0 Q: j% n! W- j; X' O$ t
////下面不需改变////////////
^% h1 E$ [- u [ D% o- g9 F' o$ `, L7 O1 H2 I5 {5 F J
var copyspeed=marqueespeed0 v0 Y- R0 E- \: _
var pausespeed=(pauseit==0)? copyspeed: 0% V _: \4 E2 R$ I
var iedom=document.all||document.getElementById0 q' L6 _: {8 l2 e, x! d
if (iedom)" M$ \- z7 z% [! N O9 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% z9 S& g: L# b& mvar actualwidth=''
/ @; V5 P# W' c1 ^+ {var cross_marquee, ns_marquee6 H- _+ v7 t2 {+ z
: ?9 J8 R7 H$ q0 ?; l5 V
function populate(){
. d; J* L0 C/ `if (iedom){
' O, H& t% p( ?* K6 Y+ ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) d m( {# z. `6 x$ o. R2 v
cross_marquee.style.left=marqueewidth+8
" D7 o4 E- G9 S. B( b2 m5 ~cross_marquee.innerHTML=marqueecontent
. H C: h6 b2 h! Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 Z0 \% f1 S. F) d1 t+ q- L
}
+ L6 ]. y( c3 k8 ?+ G1 J8 Telse if (document.layers){
' O% T9 g. d! X( ^6 n0 Y; J9 yns_marquee=document.ns_marquee.document.ns_marquee2
; v! q& c$ i' \ N( Xns_marquee.left=marqueewidth+8
, z% P1 F* K' L" C1 P. ?# O \- tns_marquee.document.write(marqueecontent)9 F# Y- J' N; l7 ~( X! w0 o, J
ns_marquee.document.close()
+ b% `% c0 W7 H! s+ X) \2 nactualwidth=ns_marquee.document.width
- H0 L2 C2 `: ]0 q}
) o3 M' R& c* I$ h2 }, C U1 Clefttime=setInterval("scrollmarquee()",20)
$ `" \0 u ^! a0 q- \}2 I0 ?1 F8 a; O8 v" Q
window.onload=populate0 X" _1 \$ Q/ V. o; r, ]. {* a
' f$ y' E8 n9 U* k0 }function scrollmarquee(){* W$ W& Y ]& I8 ~7 P
if (iedom){
0 l- d5 F4 }2 Z5 W1 e# I- Z; Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" T% G U7 V, L, a9 x. V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 o4 z( N3 |) m8 s/ Q- X, M
else
F( W) v# s: q2 Rcross_marquee.style.left=marqueewidth+84 T# @' ]; i8 k! l' R8 G
8 D: {1 c A J! E# f8 g}
6 L( g+ @$ R0 H$ N$ kelse if (document.layers){
5 R3 A1 @1 e! ~* Wif (ns_marquee.left>(actualwidth*(-1)+8))% |2 t! I" m2 ^0 Y- W* o' a
ns_marquee.left-=copyspeed' ^- H4 R5 x. T y/ N$ q9 s
else
+ i% a( U+ ]9 V& u: uns_marquee.left=marqueewidth+8
+ F5 [( G0 y7 n# t3 {1 b ~}! g# f. x$ u: g4 u3 p( ^5 ~. Z; g
}7 M2 \+ s$ |- ?2 l: N
! l' ]6 x2 w9 c* K- I, C1 aif (iedom||document.layers){
3 G/ ~; M. H; \! ~with (document){
1 V7 N9 d/ _; ~$ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" W0 c. y3 z: L e. Tif (iedom){% _9 f6 @" Q' `+ F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 q# Z$ m' i1 H t ~. d* Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 h+ C7 E1 G; l" X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 I! x/ t, v* r5 _# mwrite('</div>')
7 A6 p) i. H f2 c}
) W2 F! ^/ {- H9 f& ^, R# J. Belse if (document.layers){
$ y5 @) R7 L! f; e* A$ Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ Z9 w2 A9 C9 r. Q+ K% |, P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 h- L' o+ p6 f9 u
write('</ilayer>')
4 I5 S5 ]/ \8 J: s+ X4 T" \$ Y}' W0 j$ Z& @+ R. t+ `* _* W w
document.write('</td></table>')8 s# p# s3 |/ K1 G
}
% F6 a K. q* i) G# F' M4 W}' t$ y! Z3 M' P, Y0 B' Q5 Z
</script> |
|