<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>~SingleForum~无废话记录~ Topic: JS Array 操作~删除数组中某项</title>
<link>http://www.ll19.com/bb/</link>
<description>~19~记录点有用的好吗？少说废话少装b~</description>
<language>en</language>
<pubDate>Tue, 07 Feb 2012 08:53:08 +0000</pubDate>

<item>
<title>admin on "JS Array 操作~删除数组中某项"</title>
<link>http://www.ll19.com/bb/topic/68#post-68</link>
<pubDate>Tue, 14 Apr 2009 03:15:27 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">68@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;JS Array 操作~删除数组中某项&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljavascript-1"><a href="#" onclick="javascript:showPlainTxt('javascript-1'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span><br /><div id="javascript-1">
<div class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;Array.<span style="color: #006600;">prototype</span>.<span style="color: #006600;">del</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>n<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//n表示第几项，从0开始算起。&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>n &amp;#38;lt; <span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; else&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">slice</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span>, n<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">concat</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">slice</span><span style="color: #66cc66;">&#40;</span>n + <span style="color: #CC0000;color:#800000;">1</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;var test = <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span>, <span style="color: #CC0000;color:#800000;">1</span>, <span style="color: #CC0000;color:#800000;">2</span>, <span style="color: #CC0000;color:#800000;">3</span>, <span style="color: #CC0000;color:#800000;">4</span>, <span style="color: #CC0000;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">test = test.<span style="color: #006600;">del</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">//从0算起，这里也就是删除第4项。&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>test<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>

</channel>
</rss>

