<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>前端思考：专注前端开发，关注用户体验 &#187; 新鲜事</title>
	<atom:link href="http://www.artcss.com/archives/tag/%e6%96%b0%e9%b2%9c%e4%ba%8b/feed" rel="self" type="application/rss+xml" />
	<link>http://www.artcss.com</link>
	<description>一个像素的距离...</description>
	<lastBuildDate>Sat, 12 Feb 2011 03:34:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>仿校内新鲜事关闭效果</title>
		<link>http://www.artcss.com/archives/345.html</link>
		<comments>http://www.artcss.com/archives/345.html#comments</comments>
		<pubDate>Tue, 13 Oct 2009 05:22:23 +0000</pubDate>
		<dc:creator>Artcss</dc:creator>
				<category><![CDATA[个人随笔]]></category>
		<category><![CDATA[仿校内]]></category>
		<category><![CDATA[新鲜事]]></category>

		<guid isPermaLink="false">http://www.artskin.cn/blog/?p=345</guid>
		<description><![CDATA[校内网在当今大学生中一定都不陌生，我也是校内网的忠实用户。虽然我比较懒，在里边不太活跃，但感觉校内的许多细节做的还是挺人性化的。 今天就做一个“仿校内新鲜事”效果，主要是可以即时删除自己不想看的新鲜事。这里用两种方法实现， 先上效果图： 方法一： 主要用到的Js代码主要是 Download script.js1 removeChild&#40;this.parentNode&#41;; 点击下边运行看效果 &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62; &#60;meta name=&#34;author&#34; content=&#34;artskin@163.com,guliqiang&#34; /&#62; &#60;meta name=&#34;Keywords&#34; content=&#34;前端思考&#34; /&#62; &#60;meta content=&#34;all&#34; name=&#34;robots&#34; /&#62; &#60;title&#62;仿校内新鲜事效果&#124;&#124; 前端思考&#60;/title&#62; &#60;style type=&#34;text/css&#34;&#62; *{margin:0;padding:0;} body{padding:20px;} h4{height:26px;font-size:14px;} p.author,p.author a{width:400px;text-align:right;font-size:12px;color:#999;} #news{width:400px;padding-bottom:10px;font-size:14px;} #news a{color:#005EAC;text-decoration:none;margin:0 3px;} #news a:hover{text-decoration:underline;} #news li{ list-style:none;color:222px;border-bottom:1px [...]]]></description>
			<content:encoded><![CDATA[<p>校内网在当今大学生中一定都不陌生，我也是校内网的忠实用户。虽然我比较懒，在里边不太活跃，但感觉校内的许多细节做的还是挺人性化的。</p>
<p>今天就做一个“仿校内新鲜事”效果，主要是可以即时删除自己不想看的新鲜事。这里用两种方法实现，</p>
<p>先上效果图：</p>
<p><img src="http://www.artskin.cn/blog/wp-content/uploads/2009/10/xiaonei_news.png" alt="仿校内新鲜事" title="xiaonei_news" width="420" height="199" class="size-full wp-image-458" /></p>
<h4>方法一：</h4>
<p>主要用到的Js<span id="more-345"></span>代码主要是</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left2">Download <a href="http://www.artcss.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=345&amp;download=script.js">script.js</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3453"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p345code3"><pre class="javascript" style="font-family:Verdana;">removeChild<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #990000;">parentNode</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>点击下边运行看效果</p>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_gE2E8d">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;artskin@163.com,guliqiang&quot; /&gt;
&lt;meta name=&quot;Keywords&quot; content=&quot;前端思考&quot; /&gt;
&lt;meta content=&quot;all&quot; name=&quot;robots&quot; /&gt;
&lt;title&gt;仿校内新鲜事效果|| 前端思考&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
*{margin:0;padding:0;}
body{padding:20px;}
h4{height:26px;font-size:14px;}
p.author,p.author a{width:400px;text-align:right;font-size:12px;color:#999;}
#news{width:400px;padding-bottom:10px;font-size:14px;}
#news a{color:#005EAC;text-decoration:none;margin:0 3px;}
#news a:hover{text-decoration:underline;}
#news li{ list-style:none;color:222px;border-bottom:1px solid #e3eef8;margin-top:10px; line-height:150% }
#news span a{display:block;width:13px;height:14px;overflow:hidden;background:url(wp-content/uploads/test/img/btn.gif) no-repeat scroll -63px -420px;float:right;cursor:pointer}
#news span a:hover{background:url(wp-content/uploads/test/img/btn.gif) no-repeat scroll -63px -435px;}
em{display:block;float:left;width:16px;height:16px;margin-right:5px;background:url(wp-content/uploads/test/img/apptop100.png)}
em.share{background-position:0 -64px;}
em.photo{background-position:0 0;}
em.msg{background-position:0 -351px;}
em.vote{background-position:0 -126px;}
em.game{background-position:0 -223px;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function news(id){
	var oNews = document.getElementById(id)
	var spanList = oNews.getElementsByTagName(&quot;span&quot;);
	for (var i=0,j=spanList.length;i&lt;j;i++){
		spanList[i].onclick = function(){
		  this.parentNode.parentNode.removeChild(this.parentNode);
		}
	}
}
window.onload = function(){
	news(&quot;news&quot;)
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h4&gt;校内新鲜事&lt;/h4&gt;
&lt;ul id=&quot;news&quot;&gt;
	&lt;li&gt;&lt;em class=&quot;msg&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;js小强&lt;/a&gt;更新状态&lt;a href=&quot;#&quot;&gt;终于熬到放假啦！&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;share&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;artskin&lt;/a&gt;分享&lt;a href=&quot;#&quot;&gt;大学生必做的10件事！&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;photo&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;小谷哥哥&lt;/a&gt;上传5张照片至&lt;a href=&quot;#&quot;&gt;Google年会&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;vote&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;蓝色理想&lt;/a&gt;发起投票&lt;a href=&quot;#&quot;&gt;买不起房子就不能结婚了吗？&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;game&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;你的好友&lt;a href=&quot;#&quot;&gt;喜洋洋&lt;/a&gt;邀请你安装&lt;a href=&quot;#&quot;&gt;德克萨斯扑克牌&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;author&quot;&gt;[ made by:&lt;a href=&quot;http://www.artskin.cn/blog&quot;&gt;前端思考&lt;/a&gt; ]&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_gE2E8d');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_gE2E8d');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<h4>方法二：</h4>
<p>主要用到的Js代码主要是</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left2">Download <a href="http://www.artcss.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=345&amp;download=script.js">script.js</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3454"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p345code4"><pre class="javascript" style="font-family:Verdana;"><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #990000;">parentNode</span>.<span style="color: #990000;">style</span>.<span style="color: #990000;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>点击下边运行看效果</p>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_Ugh1EX">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;artskin@163.com,guliqiang&quot; /&gt;
&lt;meta name=&quot;Keywords&quot; content=&quot;前端思考&quot; /&gt;
&lt;meta content=&quot;all&quot; name=&quot;robots&quot; /&gt;
&lt;title&gt;仿校内新鲜事效果|| 前端思考&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
*{margin:0;padding:0;}
body{padding:20px;}
h4{height:26px;font-size:14px;}
p.author,p.author a{width:400px;text-align:right;font-size:12px;color:#999;}
#news{width:400px;padding-bottom:10px;font-size:14px;}
#news a{color:#005EAC;text-decoration:none;margin:0 3px;}
#news a:hover{text-decoration:underline;}
#news li{ list-style:none;color:222px;border-bottom:1px solid #e3eef8;margin-top:10px; line-height:150% }
#news span a{display:block;width:13px;height:14px;overflow:hidden;background:url(wp-content/uploads/test/img/btn.gif) no-repeat scroll -63px -420px;float:right;cursor:pointer}
#news span a:hover{background:url(wp-content/uploads/test/img/btn.gif) no-repeat scroll -63px -435px;}
em{display:block;float:left;width:16px;height:16px;margin-right:5px;background:url(wp-content/uploads/test/img/apptop100.png)}
em.share{background-position:0 -64px;}
em.photo{background-position:0 0;}
em.msg{background-position:0 -351px;}
em.vote{background-position:0 -126px;}
em.game{background-position:0 -223px;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function news(id){
	var oNews = document.getElementById(id)
	var spanList = oNews.getElementsByTagName(&quot;span&quot;);
	for (var i=0,j=spanList.length;i&lt;j;i++){
		spanList[i].onclick = function(){
			this.parentNode.style.display = &quot;none&quot;;
		}
	}
}
window.onload = function(){
	news(&quot;news&quot;)
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h4&gt;校内新鲜事&lt;/h4&gt;
&lt;ul id=&quot;news&quot;&gt;
	&lt;li&gt;&lt;em class=&quot;msg&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;js小强&lt;/a&gt;更新状态&lt;a href=&quot;#&quot;&gt;终于熬到放假啦！&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;share&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;artskin&lt;/a&gt;分享&lt;a href=&quot;#&quot;&gt;大学生必做的10件事！&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;photo&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;小谷哥哥&lt;/a&gt;上传5张照片至&lt;a href=&quot;#&quot;&gt;Google年会&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;vote&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;#&quot;&gt;蓝色理想&lt;/a&gt;发起投票&lt;a href=&quot;#&quot;&gt;买不起房子就不能结婚了吗？&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em class=&quot;game&quot;&gt;&lt;/em&gt;&lt;span&gt;&lt;a href=&quot;javascript:void(0);&quot;&gt;&lt;/a&gt;&lt;/span&gt;你的好友&lt;a href=&quot;#&quot;&gt;喜洋洋&lt;/a&gt;邀请你安装&lt;a href=&quot;#&quot;&gt;德克萨斯扑克牌&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;author&quot;&gt;[ made by:&lt;a href=&quot;http://www.artskin.cn/blog&quot;&gt;前端思考&lt;/a&gt; ]&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_Ugh1EX');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_Ugh1EX');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>至于这两种方法之间各有什么优劣我不是很清楚，望高手指点迷津&#8230;&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artcss.com/archives/345.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

