<?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/%e5%9b%be%e7%89%87%e5%88%87%e6%8d%a2/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>一步一步学习js，仿火星首页“今日推荐”</title>
		<link>http://www.artcss.com/archives/259.html</link>
		<comments>http://www.artcss.com/archives/259.html#comments</comments>
		<pubDate>Sun, 27 Sep 2009 16:09:59 +0000</pubDate>
		<dc:creator>Artcss</dc:creator>
				<category><![CDATA[个人随笔]]></category>
		<category><![CDATA[今日推荐]]></category>
		<category><![CDATA[仿火星]]></category>
		<category><![CDATA[图片切换]]></category>

		<guid isPermaLink="false">http://www.artskin.cn/blog/?p=259</guid>
		<description><![CDATA[看了《javascript高级程序设计》有一个多月了，感觉应该用js写个系统点的例子了，正好今天不太忙，就用js仿一下火星首页“今日推荐”模块吧。 样子如图所示： JavaScript代码如下： Download script.js1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 [...]]]></description>
			<content:encoded><![CDATA[<p>看了《javascript高级程序设计》有一个多月了，感觉应该用js写个系统点的例子了，正好今天不太忙，就用js仿一下火星首页“今日推荐”模块吧。</p>
<p>样子如图所示：</p>
<p><a href="http://www.artskin.cn/blog/wp-content/uploads/2009/09/hxsd.jpg"><img src="http://www.artskin.cn/blog/wp-content/uploads/2009/09/hxsd.jpg" alt="hxsd" title="hxsd" width="592" height="240" class="alignnone size-full wp-image-287" /></a></p>
<h4>JavaScript代码如下：</h4>

<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=259&amp;download=script.js">script.js</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2592"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code" id="p259code2"><pre class="javascript" style="font-family:Verdana;"><span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #339933;">=</span> <span style="color: #ff0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> imgs <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> path <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;img/&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;00.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;01.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;02.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;03.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;04.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;05.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;06.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">7</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;07.jpg&quot;</span><span style="color: #339933;">;</span>
imgs<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">8</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>path <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;08.jpg&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">typeof</span> id <span style="color: #339933;">==</span> <span style="color: #3366CC;">'string'</span> <span style="color: #339933;">?</span> document.<span style="color: #990000;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> id<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> timer<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> showPic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> myimg <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myimg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> imglink <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;imglink&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	myimg.<span style="color: #990000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span>imgs<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> myul <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #990000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> mylink <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #990000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> links <span style="color: #339933;">=</span> mylink<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> titles <span style="color: #339933;">=</span> mylink<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	imglink.<span style="color: #990000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #339933;">,</span>links<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	imglink.<span style="color: #990000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;alt&quot;</span><span style="color: #339933;">,</span>titles<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #ff0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>myul.<span style="color: #990000;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		myul<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span>
		mylink<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	myul<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;hover&quot;</span><span style="color: #339933;">;</span>
	mylink<span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;hover&quot;</span><span style="color: #339933;">;</span>
	n<span style="color: #339933;">++;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> <span style="color: #ff0000;">9</span><span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #ff0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> shownow<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	clearInterval<span style="color: #009900;">&#40;</span>timer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>showPic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> showall<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	timer <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showPic()&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">3000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> mylink <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #990000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #ff0000;">0</span><span style="color: #339933;">,</span> iLen <span style="color: #339933;">=</span> mylink.<span style="color: #990000;">length</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> iLen <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		mylink<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">loc</span> <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
		mylink<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">onmouseover</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			n <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #990000;">loc</span><span style="color: #339933;">;</span>
			shownow<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		mylink<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #990000;">onmouseout</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		        showall<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
timer <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showPic()&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">3000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>全部代码如下：</h4>
<p>（点击“运行”直接查看效果）</p>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_B7jGuw">
&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&gt;
	*{margin:0;padding:0;}
	img{border:none}
	li{list-style:none}
	#today{width:600px;height:233px;margin:10px;border:1px solid #ccc;}
	h2{font-size:14px;padding:3px 5px;border-bottom:1px solid #999;}
	h2 a.more{float:right;font:12px normal;line-height:20px;}
	.imgs{width:350px;height:200px;float:left;background:#ddd;margin:5px;}
	.imgs img{width:350px;height:200px;}
	ul{width:230px;height:200px;padding:6px 1px;float:right;}
	ul li{line-height:22px;font-size:12px;padding:0 3px 0 5px;}
	ul li.hover{background:#ccc url(wp-content/uploads/test/img/arrow.jpg) 0 0 no-repeat;}
	ul li a.hover{line-height:22px;}
	ul li span{float:right;}
	ul li a{text-decoration:none;color:#333;padding-left:10px;}
	ul li a:hover{text-decoration:underline;color:#000}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;today&quot;&gt;
	&lt;h2&gt;今日推荐&lt;a class=&quot;more&quot; href=&quot;#&quot;&gt;更多&gt;&gt;&lt;/a&gt;&lt;/h2&gt;
	&lt;div class=&quot;imgs&quot;&gt;
		&lt;a id=&quot;imglink&quot; href=&quot;#&quot;&gt;&lt;img id=&quot;myimg&quot; src=&quot;wp-content/uploads/test/img/00.jpg&quot; /&gt;&lt;/a&gt;
	&lt;/div&gt;
	&lt;ul id=&quot;myul&quot;&gt;
		&lt;li class=&quot;hover&quot;&gt;&lt;span&gt;[新闻]&lt;/span&gt;&lt;a class=&quot;hover&quot; href=&quot;#&quot; title=&quot;欢迎访问我的小站！&quot;&gt;欢迎访问我的小站！&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[娱乐]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;专注前端开发，关注用户体验&quot;&gt;专注前端开发，关注用户体验&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[体育]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;一步一步学习js，编辑推荐&quot;&gt;一步一步学习js，编辑推荐&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[图书]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;你了解IE6吗？&quot;&gt;你了解IE6吗？&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[汽车]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;这是一个神奇的世界&quot;&gt;这是一个神奇的世界&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[房产]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;新艺术领域的珠联璧合！&quot;&gt;新艺术领域的珠联璧合！&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[校园]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;JavaScript高级程序设计&quot;&gt;JavaScript高级程序设计&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[商城]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;ActionScript3殿堂之路&quot;&gt;ActionScript3殿堂之路&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;span&gt;[空间]&lt;/span&gt;&lt;a href=&quot;#&quot; title=&quot;你学会了吗？&quot;&gt;你学会了吗？&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	var n = 0;
	var imgs = new Array(9);
	var path = &quot;wp-content/uploads/test/img/&quot;;
	imgs[0]=path + &quot;00.jpg&quot;;
	imgs[1]=path + &quot;01.jpg&quot;;
	imgs[2]=path + &quot;02.jpg&quot;;
	imgs[3]=path + &quot;03.jpg&quot;;
	imgs[4]=path + &quot;04.jpg&quot;;
	imgs[5]=path + &quot;05.jpg&quot;;
	imgs[6]=path + &quot;06.jpg&quot;;
	imgs[7]=path + &quot;07.jpg&quot;;
	imgs[8]=path + &quot;08.jpg&quot;;
	function $(id){ return typeof id == 'string' ? document.getElementById(id) : id; }
	var timer;
	function showPic(){
		var myimg = $(&quot;myimg&quot;);
		var imglink = $(&quot;imglink&quot;);
		myimg.setAttribute(&quot;src&quot;,imgs[n]);
		var myul = $(&quot;myul&quot;).getElementsByTagName(&quot;li&quot;);
		var mylink = $(&quot;myul&quot;).getElementsByTagName(&quot;a&quot;);
		var links = mylink[n].getAttribute(&quot;href&quot;);
		var titles = mylink[n].getAttribute(&quot;title&quot;);
		imglink.setAttribute(&quot;href&quot;,links);
		imglink.setAttribute(&quot;alt&quot;,titles);
		for(i=0;i&lt;myul.length;i++){
			myul[i].className = &quot;none&quot;;
			mylink[i].className = &quot;none&quot;;
		}
		myul[n].className = &quot;hover&quot;;
		mylink[n].className = &quot;hover&quot;;
		n++;
		if(n == 9) n = 0;
	}
	function shownow(){
		clearInterval(timer);showPic();
	}
	function showall(){
		timer = setInterval(&quot;showPic()&quot;,3000);
	}
	function init(){
		var mylink = $(&quot;myul&quot;).getElementsByTagName(&quot;a&quot;);
		for(var i = 0, iLen = mylink.length ; i &lt; iLen ; i++)
		{
			mylink[i].loc = i;
			mylink[i].onmouseover = function(){
				n = this.loc;
				shownow();
			}
			mylink[i].onmouseout = function(){
				showall();
			}
		}
	}
	timer = setInterval(&quot;showPic()&quot;,3000);
	init();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_B7jGuw');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_B7jGuw');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>例子到此结束，在写的过程中麻烦了一位同事（兼js“老师”）帮助，很感谢他！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artcss.com/archives/259.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

