﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-咖啡Java-随笔分类-JavaScript</title><link>http://www.blogjava.net/jaunt/category/20890.html</link><description>站在巨人的肩上&lt;br&gt;
Flying in the world of Java</description><language>zh-cn</language><lastBuildDate>Wed, 10 Oct 2007 22:21:24 GMT</lastBuildDate><pubDate>Wed, 10 Oct 2007 22:21:24 GMT</pubDate><ttl>60</ttl><item><title>Javascript 如何实现对象的拖动？</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151841.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:51:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151841.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151841.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151841.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151841.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151841.html</trackback:ping><description><![CDATA[<p><font size="2"><span f-14=""><strong>解决思路</strong></span> <br />
&nbsp;&nbsp;&nbsp;&nbsp;这个效果并不算常见，通常用于游戏或个人站点中。因为拖曳是靠鼠标来操作的，<br />
所以对鼠标的位置的捕获是问题的重点，然后才是根据鼠标的位置设置层的位置。 <br />
</font></p>
<p><font size="2"><strong><span f-14="">具体步骤</span>： <br />
</strong>1.在对象(层)上按下鼠标时，先捕获到需要拖曳的对象，然后获取或设置该对象的相关属性。 <br />
<br />
obj=event.srcElement <br />
obj.setCapture() <br />
z=obj.style.zIndex <br />
obj.style.zIndex=100 <br />
x=event.offsetX <br />
y=event.offsetY <br />
down=true <br />
<br />
2.开始拖曳时，捕获鼠标当前位置，并根据该数值设置被拖曳对象的位置。 <br />
<br />
obj.style.posLeft=document.body.scrollLeft+event.x-x <br />
obj.style.posTop=document.body.scrollTop+event.y-y <br />
<br />
3.拖曳完松开鼠标后，重设标志&nbsp;down&nbsp;，还原对象的&nbsp;z-index并释放对它的鼠标捕捉。 <br />
<br />
down=false&nbsp; <br />
obj.style.zIndex=z&nbsp; <br />
obj.releaseCapture() <br />
<br />
4.完整代码。 <br />
<br />
&lt;script&gt; <br />
var&nbsp;x,y,z,down=false,obj&nbsp;&nbsp;&nbsp; <br />
function&nbsp;init(){ <br />
obj=event.srcElement&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//事件触发对象 <br />
obj.setCapture()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置属于当前对象的鼠标捕捉 <br />
z=obj.style.zIndex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//获取对象的z轴坐标值 <br />
//设置对象的z轴坐标值为100，确保当前层显示在最前面 <br />
obj.style.zIndex=100 <br />
x=event.offsetX&nbsp;&nbsp;&nbsp;//获取鼠标指针位置相对于触发事件的对象的X坐标 <br />
y=event.offsetY&nbsp;&nbsp;&nbsp;//获取鼠标指针位置相对于触发事件的对象的Y坐标 <br />
down=true&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//布尔值，判断鼠标是否已按下，true为按下，false为未按下 <br />
} <br />
<br />
function&nbsp;moveit(){ <br />
//判断鼠标已被按下且onmouseover和onmousedown事件发生在同一对象上 <br />
&nbsp;if(down&amp;&amp;event.srcElement==obj){ <br />
&nbsp;&nbsp;&nbsp;with(obj.style){ <br />
/*设置对象的X坐标值为文档在X轴方向上的滚动距离加上当前鼠标指针相当于文档对象的X坐标值减</font></p>
<p><font size="2">鼠标按下时指针位置相对于触发事件的对象的X坐标*/ <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;posLeft=document.body.scrollLeft+event.x-x <br />
/*设置对象的Y坐标值为文档在Y轴方向上的滚动距离加上当前鼠标指针相当于文档对象的Y坐标值减</font></p>
<p><font size="2">鼠标按下时指针位置相对于触发事件的对象的Y坐标*/ <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;posTop=document.body.scrollTop+event.y-y <br />
&nbsp;&nbsp;&nbsp;} <br />
&nbsp;} <br />
} <br />
<br />
function&nbsp;stopdrag(){ <br />
//onmouseup事件触发时说明鼠标已经松开，所以设置down变量值为false <br />
down=false&nbsp; <br />
obj.style.zIndex=z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//还原对象的Z轴坐标值 <br />
obj.releaseCapture()&nbsp;//释放当前对象的鼠标捕捉 <br />
} <br />
&lt;/script&gt; <br />
<br />
&lt;div&nbsp;onmousedown=init()&nbsp;onmousemove=moveit()&nbsp;&nbsp; onmouseup=stopdrag()<br />
style="position:absolute;left:20;top:190;width:100;height:150;border:1px <br />
solid&nbsp;#000000;z-index:1;background:#eeeeee"&gt;Layer&nbsp;1&lt;/div&gt;
<br />
&lt;div&nbsp;onmousedown=init()&nbsp;onmousemove=moveit()&nbsp;onmouseup=stopdrag() <br />
style="position:absolute;left:60;top:10;width:100;height:150;border:1px <br />
solid&nbsp;#000000;z-index:2;background:#eeeeee"&gt;Layer&nbsp;2&lt;/div&gt;
<br />
&lt;div&nbsp;onmousedown=init()&nbsp;onmousemove=moveit()&nbsp;onmouseup=stopdrag() <br />
style="position:absolute;left:100;top:90;width:100;height:150;border:1px <br />
solid&nbsp;#000000;z-index:3;background:#eeeeee"&gt;Layer&nbsp;3&lt;/div&gt;
<br />
<br />
注意：只有&nbsp;CSS&nbsp;的&nbsp;position&nbsp;属性值为&nbsp;absolute&nbsp;的对象才能进行拖动操作。 <br />
提示：如果需要将拖曳组件化，可以参考第二部分HTC一节。 <br />
技巧：可以在&nbsp;init()&nbsp;函数中加一句&nbsp;event.cancelBubble=true&nbsp;，以取消在该对象上的事件冒泡。 <br />
试一试：读者可以试着实现移动其他对象，例如移动一个图片或文本框。 <br />
特别提示 <br />
在拖曳对象前必须确保该对象的为绝对定位的，把上面的完整代码保存就可以看到效果了，<br />
在实际就用时务必在对象上加上&nbsp;onmousedown、onmousemove和onmouseup三个事件并触发相应函数。</font></p>
<p><font size="2">代码运行效果如图&nbsp;3.8&nbsp;所示。 <br />
<img alt="" src="http://www2.flash8.net/Uploadteach/2005/06/27/200562720315827.jpg" border="0" /><br />
图&nbsp;3.8&nbsp;可拖动的层 <br />
</font></p>
<h4><font size="2">特别说明</font></h4>
<p><br />
<font size="2">本例需要掌握的技巧比较多，捕捉鼠标，获取鼠标位置(相当于对象)，释放鼠标捕捉，文档的滚动距离还有with&nbsp;语句。 <br />
1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setCapture()&nbsp;设置属于当前文档的对象的鼠标捕捉。 <br />
2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.offsetX&nbsp;设置或获取鼠标指针位置相对于触发事件的对象的&nbsp;x&nbsp;坐标。 <br />
3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.offsetY&nbsp;设置或获取鼠标指针位置相对于触发事件的对象的&nbsp;y&nbsp;坐标。 <br />
4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;releaseCapture()&nbsp;释放当前文档中对象的鼠标捕捉。 <br />
5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scrollLeft&nbsp;设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离。 <br />
6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scrollTop&nbsp;设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离。 <br />
7.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;为一个或多个语句设定默认对象。</font></p>
<p align="center"><font size="2"><br />
</font></p>
<font size="2">以下这个方法做出来的比较好看，并增加了层的几个功能:<span style="font-weight: bold; font-size: 18px; font-family: Verdana;" align="center"><br />
<br />
</span></font><font size="2">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;_xWin&lt;/title&gt;<br />
&lt;style type='text/css'&gt;<br />
&lt;!--<br />
a:visited{text-decoration:none;color:slategray;}<br />
a:hover{text-decoration:underline;color:slategray;}<br />
a:link{text-decoration:none;color:slategray;}<br />
--&gt;<br />
&lt;/style&gt;<br />
&lt;script language=JScript&gt;<br />
&lt;!--<br />
//可以打包为js文件;<br />
var x0=0,y0=0,x1=0,y1=0;<br />
var offx=6,offy=6;<br />
var moveable=false;<br />
var hover='orange',normal='slategray';//color;<br />
var index=10000;//z-index;<br />
//开始拖动;<br />
function startDrag(obj)<br />
{<br />
//锁定标题栏;<br />
obj.setCapture();<br />
//定义对象;<br />
var win = obj.parentNode;<br />
var sha = win.nextSibling;<br />
//记录鼠标和层位置;<br />
x0 = event.clientX;<br />
y0 = event.clientY;<br />
x1 = parseInt(win.style.left);<br />
y1 = parseInt(win.style.top);<br />
//记录颜色;<br />
normal = obj.style.backgroundColor;<br />
//改变风格;<br />
obj.style.backgroundColor = hover;<br />
win.style.borderColor = hover;<br />
obj.nextSibling.style.color = hover;<br />
sha.style.left = x1 + offx;<br />
sha.style.top&nbsp;= y1 + offy;<br />
moveable = true;<br />
}<br />
//拖动;<br />
function drag(obj)<br />
{<br />
var win = obj.parentNode;<br />
var sha = win.nextSibling;<br />
if(moveable)<br />
{<br />
&nbsp;win.style.left = x1 + event.clientX - x0;<br />
&nbsp;win.style.top&nbsp;= y1 + event.clientY - y0;<br />
&nbsp;sha.style.left = parseInt(win.style.left) + offx;<br />
&nbsp;sha.style.top&nbsp;= parseInt(win.style.top) + offy;<br />
}<br />
}<br />
//停止拖动;<br />
function stopDrag(obj)<br />
{<br />
var win = obj.parentNode;<br />
var sha = win.nextSibling;<br />
win.style.borderColor = normal;<br />
obj.style.backgroundColor = normal;<br />
obj.nextSibling.style.color = normal;<br />
sha.style.left = obj.parentNode.style.left;<br />
sha.style.top&nbsp;= obj.parentNode.style.top;<br />
//放开标题栏;<br />
obj.releaseCapture();<br />
moveable = false;<br />
}<br />
//获得焦点;<br />
function getFocus(obj)<br />
{<br />
index = index + 2;<br />
var idx = index;<br />
obj.style.zIndex=idx;<br />
obj.nextSibling.style.zIndex=idx-1;<br />
}<br />
function min(obj)<br />
{<br />
var win = obj.parentNode.parentNode;<br />
var sha = win.nextSibling;<br />
var tit = obj.parentNode;<br />
var msg = tit.nextSibling;<br />
var flg = msg.style.display=="none";<br />
if(flg)<br />
{<br />
&nbsp;win.style.height&nbsp;= parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2;<br />
&nbsp;sha.style.height&nbsp;= win.style.height;<br />
&nbsp;msg.style.display = "block";<br />
&nbsp;obj.innerHTML = "0";<br />
}<br />
else<br />
{<br />
&nbsp;win.style.height&nbsp;= parseInt(tit.style.height) + 2*2;<br />
&nbsp;sha.style.height&nbsp;= win.style.height;<br />
&nbsp;obj.innerHTML = "2";<br />
&nbsp;msg.style.display = "none";<br />
}<br />
}<br />
function cls(obj)<br />
{<br />
var win = obj.parentNode.parentNode;<br />
var sha = win.nextSibling;<br />
win.style.visibility = "hidden";<br />
sha.style.visibility = "hidden";<br />
}<br />
//创建一个对象;<br />
function xWin(id,w,h,l,t,tit,msg)<br />
{<br />
index = index+2;<br />
this.id&nbsp;&nbsp;&nbsp;= id;<br />
this.width&nbsp; = w;<br />
this.height&nbsp;= h;<br />
this.left&nbsp;&nbsp;= l;<br />
this.top&nbsp;&nbsp; = t;<br />
this.zIndex&nbsp;= index;<br />
this.title&nbsp; = tit;<br />
this.message = msg;<br />
this.obj&nbsp;&nbsp; = null;<br />
this.bulid&nbsp; = bulid;<br />
this.bulid();<br />
}<br />
//初始化;<br />
function bulid()<br />
{<br />
var str = ""<br />
&nbsp;+ "&lt;div id=xMsg" + this.id + " "<br />
&nbsp;+ "style='"<br />
&nbsp;+ "z-index:" + this.zIndex + ";"<br />
&nbsp;+ "width:" + this.width + ";"<br />
&nbsp;+ "height:" + this.height + ";"<br />
&nbsp;+ "left:" + this.left + ";"<br />
&nbsp;+ "top:" + this.top + ";"<br />
&nbsp;+ "background-color:" + normal + ";"<br />
&nbsp;+ "color:" + normal + ";"<br />
&nbsp;+ "font-size:10px;"<br />
&nbsp;+ "font-family:Verdana;"<br />
&nbsp;+ "position:absolute;"<br />
&nbsp;+ "cursor:default;"<br />
&nbsp;+ "border:2px solid " + normal + ";"<br />
&nbsp;+ "' "<br />
&nbsp;+ "onmousedown='getFocus(this)'&gt;"<br />
&nbsp; + "&lt;div "<br />
&nbsp; + "style='"<br />
&nbsp; + "background-color:" + normal + ";"<br />
&nbsp; + "width:" + (this.width-2*2) + ";"<br />
&nbsp; + "height:20;"<br />
&nbsp; + "color:white;"<br />
&nbsp; + "' "<br />
&nbsp; + "onmousedown='startDrag(this)' "<br />
&nbsp; + "onmouseup='stopDrag(this)' "<br />
&nbsp; + "onmousemove='drag(this)' "<br />
&nbsp; + "&gt;"<br />
&nbsp;&nbsp;+ "&lt;span style='width:" + (this.width-2*12-4) + ";padding-left:3px;'&gt;" + this.title + "&lt;/span&gt;"<br />
&nbsp;&nbsp;+ "&lt;span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='min(this)'&gt;0&lt;/span&gt;"<br />
&nbsp;&nbsp;+ "&lt;span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='cls(this)'&gt;r&lt;/span&gt;"<br />
&nbsp; + "&lt;/div&gt;"<br />
&nbsp;&nbsp;+ "&lt;div style='"<br />
&nbsp;&nbsp;+ "width:100%;"<br />
&nbsp;&nbsp;+ "height:" + (this.height-20-4) + ";"<br />
&nbsp;&nbsp;+ "background-color:white;"<br />
&nbsp;&nbsp;+ "line-height:14px;"<br />
&nbsp;&nbsp;+ "word-break:break-all;"<br />
&nbsp;&nbsp;+ "padding:3px;"<br />
&nbsp;&nbsp;+ "'&gt;" + this.message + "&lt;/div&gt;"<br />
&nbsp;+ "&lt;/div&gt;"<br />
&nbsp;+ "&lt;div style='"<br />
&nbsp;+ "width:" + this.width + ";"<br />
&nbsp;+ "height:" + this.height + ";"<br />
&nbsp;+ "top:" + this.top + ";"<br />
&nbsp;+ "left:" + this.left + ";"<br />
&nbsp;+ "z-index:" + (this.zIndex-1) + ";"<br />
&nbsp;+ "position:absolute;"<br />
&nbsp;+ "background-color:black;"<br />
&nbsp;+ "filter:alpha(opacity=40);"<br />
&nbsp;+ "'&gt;?&lt;/div&gt;";<br />
&nbsp;//alert(str);<br />
document.body.insertAdjacentHTML("beforeEnd",str);<br />
}<br />
//--&gt;<br />
&lt;/script&gt;<br />
&lt;script language='JScript'&gt;<br />
&lt;!--<br />
function initialize()<br />
{<br />
var a = new xWin("1",160,200,200,200,"Message","xWin &lt;br&gt; A Cool Pop Div Window&lt;br&gt;Version:1.0&lt;br&gt;2002-8-13");<br />
var
b = new xWin("2",240,200,100,100,"Wildwind's Msgbox","Welcome to
visited my personal website:&lt;br&gt;<br />
&lt;a
href=http://www14.brinkster.com/wildcity
target=_blank&gt;http://wildcity.126.com&lt;/a&gt;<br />
&lt;br&gt;and u can
also sign my guestbook at:&lt;br&gt;&lt;a
href=http://www14.brinkster.com/wildcity/gbook
target=_blank&gt;<br />
http://wildcity.126.com/gbook&lt;/a&gt;&lt;br&gt;&lt;br&gt;thx!!!
=)...");<br />
var c = new xWin("3",200,160,250,50,"Copyright","Copyright by &lt;a href='mailto:wildwind_zz@21cn.com'&gt;Wildwind&lt;/a&gt;!");<br />
}<br />
window.onload = initialize;<br />
//--&gt;<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body onselectstart='return false' oncontextmenu='return false'&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
<br />
url:</font>http://100000.myabc.cn/home/Blog/view/23902.htm
<img src ="http://www.blogjava.net/jaunt/aggbug/151841.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:51 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151841.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对google个性主页的拖拽效果的js的完整注释</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151836.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:43:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151836.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151836.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151836.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151836.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151836.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: // 工具类，使用Util的命名空间，方便管理 var &nbsp;Util&nbsp; = &nbsp; new &nbsp;Object();// 获取http&nbsp;header里面的UserAgent，浏览器信息 Util.getUserAgent&nbsp; = &nbsp;navigator.userAgent;// 是否是Gecko核心的Browser，比如Moz...&nbsp;&nbsp;<a href='http://www.blogjava.net/jaunt/archive/2007/10/10/151836.html'>阅读全文</a><img src ="http://www.blogjava.net/jaunt/aggbug/151836.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:43 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151836.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>判断Checkbox和Radio的一种方法</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151833.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:35:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151833.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151833.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151833.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151833.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151833.html</trackback:ping><description><![CDATA[&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;判断Checkbox和Radio - 51windows.Net&lt;/title&gt;<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312"&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;form method="post" name="myformname1"&gt;<br />
&lt;input type="checkbox"&nbsp; name="checkname1" id="c11" value=""&gt;&lt;label for="c11"&gt;选择1&lt;/label&gt;<br />
&lt;input type="checkbox"&nbsp; name="checkname1" id="c12" value=""&gt;&lt;label for="c12"&gt;选择2&lt;/label&gt;<br />
&lt;input type="checkbox"&nbsp; name="checkname1" id="c13" value=""&gt;&lt;label for="c13"&gt;选择3&lt;/label&gt;<br />
&lt;input type="checkbox"&nbsp; name="checkname1" id="c14" value=""&gt;&lt;label for="c14"&gt;选择4&lt;/label&gt;<br />
&lt;br&gt;&lt;br&gt;<br />
&lt;input type="button" onclick="alert(IsChecked(document.myformname1,'checkname1'))" value="测试有没有选择"&gt;<br />
&lt;input type="button" onclick="alert(GetCheckedNum(document.myformname1,'checkname1'))" value="测试选择几个"&gt;<br />
&lt;/form&gt;<br />
&lt;hr&gt;<br />
&lt;form method="post" name="myformname2"&gt;<br />
&lt;input type="radio"&nbsp; name="radioname1" id="r11" value=""&gt;&lt;label for="r11"&gt;选择1&lt;/label&gt;<br />
&lt;input type="radio"&nbsp; name="radioname1" id="r12" value=""&gt;&lt;label for="r12"&gt;选择2&lt;/label&gt;<br />
&lt;br&gt;&lt;br&gt;<br />
&lt;input type="button" onclick="alert(IsChecked(document.myformname2,'radioname1'))" value="测试有没有选择"&gt; &lt;input type="reset" value="重置"&gt;<br />
&lt;/form&gt;<br />
&lt;SCRIPT LANGUAGE="JavaScript"&gt;<br />
&lt;!--<br />
function IsChecked(oform,checkname){<br />
&nbsp;var len = oform.elements.length;<br />
&nbsp;var i=0;<br />
&nbsp;for( i=0; i&lt;len; i++){<br />
&nbsp; if (oform.elements[i].name==checkname){<br />
&nbsp;&nbsp; if(oform.elements[i].checked){<br />
&nbsp;&nbsp;&nbsp; return true;<br />
&nbsp;&nbsp; }<br />
&nbsp; }<br />
&nbsp;}<br />
&nbsp;return false;<br />
}<br />
function GetCheckedNum(oform,checkname){<br />
&nbsp;var len = oform.elements.length;<br />
&nbsp;var i=0;<br />
&nbsp;var checkn = 0;<br />
&nbsp;for( i=0; i&lt;len; i++){<br />
&nbsp; if (oform.elements[i].name==checkname){<br />
&nbsp;&nbsp; if(oform.elements[i].checked){<br />
&nbsp;&nbsp;&nbsp; checkn++;<br />
&nbsp;&nbsp; }<br />
&nbsp; }<br />
&nbsp;}<br />
&nbsp;return checkn;<br />
}<br />
//--&gt;<br />
&lt;/SCRIPT&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;
<img src ="http://www.blogjava.net/jaunt/aggbug/151833.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:35 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151833.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript，等比例缩放图片的函数</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151831.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:33:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151831.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151831.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151831.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151831.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151831.html</trackback:ping><description><![CDATA[此函数(网上资源)具有如下功能：&nbsp;&nbsp;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、预先定义好图片显示的标准宽度和高度。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、如果图片的大小超过了标准定义，那么等比例压缩图片。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、如果图片的大小等于标准定义，那么按照标准宽度和高度显示图片。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4、如果图片的大小小于标准定义，那么不对图片进行任何压缩处理。</p>
<br />
&nbsp;<span style="color: #000000;">&lt;</span><span style="color: #000000;">script&nbsp;language</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">JavaScript</span><span style="color: #000000;">"</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #000000;">&lt;!--</span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #008000;">//</span><span style="color: #008000;">图片按比例缩放</span><span style="color: #008000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #000000;">var&nbsp;flag</span><span style="color: #000000;">=</span><span style="color: #0000ff;">false</span><span style="color: #000000;">;<br />
<img id="Codehighlighter1_101_846_Open_Image" style="display: inline;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_101_846_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" alt="" align="top" height="16" width="11" />function&nbsp;DrawImage(ImgD,iwidth,iheight)</span><span style="display: inline;"><span style="color: #000000;">{<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000;">//</span><span style="color: #008000;">参数(图片,允许的宽度,允许的高度)</span><span style="color: #008000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;image</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;Image();<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;image.src</span><span style="color: #000000;">=</span><span style="color: #000000;">ImgD.src;<br />
<img id="Codehighlighter1_218_844_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_218_844_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(image.width</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">0</span>&nbsp;<span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;image.height</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><span style="color: #000000;">{<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;flag<span style="color: #000000;">=</span><span style="color: #0000ff;">true</span><span style="color: #000000;">;<br />
<img id="Codehighlighter1_284_550_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_284_550_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(image.width</span><span style="color: #000000;">/</span><span style="color: #000000;">image.height</span><span style="color: #000000;">&gt;=</span><span style="color: #000000;">&nbsp;iwidth</span><span style="color: #000000;">/</span><span style="color: #000000;">iheight)</span><span style="color: #000000;">{<br />
<img id="Codehighlighter1_316_410_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_316_410_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">if</span><span style="color: #000000;">(image.width</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">iwidth)</span><span style="color: #000000;">{&nbsp;&nbsp;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.width<span style="color: #000000;">=</span><span style="color: #000000;">iwidth;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.height</span><span style="color: #000000;">=</span><span style="color: #000000;">(image.height</span><span style="color: #000000;">*</span><span style="color: #000000;">iwidth)</span><span style="color: #000000;">/</span><span style="color: #000000;">image.width;<br />
<img id="Codehighlighter1_415_493_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_415_493_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.width<span style="color: #000000;">=</span><span style="color: #000000;">image.width;&nbsp;&nbsp;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.height</span><span style="color: #000000;">=</span><span style="color: #000000;">image.height;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.alt</span><span style="color: #000000;">=</span><span style="color: #000000;">image.width</span><span style="color: #000000;">+</span><span style="color: #000000;">"</span><span style="color: #000000;">&#215;</span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">image.height;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br />
<img id="Codehighlighter1_560_838_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_560_838_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br />
<img id="Codehighlighter1_594_698_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_594_698_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">if</span><span style="color: #000000;">(image.height</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">iheight)</span><span style="color: #000000;">{&nbsp;&nbsp;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.height<span style="color: #000000;">=</span><span style="color: #000000;">iheight;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.width</span><span style="color: #000000;">=</span><span style="color: #000000;">(image.width</span><span style="color: #000000;">*</span><span style="color: #000000;">iheight)</span><span style="color: #000000;">/</span><span style="color: #000000;">image.height;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<img id="Codehighlighter1_703_781_Open_Image" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" height="16" width="11" /><img id="Codehighlighter1_703_781_Closed_Image" style="display: none;" src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.width<span style="color: #000000;">=</span><span style="color: #000000;">image.width;&nbsp;&nbsp;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.height</span><span style="color: #000000;">=</span><span style="color: #000000;">image.height;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ImgD.alt</span><span style="color: #000000;">=</span><span style="color: #000000;">image.width</span><span style="color: #000000;">+</span><span style="color: #000000;">"</span><span style="color: #000000;">&#215;</span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">image.height;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" height="16" width="11" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" align="top" height="16" width="11" />}</span></span><span style="color: #000000;">&nbsp;<br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #008000;">//</span><span style="color: #008000;">--&gt;</span><span style="color: #008000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" /></span><span style="color: #000000;">&lt;/</span><span style="color: #000000;">script</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br />
<img src="http://leimin3113591.cnblogs.com/Images/OutliningIndicators/None.gif" alt="" align="top" height="16" width="11" />调用：</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">img&nbsp;src</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">images/toplogo.gif</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;onload</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">DrawImage(this,100,100)</span><span style="color: #000000;">"</span><span style="color: #000000;">&gt;</span>
<img src ="http://www.blogjava.net/jaunt/aggbug/151831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:33 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>setInterval全面的介绍(转)</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151829.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:30:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151829.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151829.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151829.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151829.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151829.html</trackback:ping><description><![CDATA[setInterval动作的作用是在播放动画的时，每隔一定时间就调用函数，方法或对象。可以使用本动作更新来自数据库的变量或更新时间显示。setInterval动作的语法格式如下：<br />
setInterval(function,interval[,arg1,arg2,......argn])<br />
setInterval(object,methodName,interval[,arg1,arg2,.....argn])<br />
第一种格式是标准动作面板中setInterval函数的默认语法，第二种格式是在专家模式动作中使用的方法。<br />
其
中的参数function是一个函数名或者一个对匿名函数的引用。object参数指定从Object对象派生的对象。methodName制定
object参数中要调用的方法。interval制定对function或methodName调用两次之间的时间，单位是毫秒。后面的arg1等是可
选的参数，用于制定传递给function或是methodName的参数。<br />
setInterval它设置的时间间隔小于动画帧速（如每秒10
帧，相当于100毫秒），则按照尽可能接近interval的时间间隔调用函数。而且必须使用updateAfterEvent动作来确保以足够的频率刷
新屏幕。如果interval大于动画帧速，则只用在每次播放头进入某一帧是才调用，以减小每次刷新屏幕的影响。<br />
下面的例子每隔1秒调用一次匿名函数。<br />
<div>setInterval(function(){trace("每隔1秒钟我就会显示一次")},1000);//这里的function(){}是没有函数名</div>
的函数。成为匿名函数，后面的1000是时间间隔，单位是毫秒。<br />
下面的例子为我们展示如何带参数运行。<br />
<div>function show1(){<br />
&nbsp;&nbsp;&nbsp;trace("每隔1秒我就会显示一次");<br />
}<br />
function show2(str){<br />
&nbsp;&nbsp;&nbsp;trace(str);<br />
}<br />
setInterval(show1,1000);<br />
setInterval(show2,2000,"每隔2秒我就会显示一次");</div>
上面已经将函数的setInterval方法介绍了。<br />
下面我们将介绍对象的setInterval方法。<br />
首先，写一个setInterval在动作中调用对象的方法的例子，该例子不需要传递参数。<br />
<div>myobj=new Object();//创建一个新的对象<br />
myobj.interval=function){<br />
&nbsp;&nbsp;&nbsp;trace("每隔1秒我就会显示一次");<br />
}//创建对象的方法。<br />
setInterval(myobj,"interval",1000);//设定时间间隔调用对象的方法。<br />
</div>
接下来介绍如何传递参数。其实道理和函数的传递参数是一样的。<br />
<div>myobj=new Object();<br />
myobj.interval-function(str){<br />
&nbsp;&nbsp;&nbsp;trace(str);<br />
}<br />
setInterval(myobj,"interval",2000," 每隔2秒我就会显示一次");<br />
</div>
注意。要调用为对象定义的方法时，必须在专家模式中使用第二种语法格式。<br />
这样子的话呢，我们来作一个动态显示时间的画面。可以用下面的代码实现。<br />
<div>setInterval(show,1000);<br />
function show(){<br />
&nbsp;&nbsp;&nbsp;time=new Date();<br />
&nbsp;&nbsp;&nbsp;hour=time.getHours();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;minu=time.getMinutes();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sec=time.get.Seconds();<br />
&nbsp;&nbsp;&nbsp;datetime=hour+":"+minu+":"+sec;<br />
}//这里的datetime是一个动态文本框的变量名字。<br />
</div>
这样子呢，setInterval这个方法大家应该学的很好了。现在呢，我们学习clearInterval.<br />
clearInterval动作的作用是清楚对setInterval函数的调用，它的语法格式如下clearInterval(intervalid);intervalid是调用setInterval函数后返回的对象。<br />
下面举一个简单的例子。<br />
function show(){<br />
&nbsp;&nbsp;&nbsp;trace("每隔一秒我就会显示一次");<br />
}<br />
var sh;<br />
sh=setInterval(show,1000);<br />
clearInterval(sh);
<img src ="http://www.blogjava.net/jaunt/aggbug/151829.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:30 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151829.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用javascript进行拖拽</title><link>http://www.blogjava.net/jaunt/archive/2007/10/10/151828.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Wed, 10 Oct 2007 09:25:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/10/10/151828.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/151828.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/10/10/151828.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/151828.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/151828.html</trackback:ping><description><![CDATA[<br />
<div align="left">第 1 页 <a target="_blank" href="http://www.blueidea.com/tech/web/2006/3791.asp">怎么用javascript进行拖拽 [1]</a><br />
第 2 页 <a target="_blank" href="http://www.blueidea.com/tech/web/2006/3791_2.asp">怎么用javascript进行拖拽 [2]</a><br />
第 3 页 <a target="_blank" href="http://www.blueidea.com/tech/web/2006/3791_3.asp">怎么用javascript进行拖拽 [3]</a><br />
第 4 页 <a target="_blank" href="http://www.blueidea.com/tech/web/2006/3791_4.asp">怎么用javascript进行拖拽 [4]</a><br />
第 5 页 <a target="_blank" href="http://www.blueidea.com/tech/web/2006/3791_5.asp">怎么用javascript进行拖拽 [5]</a></div>
<img src ="http://www.blogjava.net/jaunt/aggbug/151828.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-10-10 17:25 <a href="http://www.blogjava.net/jaunt/archive/2007/10/10/151828.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[下载]JavaScript权威指南(第五版)</title><link>http://www.blogjava.net/jaunt/archive/2007/04/02/108036.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Mon, 02 Apr 2007 10:40:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/04/02/108036.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/108036.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/04/02/108036.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/108036.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/108036.html</trackback:ping><description><![CDATA[<h1 class=ContentTitle><strong><a title=JavaScript权威指南 href="http://onewww.net/blog/article.asp?id=79">
<h1 class=ContentTitle><strong style="FONT-SIZE: 12pt">下载J:avaScript权威指南(第五版)</strong></h1>
</a></strong></h1>
<img src ="http://www.blogjava.net/jaunt/aggbug/108036.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-04-02 18:40 <a href="http://www.blogjava.net/jaunt/archive/2007/04/02/108036.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>发现一个有用的js事件onpropertychange</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105641.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 12:52:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105641.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105641.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105641.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105641.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105641.html</trackback:ping><description><![CDATA[当一个对象的属性值发生变化时激活此事件.可以用在各种html表单中,如来监视其值的变化.<br /><br />&lt;textarea cols="100" rows="15" onpropertychange="alert(this.value)"&gt;&lt;/textarea&gt;<br /><br /><br />From:http://www.cnitblog.com/yemoo/archive/2006/07/07/13366.html<br /><img src ="http://www.blogjava.net/jaunt/aggbug/105641.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 20:52 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105641.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS中的setTimeout和setInterval的区别</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105640.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 12:46:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105640.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105640.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105640.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105640.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105640.html</trackback:ping><description><![CDATA[setTimeout(Expression,DelayTime),在DelayTime过后,将执行一次Expression<br />setInterval(expression,delayTime),每个DelayTime,都将执行Expression<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;!</span><span style="color: rgb(255, 0, 255);">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html </span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/1999/xhtml"</span><span style="color: rgb(255, 0, 0);"> xml:lang</span><span style="color: rgb(0, 0, 255);">="en"</span><span style="color: rgb(255, 0, 0);"> lang</span><span style="color: rgb(0, 0, 255);">="en"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">div </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="a"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">div</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">div </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="b"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">div</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />setTimeout(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">document.getElementById('a').innerHTML=<br />new Date().getSeconds();</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">);<br />setInterval(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">document.getElementById('b').innerHTML=<br />new Date().getSeconds();</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">);<br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span></div>From:http://www.cnitblog.com/yemoo/archive/2006/06/29/13078.html<br /><img src ="http://www.blogjava.net/jaunt/aggbug/105640.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 20:46 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105640.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript小技巧（收藏）</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105580.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 08:07:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105580.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105580.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105580.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105580.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105580.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 事件源对象												event.srcElement.tagName event.srcElement.type																																						捕获释放 event.srcElement.setCapture();  event.srcElement.releaseCapture();  												...&nbsp;&nbsp;<a href='http://www.blogjava.net/jaunt/archive/2007/03/22/105580.html'>阅读全文</a><img src ="http://www.blogjava.net/jaunt/aggbug/105580.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 16:07 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105580.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自动对select表单列表进行排序（收藏）</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105576.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 07:55:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105576.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105576.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105576.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105576.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105576.html</trackback:ping><description><![CDATA[
		<a id="viewpost1_TitleUrl" href="http://www.cnitblog.com/yemoo/archive/2006/06/20/12573.html">自动对select表单列表进行排序</a>
		<br />
		<br />&lt;! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />"<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>"&gt;<br />&lt;html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"&gt;<br />&lt;head&gt;<br />&lt;title&gt;runcode&lt;/title&gt;<br />&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;<br />&lt;meta name="Author" content="Sheneyan" /&gt;<br />&lt;script type="text/javascript"&gt;<br />function s(n){<br />  var o=document.getElementById(n);<br />  if (!o) return ;<br />  var t=[],tt=o.options;<br />  while(tt.length&gt;0){<br />  t[t.length]=tt[0].text;<br />  tt.remove(0);<br /> }<br /> t.sort();<br />  for(var i=0,c;c=t[i];i++){<br />  tt.add(new Option(c));<br /> }<br />}<br />&lt;/script&gt;<br />&lt;/head&gt;<br />&lt;body onload="s('abc')"&gt;<br />&lt;select id="abc"&gt;<br />&lt;option&gt;华硕&lt;/option&gt;<br />&lt;option&gt;.NET &lt;/option&gt;<br />&lt;option&gt;360 安全卫士&lt;/option&gt;<br />&lt;option&gt;ACDSee&lt;/option&gt;<br />&lt;option&gt;Adobe&lt;/option&gt;<br />&lt;option&gt;Firewall&lt;/option&gt;<br />&lt;option&gt;Alcohol 120%&lt;/option&gt;<br />&lt;option&gt;AMD&lt;/option&gt;<br />&lt;option&gt;AnyDVD&lt;/option&gt;<br />&lt;option&gt;Apple&lt;/option&gt;<br />&lt;option&gt;ATi&lt;/option&gt;<br />&lt;option&gt;AutoDesk&lt;/option&gt;<br />&lt;option&gt;罗技&lt;/option&gt;<br />&lt;option&gt;BitComet&lt;/option&gt;<br />&lt;option&gt;BitSpirit(比特精灵)&lt;/option&gt;<br />&lt;option&gt;BlackIce&lt;/option&gt;<br />&lt;option&gt;BlueTooth&lt;/option&gt;<br />&lt;option&gt;Cisco &lt;/option&gt;<br />&lt;option&gt;CloneCD&lt;/option&gt;<br />&lt;option&gt;CloneDVD&lt;/option&gt;<br />&lt;option&gt;CS-半条命&lt;/option&gt;<br />&lt;option&gt;CuteFTP&lt;/option&gt;<br />&lt;option&gt;千千静听&lt;/option&gt;<br />&lt;option&gt;趋势科技(PC-cillin)&lt;/option&gt;<br />&lt;option&gt;DAEMON Tools&lt;/option&gt;<br />&lt;option&gt;DELL&lt;/option&gt;<br />&lt;option&gt;DirectX&lt;/option&gt;<br />&lt;option&gt;DivX&lt;/option&gt;<br />&lt;option&gt;DreamMail&lt;/option&gt;<br />&lt;option&gt;PowerDVD&lt;/option&gt;<br />&lt;option&gt;Easy CD-DA&lt;/option&gt;<br />&lt;option&gt;瑞星(Rising)&lt;/option&gt;<br />&lt;option&gt;Editplus&lt;/option&gt;<br />&lt;option&gt;EmEditor&lt;/option&gt;<br />&lt;option&gt;eMule&lt;/option&gt;<br />&lt;option&gt;eMule Plus&lt;/option&gt;<br />&lt;option&gt;FeedDemon&lt;/option&gt;<br />&lt;option&gt;FileZilla&lt;/option&gt;<br />&lt;option&gt;FlashFXP&lt;/option&gt;<br />&lt;option&gt;Flashget&lt;/option&gt;<br />&lt;option&gt;foobar2000&lt;/option&gt;<br />&lt;option&gt;Foxit PDF Reader&lt;/option&gt;<br />&lt;option&gt;Foxmail&lt;/option&gt;<br />&lt;option&gt;FreeBSD&lt;/option&gt;<br />&lt;option&gt;FTPRush&lt;/option&gt;<br />&lt;option&gt;Gmail&lt;/option&gt;<br />&lt;option&gt;Google talk&lt;/option&gt;<br />&lt;option&gt;Google&lt;/option&gt;<br />&lt;option&gt;GoogleToolbar&lt;/option&gt;<br />&lt;option&gt;GoSURF&lt;/option&gt;<br />&lt;option&gt;GreenBrowser&lt;/option&gt;<br />&lt;option&gt;HP&lt;/option&gt;<br />&lt;option&gt;HyperSnap-DX&lt;/option&gt;<br />&lt;option&gt;IBM&lt;/option&gt;<br />&lt;option&gt;ICQ&lt;/option&gt;<br />&lt;option&gt;iMac G5&lt;/option&gt;<br />&lt;option&gt;Intel&lt;/option&gt;<br />&lt;option&gt;Internet Explorer&lt;/option&gt;<br />&lt;option&gt;IPB&lt;/option&gt;<br />&lt;option&gt;iTune&lt;/option&gt;<br />&lt;option&gt;腾讯&lt;/option&gt;<br />&lt;option&gt;微软&lt;/option&gt;<br />&lt;option&gt;木马克星(iparmor)&lt;/option&gt;<br />&lt;option&gt;天网防火墙&lt;/option&gt;<br />&lt;option&gt;木马捆绑克星&lt;/option&gt;<br />&lt;option&gt;风云防火墙个人版&lt;/option&gt;<br />&lt;option&gt;卡巴斯基(Kaspersky)&lt;/option&gt;<br />&lt;option&gt;Maxthon 傲游&lt;/option&gt;<br />&lt;option&gt;Media Player Classic&lt;/option&gt;<br />&lt;option&gt;Windows Media Player&lt;/option&gt;<br />&lt;option&gt;Windows Live Messenger&lt;/option&gt;<br />&lt;option&gt;Microsoft AntiSpyware&lt;/option&gt;<br />&lt;option&gt;Microsoft Office&lt;/option&gt;<br />&lt;option&gt;Mozilla FireFox&lt;/option&gt;<br />&lt;option&gt;Mozilla ThunderBird&lt;/option&gt;<br />&lt;option&gt;MySQL&lt;/option&gt;<br />&lt;option&gt;Nero&lt;/option&gt;<br />&lt;option&gt;NetCaptor&lt;/option&gt;<br />&lt;option&gt;Nettransport&lt;/option&gt;<br />&lt;option&gt;nVIDIA nForce&lt;/option&gt;<br />&lt;option&gt;鱼鱼桌面秀&lt;/option&gt;<br />&lt;option&gt;Opera&lt;/option&gt;<br />&lt;option&gt;PHP&lt;/option&gt;<br />&lt;option&gt;QQ病毒专杀工具&lt;/option&gt;<br />&lt;option&gt;QuickTime&lt;/option&gt;<br />&lt;option&gt;RealPlayer&lt;/option&gt;<br />&lt;option&gt;skype&lt;/option&gt;<br />&lt;option&gt;SQL Server 2005&lt;/option&gt;<br />&lt;option&gt;stylexp&lt;/option&gt;<br />&lt;option&gt;TheWorld Browser&lt;/option&gt;<br />&lt;option&gt;TuneUp Utilities&lt;/option&gt;<br />&lt;option&gt;UltraEdit&lt;/option&gt;<br />&lt;option&gt;UltraISO&lt;/option&gt;<br />&lt;option&gt;Winamp&lt;/option&gt;<br />&lt;option&gt;Windows OneCare&lt;/option&gt;<br />&lt;option&gt;Windows优化王&lt;/option&gt;<br />&lt;option&gt;Windows优化大师&lt;/option&gt;<br />&lt;option&gt;WinDVD&lt;/option&gt;<br />&lt;option&gt;WinRAR&lt;/option&gt;<br />&lt;option&gt;WinZip&lt;/option&gt;<br />&lt;option&gt;XnView&lt;/option&gt;<br />&lt;option&gt;Zonealarm&lt;/option&gt;<br />&lt;option&gt;Zoom Player&lt;/option&gt;<br />&lt;option&gt;超级兔子&lt;/option&gt;<br />&lt;option&gt;风雷影音&lt;/option&gt;<br />&lt;option&gt;急速启动 HurryRun&lt;/option&gt;<br />&lt;/select&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br />主要有以下几点总结：<br />1，select控件本身支持字母索引。比如select控件处于焦点中的时候，按B键，option中相应的以B开头的选项就会显示出来。<br /><br />2，这段代码写的较好!这段代码的作用是一项一项赋值select空间列表内容赋给另一个数组。<br /><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> t</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">[],tt</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">o.options;<br />  </span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">while</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> (tt.length</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">&gt;</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){<br />    t[t.length]</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">tt[</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">].text;<br />    tt.remove(</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />  }</span><br />首先定义数组t=[],用于存储原select控件列表内容。<br />tt=o.options;读取select空间内容，以数组形式存储在tt数组中。<br /><font style="BACKGROUND-COLOR: rgb(245,245,245)">t[t.length]<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span></font><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">tt[</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">].text;这里时一个技巧，因为t.length总是比当前t的最大索引大1，所以这样写数组t可以自动增加空间。tt[0].text这里每次都读取第一个内容，然后用tt.remove(<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);删除第一项内容，直至读取完毕。<br /><br />3，这段代码对新数组内容按字母派讯，然后写入原select空间列表。<br />t.sort();<br />  <span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">for</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> (</span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> i</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">,c;c</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">t[i];i</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">++</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){<br />    tt.add(</span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">new</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> Option(c));<br />  }<br /><br /><br />From Index：<a href="http://www.cnitblog.com/yemoo/archive/2006/06/20/12573.html">http://www.cnitblog.com/yemoo/archive/2006/06/20/12573.html</a></span></span></span><img src ="http://www.blogjava.net/jaunt/aggbug/105576.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 15:55 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105576.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个表格特效的JS代码（收藏）</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105561.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 06:58:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105561.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105561.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105561.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105561.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105561.html</trackback:ping><description><![CDATA[
		<p>嘿嘿……今天看到很好用的一个js表格效果，有时间研究下^_^<br />&lt;html&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312"&gt;<br />&lt;title&gt;mytable&lt;/title&gt;<br />&lt;script language="JavaScript"&gt; <br /> // src="anole.js" <br />// about this: javapig修改 源自 忘了。 <br />// Date: 2006-04-29 <br /> <br /> function anole(<br /> str_tableid, // table id <br />  num_header_offset,// 表头行数 <br />  str_odd_color, // 奇数行的颜色 <br />  str_even_color,// 偶数行的颜色 <br />  str_mover_color, // 鼠标经过行的颜色 <br />  str_onclick_color // 选中行的颜色 <br />  )  {</p>
		<p> // 表格ID参数验证 <br />  if(!str_tableid) return alert(str_tableid+"表格不存在");<br /> var obj_tables=(document.all ? document.all[str_tableid]:document.getElementById(str_tableid));<br /> if(!obj_tables) return alert("ID为("+str_tableid+")不存在！");</p>
		<p> // 设置个参数的缺省值 <br />  var col_config=[];<br /> col_config.header_offset=(num_header_offset?num_header_offset:0 );<br /> col_config.odd_color=(str_odd_color?str_odd_color:'#ffffff');<br /> col_config.even_color=(str_even_color?str_even_color:'#dbeaf5');<br /> col_config.mover_color=(str_mover_color?str_mover_color:'#6699cc');<br /> col_config.onclick_color=(str_onclick_color?str_onclick_color:'#4C7DAB');<br /> // 初始化表格（可能多个表格用同一个ID） <br />  if(obj_tables.length)<br />  for(var i=0;i&lt;obj_tables.length;i++ )<br /> tt_init_table(obj_tables[i],col_config);<br /> else <br /> tt_init_table(obj_tables,col_config);<br />} <br /> <br /> function tt_init_table(obj_table,col_config)  {<br /> var col_lconfig=[],<br /> col_trs=obj_table.rows;<br /> if(!col_trs) return ;<br /> <br /> for(var i=col_config.header_offset;i&lt;col_trs.length;i++)  { // i 从 表头以下开始 <br />  col_trs[i].config=col_config;<br /> col_trs[i].lconfig=col_lconfig;<br /> col_trs[i].set_color=tt_set_color;<br /> col_trs[i].onmouseover=tt_mover; <br /> col_trs[i].onmouseout=tt_mout;<br /> col_trs[i].onmousedown=tt_onclick;<br /> col_trs[i].order=(i-col_config.header_offset)%2 ;<br /> col_trs[i].onmouseout();<br /> } <br />} <br /> function tt_set_color(str_color) {<br /> this.style.backgroundColor=str_color;<br />} <br /> <br /> // 事件操作 <br /> function tt_mover() {<br /> if(this.lconfig.clicked!=this )<br />  this.set_color(this.config.mover_color);<br />} <br /> function tt_mout() {<br /> if(this.lconfig.clicked!=this )<br />  this.set_color(this.order?this.config.odd_color:this.config.even_color);<br />} <br /> function tt_onclick()  {<br /> if( this.lconfig.clicked==this) {<br />  this.lconfig.clicked=null;<br />  this.onmouseover();<br /> } <br />  else {<br />  var last_clicked=this.lconfig.clicked;<br />  this.lconfig.clicked=this ;<br />  if(last_clicked) last_clicked.onmouseout();<br />  this.set_color(this.config.onclick_color);<br /> } <br />} <br /> <br />&lt;/script&gt;<br />&lt;/head&gt;</p>
		<p>&lt;body&gt;<br />&lt;table bgcolor="#9933ff" align="center" cellpadding="1" cellspacing="0" width="80%"&gt;<br /> &lt;tr&gt;<br /> &lt;td&gt; <br /> &lt;table id="demo" cellpadding="1" cellspacing="1" border="0" width="100%" align="center"&gt;<br /> &lt;tr&gt;&lt;th colspan="2" bgcolor="ffffff"&gt;HTML document object properties&lt;/th&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td width="20%"&gt;activeElement&lt;/td&gt;&lt;td&gt;Retrieves the object that has the focus.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;aLinkColor&lt;/td&gt;&lt;td&gt;Sets or retrieves the color of all links in the document.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;bgColor&lt;/td&gt;&lt;td&gt;Sets or retrieves the background color behe document object.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;body&lt;/td&gt;&lt;td&gt;Specifies the beginning and end of the document body.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;contentEditable&lt;/td&gt;&lt;td&gt;Sets or retrieves whether the userdocument object.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;cookie&lt;/td&gt;&lt;td&gt;Sets or retrieves the string value of a cookie.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;defaultCharset&lt;/td&gt;&lt;td&gt;Sets or retrieves the default chara of the document.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;designMode&lt;/td&gt;&lt;td&gt;Sets or retrieves whether the document can be edited.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;documentElement&lt;/td&gt;&lt;td&gt;Retrieves a reference to the root node of the document.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;tr&gt;&lt;td&gt;domain&lt;/td&gt;&lt;td&gt;Sets or retrieves the security domain of the document.&lt;/td&gt;&lt;/tr&gt;<br /> &lt;/table&gt;<br /> &lt;/td&gt;<br /> &lt;/tr&gt;<br /> &lt;/table&gt;<br /> &lt;script language="JavaScript"&gt; <br />  anole('demo',1,'#ffffff','#ccccff','#ffccff','#cc99ff');<br /> &lt;/script&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br />From Index：<a href="http://www.cnitblog.com/yemoo/archive/2006/06/16/12362.html">http://www.cnitblog.com/yemoo/archive/2006/06/16/12362.html</a></p>
<img src ="http://www.blogjava.net/jaunt/aggbug/105561.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 14:58 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105561.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>设定属性rel为external与internal的不同</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105558.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 06:47:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105558.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105558.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105558.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105558.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105558.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
				<span style="COLOR: rgb(0,0,255)">
						<font color="#000000">在网上看了一下js代码感觉有点用，就转过来，也算是俺的一点小练习。</font>
						<br />
						<br />&lt;!</span>
				<span style="COLOR: rgb(255,0,255)">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">html </span>
				<span style="COLOR: rgb(255,0,0)">xmlns</span>
				<span style="COLOR: rgb(0,0,255)">="http://www.w3.org/1999/xhtml"</span>
				<span style="COLOR: rgb(255,0,0)"> xml:lang</span>
				<span style="COLOR: rgb(0,0,255)">="en"</span>
				<span style="COLOR: rgb(255,0,0)"> lang</span>
				<span style="COLOR: rgb(0,0,255)">="en"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">head</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">title</span>
				<span style="COLOR: rgb(0,0,255)">&gt;&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">title</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">style </span>
				<span style="COLOR: rgb(255,0,0)">type</span>
				<span style="COLOR: rgb(0,0,255)">="text/css"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(128,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />  #search</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">{</span>
				<span style="COLOR: rgb(255,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />    border</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">:</span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">1px solid #ccc</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;</span>
				<span style="COLOR: rgb(255,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />    color</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">:</span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">#999</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;</span>
				<span style="COLOR: rgb(255,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">}</span>
				<span style="COLOR: rgb(128,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
						<br />  </span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">style</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">script </span>
				<span style="COLOR: rgb(255,0,0)">type</span>
				<span style="COLOR: rgb(0,0,255)">="text/javascript"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">&lt;!--</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />    </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> addEvent(elm, evType, fn, useCapture)<br />        </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> addEvent and removeEvent</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">        </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> cross-browser event handling for IE5+,  NS6 and Mozilla</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">        </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> By Scott Andrew</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">    {<br />          </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> (elm.addEventListener){<br />            elm.addEventListener(evType, fn, useCapture);<br />            </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">return</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">true</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;<br />          } </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">else</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> (elm.attachEvent){<br />            </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> r </span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> elm.attachEvent(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">on</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">+</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">evType, fn);<br />            </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">return</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> r;<br />          } </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">else</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> {<br />            alert(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">Handler could not be removed</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />          }<br />    }<br /><br />    </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> externalLinks(){       </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">设定属性rel为external的连接在新页面打开</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">!</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">document.getElementsByTagName) </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">return</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> ;<br />        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> anchors</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">document.getElementsByTagName(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">a</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">for</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(</span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> i</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;i</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">&lt;</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">anchors.length;i</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">++</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){<br />            anchor</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">anchors[i];<br />            </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(anchor.getAttribute(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">href</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">)</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">&amp;&amp;</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">anchor.getAttribute(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">rel</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">)</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">external</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){<br />                anchor.setAttribute(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">target</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">,</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">_blank</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />            }<br />        }<br />    }<br /><br />    </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> onSearchFocus(){           </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">搜索框获取焦点时</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> search</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">document.getElementById(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">search</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(search.value</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">请输入关键字</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){    </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">如果输入框内容是“请输入关键字”，则清空内容，并设顶文字颜色为黑色</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">            search.value</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">""</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;<br />            search.style.color</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">#000</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />        }<br />    }<br />    </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> onSearchBlur(){            </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">搜索框失去焦点时</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> search</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">document.getElementById(</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">search</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />        </span>
				<span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(search.value</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">""</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){               </span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">如果输入框内容为空，则设定文字颜色为灰色，内容为“请输入关键子”</span>
				<span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">            search.style.color</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">#999</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">;<br />            search.value</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">请输入关键字</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />        }<br />    }<br />    addEvent(window,</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">load</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">,externalLinks)<br />  </span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">--&gt;</span>
				<span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">
						<br />  </span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">script</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">head</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">body</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />[External links]</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">a </span>
				<span style="COLOR: rgb(255,0,0)">href</span>
				<span style="COLOR: rgb(0,0,255)">="http://www.qq.com"</span>
				<span style="COLOR: rgb(255,0,0)"> rel</span>
				<span style="COLOR: rgb(0,0,255)">="external"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">QQ.com</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">a</span>
				<span style="COLOR: rgb(0,0,255)">&gt;&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">a </span>
				<span style="COLOR: rgb(255,0,0)">href</span>
				<span style="COLOR: rgb(0,0,255)">="http://www.163.com"</span>
				<span style="COLOR: rgb(255,0,0)"> rel</span>
				<span style="COLOR: rgb(0,0,255)">="external"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">163.com</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">a</span>
				<span style="COLOR: rgb(0,0,255)">&gt;&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />[internal Links]</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">a </span>
				<span style="COLOR: rgb(255,0,0)">href</span>
				<span style="COLOR: rgb(0,0,255)">="http://www.blueidea.com"</span>
				<span style="COLOR: rgb(255,0,0)"> rel</span>
				<span style="COLOR: rgb(0,0,255)">="internal"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">BlueIdea.com</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">a</span>
				<span style="COLOR: rgb(0,0,255)">&gt;&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">a </span>
				<span style="COLOR: rgb(255,0,0)">href</span>
				<span style="COLOR: rgb(0,0,255)">="http://www.51js.com"</span>
				<span style="COLOR: rgb(255,0,0)"> rel</span>
				<span style="COLOR: rgb(0,0,255)">="internal"</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">51Js.com</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">a</span>
				<span style="COLOR: rgb(0,0,255)">&gt;&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />[Input Test]</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">br </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;</span>
				<span style="COLOR: rgb(128,0,0)">input </span>
				<span style="COLOR: rgb(255,0,0)">type</span>
				<span style="COLOR: rgb(0,0,255)">="text"</span>
				<span style="COLOR: rgb(255,0,0)"> id</span>
				<span style="COLOR: rgb(0,0,255)">="search"</span>
				<span style="COLOR: rgb(255,0,0)"> value</span>
				<span style="COLOR: rgb(0,0,255)">="请输入关键字"</span>
				<span style="COLOR: rgb(255,0,0)"> size</span>
				<span style="COLOR: rgb(0,0,255)">="20"</span>
				<span style="COLOR: rgb(255,0,0)"> onFocus</span>
				<span style="COLOR: rgb(0,0,255)">="onSearchFocus()"</span>
				<span style="COLOR: rgb(255,0,0)"> onblur</span>
				<span style="COLOR: rgb(0,0,255)">="onSearchBlur()"</span>
				<span style="COLOR: rgb(255,0,0)"> </span>
				<span style="COLOR: rgb(0,0,255)">/&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">p</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">body</span>
				<span style="COLOR: rgb(0,0,255)">&gt;</span>
				<span style="COLOR: rgb(0,0,0)">
						<br />
				</span>
				<span style="COLOR: rgb(0,0,255)">&lt;/</span>
				<span style="COLOR: rgb(128,0,0)">html</span>
				<span style="COLOR: rgb(0,0,255)">&gt;<br /><br />from index：<a href="http://www.cnitblog.com/yemoo/archive/2006/06/25/12827.html">http://www.cnitblog.com/yemoo/archive/2006/06/25/12827.html</a></span>
		</div>
<img src ="http://www.blogjava.net/jaunt/aggbug/105558.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 14:47 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105558.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS检验密码安全性等级(收藏)</title><link>http://www.blogjava.net/jaunt/archive/2007/03/22/105550.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Thu, 22 Mar 2007 06:16:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2007/03/22/105550.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/105550.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2007/03/22/105550.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/105550.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/105550.html</trackback:ping><description><![CDATA[
		<font color="#993333">  JS检验密码安全性等级：（首先声明,本文非我原作）<br />  &lt;STYLE type=text/css&gt;<br />    body {<br />    font-size: 12px;<br />    font-family: Tahoma, Arial;<br />    background: #C4C8CB;<br />    margin: 0px;<br />    padding: 0px;<br />    }<br />    td {<br />    padding-left: 5px;<br />    font-size: 12px;<br />    font-family: Tahoma, Arial;<br />    }<br />    .blueFont {color: #6699CC}<br />    .redFont {color: #FF0000}<br />    /***** Other Elements in Page Content *****/<br />    .pwd-strength {<br />    padding: 2px;<br />    padding-left: 5px;<br />    padding-right: 5px;<br />    width: 180px;<br />    border: solid 1px #CCCCCC;<br />    }<br />    .pwd-strength-box,<br />    .pwd-strength-box-low,<br />    .pwd-strength-box-med,<br />    .pwd-strength-box-hi<br />    {<br />    color: #464646;<br />    text-align: center;<br />    width: 33%;<br />    }<br />    .pwd-strength-box-low<br />    {<br />    color: #990000;<br />    background-color: #FFECEC;<br />    }<br />    .pwd-strength-box-med<br />    {<br />    color: #000066;<br />    background-color: #D2E9FF;<br />    }<br />    .pwd-strength-box-hi<br />    {<br />    color: #003300;<br />    background-color: #DDFFDD;<br />    }<br />    &lt;/STYLE&gt;<br />    &lt;SCRIPT language=javascript&gt;<br />    function checkPassword(pwd){<br />    var objLow=document.getElementById("pwdLow");<br />    var objMed=document.getElementById("pwdMed");<br />    var objHi=document.getElementById("pwdHi");<br />    objLow.className="pwd-strength-box";<br />    objMed.className="pwd-strength-box";<br />    objHi.className="pwd-strength-box";<br />    if(pwd.length&lt;6){<br />    objLow.className="pwd-strength-box-low";<br />    }else{<br />    var p1= (pwd.search(/[a-zA-Z]/)!=-1) ? 1 : 0;<br />    var p2= (pwd.search(/[0-9]/)!=-1) ? 1 : 0;<br />    var p3= (pwd.search(/[^A-Za-z0-9_]/)!=-1) ? 1 : 0;<br />    var pa=p1+p2+p3;<br />    if(pa==1){<br />    objLow.className="pwd-strength-box-low";<br />    }else if(pa==2){<br />    objMed.className="pwd-strength-box-med";<br />    }else if(pa==3){<br />    objHi.className="pwd-strength-box-hi";<br />    }<br />    }<br />    }<br />    &lt;/SCRIPT&gt;<br />    &lt;BR&gt;<br />    &lt;TABLE borderColor=#ffffff cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 width=400 align=center bgColor=#ffffff border=1&gt;<br />    &lt;TBODY&gt;<br />    &lt;TR&gt;<br />    &lt;TD align=middle bgColor=#ffffcc colSpan=2 height=22&gt;&lt;SPAN class=blueFont&gt;&lt;B&gt;校验密码安全性&lt;/B&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;<br />    &lt;TR&gt;<br />    &lt;TD style="WIDTH: 100px"&gt;请输入密码：&lt;/TD&gt;<br />    &lt;TD&gt;&lt;INPUT onkeyup=checkPassword(this.value); type=password value="" name=password&gt;&lt;/TD&gt;&lt;/TR&gt;<br />    &lt;TR&gt;<br />    &lt;TD style="WIDTH: 100px"&gt;安全性等级：&lt;/TD&gt;<br />    &lt;TD&gt;<br />    &lt;TABLE class="pwd-strength FCK__ShowTableBorders" cellSpacing=0 cellPadding=0 width="100%"&gt;<br />    &lt;TBODY&gt;<br />    &lt;TR&gt;<br />    &lt;TD class=pwd-strength-box id=pwdLow&gt;低&lt;/TD&gt;<br />    &lt;TD class=pwd-strength-box id=pwdMed&gt;中&lt;/TD&gt;<br />    &lt;TD class=pwd-strength-box id=pwdHi&gt;高&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;<br />    &lt;TR&gt;<br />    &lt;TD colSpan=2&gt;&lt;SPAN class=redFont&gt;建议至少 6 个字符. 请使用强密码以保证安全.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;<br /><br />from index： </font>
		<a href="http://www.cnitblog.com/yemoo/archive/2006/07/04/13219.html">
				<font color="#993333">http://www.cnitblog.com/yemoo/archive/2006/07/04/13219.html </font>
		</a>
		<br />
<img src ="http://www.blogjava.net/jaunt/aggbug/105550.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2007-03-22 14:16 <a href="http://www.blogjava.net/jaunt/archive/2007/03/22/105550.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript中的继承(下)</title><link>http://www.blogjava.net/jaunt/archive/2006/11/28/84173.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Tue, 28 Nov 2006 15:14:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/28/84173.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/84173.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/28/84173.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/84173.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/84173.html</trackback:ping><description><![CDATA[
		<font face="Verdana" size="2">  作者：</font>
		<a href="/flyingis/" target="_blank">
				<font face="Verdana" color="#000080" size="2">Flyingis</font> </a>
		<br />  <font size="2">原载：</font><a href="/flyingis/archive/2006/07/15/58339.html"><font size="2">http://www.blogjava.net/flyingis/archive/2006/07/15/58339.html</font></a><br /><font face="Verdana" size="2">    <strong>Prototype</strong><br /><br />    </font><font face="Verdana" size="2">我们了解到任何prototype的属性和方法都会被传递到该类的所有实例中，利用这一特性，使用prototype也能实现继承。 <br />  </font><div><font face="Verdana"><font size="2"><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_18_20_Open_Image" onclick="this.style.display='none'; Codehighlighter1_18_20_Open_Text.style.display='none'; Codehighlighter1_18_20_Closed_Image.style.display='inline'; Codehighlighter1_18_20_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  <span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">ClassA() </span><span id="Codehighlighter1_18_20_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_18_20_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> ClassA.prototype.id </span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">1998</span><span style="COLOR: rgb(0,0,0)">;<br /><img id="Codehighlighter1_87_107_Open_Image" onclick="this.style.display='none'; Codehighlighter1_87_107_Open_Text.style.display='none'; Codehighlighter1_87_107_Closed_Image.style.display='inline'; Codehighlighter1_87_107_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> ClassA.prototype.sayId </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">()</span><span id="Codehighlighter1_87_107_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_87_107_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.id);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_129_131_Open_Image" onclick="this.style.display='none'; Codehighlighter1_129_131_Open_Text.style.display='none'; Codehighlighter1_129_131_Closed_Image.style.display='inline'; Codehighlighter1_129_131_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">ClassB()</span><span id="Codehighlighter1_129_131_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_129_131_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> ClassB.prototype</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)">ClassA();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> ClassB.prototype.name</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">""</span><span style="COLOR: rgb(0,0,0)">;<br /><img id="Codehighlighter1_231_253_Open_Image" onclick="this.style.display='none'; Codehighlighter1_231_253_Open_Text.style.display='none'; Codehighlighter1_231_253_Closed_Image.style.display='inline'; Codehighlighter1_231_253_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> ClassB.prototype.sayName</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">()</span><span id="Codehighlighter1_231_253_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_231_253_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div></font></font></div><font size="2"><br /><font face="Verdana">    需要注意的是，这种实现继承的方法不能将参数传入到ClassA的构造器中，是一个缺陷。ClassB的所有属性和方法必需在将ClassB的 prototype对象指向ClassA的实例之后进行附值。这样做是因为，prototype指向一个新的对象，在此之前prototype的属性和方法都被覆盖销毁。<br /><br />    对代码进行测试：<br /></font></font><div><font size="2"><br /><font face="Verdana"><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: rgb(0,0,255)">var</span><span style="COLOR: rgb(0,0,0)"> obj1 </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)">ClassA();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,255)">var</span><span style="COLOR: rgb(0,0,0)"> obj2</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"><font color="#0000ff">new</font> ClassB();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />obj1.id </span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">1998</span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />obj2.id</span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">2000</span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />obj2.name </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">悉尼奥运会</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />obj1.sayId();  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"1998"</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">obj2.sayId();  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"1998"</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">obj2.sayName();  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"悉尼奥运会"</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />alert(obj2</span><span style="COLOR: rgb(0,0,255)">instanceof</span><span style="COLOR: rgb(0,0,0)">ClassA);  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"true"</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">alert(obj2 </span><span style="COLOR: rgb(0,0,255)">instanceof</span><span style="COLOR: rgb(0,0,0)">ClassB);  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"true"</span></div></font></font></div><font size="2"><br /><font face="Verdana">    在上述代码中可以看出，使用prototype实现继承，instanceof操作符出现了另外的用途，在用构造起定义类实现继承时，instanceof不会出现这种效果。但是使用prototype不能支持多重继承。<br />  <br />    使用构造器定义类实现继承和使用prototype实现继承均存在各自的缺陷，要避免出现这些情况，只有将两者混合使用。<br /><br />    <strong>混合方法</strong><br /><br />    创建一个类的最佳方法，是使用构造器的方法去定义属性，使用prototype定义方法。在继承中同样如此。<br /><br /></font></font><div><font size="2"><font face="Verdana"><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_20_38_Open_Image" onclick="this.style.display='none'; Codehighlighter1_20_38_Open_Text.style.display='none'; Codehighlighter1_20_38_Closed_Image.style.display='inline'; Codehighlighter1_20_38_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  <span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">ClassA(id)</span> <span id="Codehighlighter1_20_38_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_20_38_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.id </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">id;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_77_97_Open_Image" onclick="this.style.display='none'; Codehighlighter1_77_97_Open_Text.style.display='none'; Codehighlighter1_77_97_Closed_Image.style.display='inline'; Codehighlighter1_77_97_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  ClassA.prototype.sayId</span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">() </span><span id="Codehighlighter1_77_97_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_77_97_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.id);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_127_174_Open_Image" onclick="this.style.display='none'; Codehighlighter1_127_174_Open_Text.style.display='none'; Codehighlighter1_127_174_Closed_Image.style.display='inline'; Codehighlighter1_127_174_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)"> ClassB(id, name) </span><span id="Codehighlighter1_127_174_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_127_174_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   <b><strong>ClassA.call(</strong></b></span><b><span style="COLOR: rgb(0,0,255)"><strong>this</strong></span></b><span style="COLOR: rgb(0,0,0)"><b><strong>, id)</strong></b>;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">name;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><strong>ClassB.prototype </strong></span><strong><span style="COLOR: rgb(0,0,0)">=</span>  <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">new</span></strong><span style="COLOR: rgb(0,0,0)"><strong> ClassA()</strong>;<br /><img id="Codehighlighter1_248_270_Open_Image" onclick="this.style.display='none'; Codehighlighter1_248_270_Open_Text.style.display='none'; Codehighlighter1_248_270_Closed_Image.style.display='inline'; Codehighlighter1_248_270_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> ClassB.prototype.sayName</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">()</span><span id="Codehighlighter1_248_270_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_248_270_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div></font></font></div><img src ="http://www.blogjava.net/jaunt/aggbug/84173.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-28 23:14 <a href="http://www.blogjava.net/jaunt/archive/2006/11/28/84173.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript 中的继承(上)</title><link>http://www.blogjava.net/jaunt/archive/2006/11/28/84161.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Tue, 28 Nov 2006 14:51:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/28/84161.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/84161.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/28/84161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/84161.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/84161.html</trackback:ping><description><![CDATA[
		<font face="Verdana" size="2">作者：</font>
		<a href="/flyingis/" target="_blank">
				<font face="Verdana" color="#000080" size="2">Flyingis</font>
		</a>
		<br />
		<font size="2">原载：</font>
		<a href="/flyingis/archive/2006/07/15/58290.html">
				<font size="2">http://www.blogjava.net/flyingis/archive/2006/07/15/58290.html</font>
		</a>
		<br />
		<br />
		<font face="Verdana" size="2">    继承是面向对象语言基本特征之一，通过继承可以将父类所具有的特性遗传到子类。ECMAScript中的继承不像Java、C++等语言那么明显，直接通过关键字来实现，通常它是通过模拟方式来实现继承功能的，并且实现方式有多种。<br /><br />    在继承中引入this关键字，使用构造器方法定义类来实现继承。一个构造器是一个函数，因此可以将父类的构造器作为子类的一个方法使用并进行调用。<br /></font>
		<font size="2">
				<br />
				<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
						<font face="Verdana">
								<font size="2">
										<img id="Codehighlighter1_20_93_Open_Image" onclick="this.style.display='none'; Codehighlighter1_20_93_Open_Text.style.display='none'; Codehighlighter1_20_93_Closed_Image.style.display='inline'; Codehighlighter1_20_93_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
								</font>  <span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">ClassA(id)</span> <span id="Codehighlighter1_20_93_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span></font>
						<span id="Codehighlighter1_20_93_Open_Text">
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.id</span>
										<span style="COLOR: rgb(0,0,0)">=</span>
								</font>
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">id;<br /><img id="Codehighlighter1_64_90_Open_Image" onclick="this.style.display='none'; Codehighlighter1_64_90_Open_Text.style.display='none'; Codehighlighter1_64_90_Closed_Image.style.display='inline'; Codehighlighter1_64_90_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.sayId </span>
										<span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">() </span><span id="Codehighlighter1_64_90_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span></font>
								<span id="Codehighlighter1_64_90_Open_Text">
										<font face="Verdana">
												<span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />     alert(</span>
												<span style="COLOR: rgb(0,0,255)">this</span>
										</font>
										<span style="COLOR: rgb(0,0,0)">
												<font face="Verdana">.id);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</font>
										</span>
								</span>
								<span style="COLOR: rgb(0,0,0)">
										<font face="Verdana">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</font>
								</span>
						</span>
						<font face="Verdana">
						</font>
						<span style="COLOR: rgb(0,0,0)">
								<br />
								<font face="Verdana">
										<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
										<br />
										<img id="Codehighlighter1_122_276_Open_Image" onclick="this.style.display='none'; Codehighlighter1_122_276_Open_Text.style.display='none'; Codehighlighter1_122_276_Closed_Image.style.display='inline'; Codehighlighter1_122_276_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  </font>
						</span>
						<font face="Verdana">
								<span style="COLOR: rgb(0,0,255)">function</span>
								<span style="COLOR: rgb(0,0,0)">ClassB(id, name) </span>
								<span id="Codehighlighter1_122_276_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">
								</span>
						</font>
						<span id="Codehighlighter1_122_276_Open_Text">
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.newMethod</span>
										<span style="COLOR: rgb(0,0,0)">=</span>
								</font>
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">ClassA;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
								</font>
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">.newMethod(id);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">delete</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">this</span>.</font>
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">newMethod;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.name</span>
										<span style="COLOR: rgb(0,0,0)">=</span>
								</font>
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">name;<br /><img id="Codehighlighter1_247_273_Open_Image" onclick="this.style.display='none'; Codehighlighter1_247_273_Open_Text.style.display='none'; Codehighlighter1_247_273_Closed_Image.style.display='inline'; Codehighlighter1_247_273_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.sayName</span>
										<span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">()</span><span id="Codehighlighter1_247_273_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span></font>
								<span id="Codehighlighter1_247_273_Open_Text">
										<font face="Verdana">
												<span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />     alert(</span>
												<span style="COLOR: rgb(0,0,255)">this</span>
										</font>
										<span style="COLOR: rgb(0,0,0)">
												<font face="Verdana">.name);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</font>
										</span>
								</span>
								<span style="COLOR: rgb(0,0,0)">
										<font face="Verdana">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</font>
								</span>
						</span>
						<font face="Verdana">
						</font>
				</div>
		</font>
		<font face="Verdana" size="2">
				<br />    注意，子类中所有新的属性和方法都必需在删除newMethod后引入，否则，可能存在用父类的属性和方法重写子类属性和方法的危险。另外，使用这种方法还可以实现多重继承，此时如果两个父类具有相同的属性或方法时，最后的类具有优先级。由于这种继承方法比较流行，ECMAScript第三版引入了两个 Function对象：call()和apply()。<br /><br />    <strong>call()</strong><br /><br />    call()方法是最接近上述继承方式的方法，它的第一个参数是this指向的对象，所有的其他参数都直接传到function。<br /></font>
		<div>
				<font face="Verdana" size="2">
						<br />
						<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
								<img id="Codehighlighter1_34_71_Open_Image" onclick="this.style.display='none'; Codehighlighter1_34_71_Open_Text.style.display='none'; Codehighlighter1_34_71_Closed_Image.style.display='inline'; Codehighlighter1_34_71_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  <span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">sayMessage(first, last)</span> <span id="Codehighlighter1_34_71_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_34_71_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(first </span><span style="COLOR: rgb(0,0,0)">+</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.logic </span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">last);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,255)">var</span><span style="COLOR: rgb(0,0,0)">obj </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> Object();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> obj.logic </span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">or</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img style="WIDTH: 11px; HEIGHT: 16px" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> sayMessage.call(obj,</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">Coffee </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">, </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">Tea</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"Coffee or Tea"</span></div>
				</font>
		</div>
		<font face="Verdana" size="2">
				<br />    用call()方法来实现继承，只需要this.newMethod相关的三行代码。<br /></font>
		<div>
				<font face="Verdana" size="2">
						<br />
						<font face="Verdana" size="2">
								<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
										<img id="Codehighlighter1_26_230_Open_Image" onclick="this.style.display='none'; Codehighlighter1_26_230_Open_Text.style.display='none'; Codehighlighter1_26_230_Closed_Image.style.display='inline'; Codehighlighter1_26_230_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />  <span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">ClassB(id, name)</span> <span id="Codehighlighter1_26_230_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_26_230_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>  <span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this.newMethod = ClassA;</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this.newMethod(id);</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">delete this.newMethod;</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  ClassA.call(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">, id);  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this指向ClassB的对象</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">name;<br /><img id="Codehighlighter1_201_227_Open_Image" onclick="this.style.display='none'; Codehighlighter1_201_227_Open_Text.style.display='none'; Codehighlighter1_201_227_Closed_Image.style.display='inline'; Codehighlighter1_201_227_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.sayName </span><span style="COLOR: rgb(0,0,0)">=</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">() </span><span id="Codehighlighter1_201_227_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_201_227_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />     alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div>
						</font>
				</font>
				<font face="Verdana" size="2">
						<br />    <strong>apply()</strong><br /><br />    apply()方法需要两个参数：this所指向的对象，和传到function的由参数组成的array。<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_34_71_Open_Image" onclick="this.style.display='none'; Codehighlighter1_34_71_Open_Text.style.display='none'; Codehighlighter1_34_71_Closed_Image.style.display='inline'; Codehighlighter1_34_71_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)"> sayMessage(first, last)  </span><span id="Codehighlighter1_34_71_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_34_71_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  alert(first </span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.logic </span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">last);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: rgb(0,0,255)">var</span><span style="COLOR: rgb(0,0,0)"> obj </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> Object();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />obj.logic </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">or</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />sayMessage.apply(obj, </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> Array(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">Coffee </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">, </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)"> Tea</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">));  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">输出"Coffee or Tea"</span></div></font>
				<font face="Verdana" size="2">  <br />    同样，使用 apply() 实现继承可以通过如下方法实现。<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_26_242_Open_Image" onclick="this.style.display='none'; Codehighlighter1_26_242_Open_Text.style.display='none'; Codehighlighter1_26_242_Closed_Image.style.display='inline'; Codehighlighter1_26_242_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)"> ClassB(id, name) </span><span id="Codehighlighter1_26_242_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_26_242_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this.newMethod = ClassA;</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this.newMethod(id);</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">delete this.newMethod;</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)">  ClassA.apply(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">, </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> Array(id));  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">this指向ClassB的对象</span><span style="COLOR: rgb(0,128,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> name;<br /><img id="Codehighlighter1_213_239_Open_Image" onclick="this.style.display='none'; Codehighlighter1_213_239_Open_Text.style.display='none'; Codehighlighter1_213_239_Closed_Image.style.display='inline'; Codehighlighter1_213_239_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.sayName </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)">() </span><span id="Codehighlighter1_213_239_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_213_239_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.name);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: rgb(0,0,0)">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div></font>
				<font size="2">
						<font face="Verdana">
								<br />    当父类构造器的参数和子类构造器参数的顺序一致时，可以使用子类的arguments对象作为第二个参数。否则，必需创建一个array来传递参数，或是使用call()方法。<br /><br />    <a href="/flyingis/archive/2006/07/15/58339.html" target="_blank"><font color="#000080">文章待续……</font></a></font>
						<font face="宋体, MS Song">
						</font>
				</font>
		</div>
<img src ="http://www.blogjava.net/jaunt/aggbug/84161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-28 22:51 <a href="http://www.blogjava.net/jaunt/archive/2006/11/28/84161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>"this" of JavaScript你理解有多少？</title><link>http://www.blogjava.net/jaunt/archive/2006/11/27/83825.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Mon, 27 Nov 2006 08:48:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/27/83825.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/83825.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/27/83825.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/83825.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/83825.html</trackback:ping><description><![CDATA[
		<font face="Verdana" size="2">译者：<a href="/flyingis/" target="_blank"><font color="#000080">Flyingis</font></a><br />编辑：<a href="/jaunt">Jaunt<br /></a>原载：<a href="/flyingis/archive/2006/09/15/69888.html">http://www.blogjava.net/flyingis/archive/2006/09/15/69888.html</a><br /><br />this是JavaScript中功能最强大的关键字之一。<br /></font>
		<h3 id="link1">
				<font face="Verdana" size="2">Owner</font>
		</h3>
		<p>
				<font face="Verdana" size="2">接下来文章中我们将要讨论的问题是：在函数doSomething()中this所指的是什么？<br /></font>
				<br />
		</p>
		<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
				<font size="2">
						<font face="Verdana">
								<img id="Codehighlighter1_23_57_Open_Image" onclick="this.style.display='none'; Codehighlighter1_23_57_Open_Text.style.display='none'; Codehighlighter1_23_57_Closed_Image.style.display='inline'; Codehighlighter1_23_57_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
								<span style="COLOR: rgb(0,0,255)">function</span>
								<span style="COLOR: rgb(0,0,0)"> doSomething() </span>
								<span id="Codehighlighter1_23_57_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)">
								</span>
						</font>
				</font>
				<span id="Codehighlighter1_23_57_Open_Text">
						<font size="2">
								<font face="Verdana">
										<span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
										<span style="COLOR: rgb(0,0,255)">this</span>
										<span style="COLOR: rgb(0,0,0)">.style.color </span>
										<span style="COLOR: rgb(0,0,0)">=</span>
								</font>
						</font>
						<span style="COLOR: rgb(0,0,0)">
								<font size="2">
										<font face="Verdana"> '#cc0000';<br /><strong><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</strong></font>
								</font>
						</span>
				</span>
		</div>
		<br />
		<font face="Verdana" size="2">在JavaScript中，this通常指向的是我们正在执行的函数本身，或者是，指向该函数所属的对象。当我们在页面中定义了函数doSomething()的时候，或者是JavaScript中的window对象（或global对象）。对于一个onclick属性，它为它所属的HTML元素所拥有，this应该指向该HTML元素。<br /><br />这种“所有权”就是JavaScript中面向对象的一种方式。 <br /></font>
		<p>
		</p>
		<p align="center">
				<font face="Verdana" size="2">
						<img height="260" alt="this1.gif" src="http://www.blogjava.net/images/blogjava_net/flyingis/this1.gif" width="530" border="0" />
				</font>
		</p>
		<font face="Verdana" size="2">如果我们在没有任何更多准备情况下执行doSomething()，this关键字会指向window，并且该函数试图改变window的 style.color。因为window并没有style对象，这个函数将非常不幸的运行失败，并产生JavaScript错误。<br /><br /></font>
		<font face="Verdana">
				<font size="2">
						<strong>Copying<br /></strong>  <br />因此如果我们想充分利用this，我们不得不注意使用this的函数应该被正确的HTML元素所拥有。换句话说，我们应该复制这个函数到我们的onclick属性。</font>
		</font>
		<font face="Verdana" size="2">
				<br />
		</font>
		<strong>
				<br />
		</strong>
		<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
				<font face="Verdana" size="2">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</font>
				<span style="COLOR: rgb(0,0,0)">element.onclick </span>
				<span style="COLOR: rgb(0,0,0)">=</span>
				<span style="COLOR: rgb(0,0,0)"> doSomething;</span>
		</div>
		<font face="Verdana" size="2">
				<br />这个函数被完整复制到onclick属性（现在成为了函数）。因此如果这个event handler被执行，this将指向HTML元素，并且该元素的颜色得以改变。<br /><br /><p align="center"><img height="258" alt="this2.gif" src="http://www.blogjava.net/images/blogjava_net/flyingis/this2.gif" width="529" border="0" /></p>这种方法使得我们能够复制这个函数到多个event handler。每次this都将指向正确的HTML元素：<br /><br /><p align="center"><img height="416" alt="this3.gif" src="http://www.blogjava.net/images/blogjava_net/flyingis/this3.gif" width="532" border="0" /></p><br />这样你就可以最大限度使用this。每当执行该函数，this所指向的HTML元素都正确响应事件，这些HTML元素拥有doSomething()的一个拷贝。<br /><br /><strong>Referring<br /><br /></strong>然而，如果你使用<a href="http://www.quirksmode.org/js/events_early.html" target="_blank"><font color="#000080">inline event registration</font></a>(内联事件注册)<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">element </span><span style="COLOR: rgb(255,0,0)">onclick</span><span style="COLOR: rgb(0,0,255)">="doSomething()"</span><span style="COLOR: rgb(0,0,255)">&gt;</span></div><br />你将不能拷贝该函数！反而这种差异是非常关键的。onclick属性并不包含实际的函数，仅仅是一个函数调用。<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: rgb(0,0,0)">doSomething();</span></div><br />因此，它将声明“转到doSomething()并且执行它”。当我们到达doSomething()，this关键字又重新指向了全局的window对象，函数返回错误信息。<br /><br /><p align="center"><img height="276" alt="this4.gif" src="http://www.blogjava.net/images/blogjava_net/flyingis/this4.gif" width="530" border="0" /></p><font size="3"><strong>The difference</strong></font><br /><br />如果你想使用this来指向HTML元素响应的事件，你必须确保this关键字被写在onclick属性里。只有在这种情况下它才指向event handler所注册的HTML元素。<br />  <br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: rgb(0,0,0)">element.onclick </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> doSomething;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />alert(element.onclick)</span></div><br />你将得到<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_23_57_Open_Image" onclick="this.style.display='none'; Codehighlighter1_23_57_Open_Text.style.display='none'; Codehighlighter1_23_57_Closed_Image.style.display='inline'; Codehighlighter1_23_57_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)"> doSomething() </span><span id="Codehighlighter1_23_57_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_23_57_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: rgb(0,0,255)">this</span><span style="COLOR: rgb(0,0,0)">.style.color </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> '#cc0000';<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br />正如你所见，this关键字被展现在onclick函数中，因此它指向HTML元素。<br />但是如果执行<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">element </span><span style="COLOR: rgb(255,0,0)">onclick</span><span style="COLOR: rgb(0,0,255)">="doSomething()"</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />alert(element.onclick)</span></div><br />你将得到<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><img id="Codehighlighter1_19_37_Open_Image" onclick="this.style.display='none'; Codehighlighter1_19_37_Open_Text.style.display='none'; Codehighlighter1_19_37_Closed_Image.style.display='inline'; Codehighlighter1_19_37_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><span style="COLOR: rgb(0,0,255)">function</span><span style="COLOR: rgb(0,0,0)"> onclick() </span><span id="Codehighlighter1_19_37_Closed_Text" style="BORDER-RIGHT: rgb(128,128,128) 1px solid; BORDER-TOP: rgb(128,128,128) 1px solid; DISPLAY: none; BORDER-LEFT: rgb(128,128,128) 1px solid; BORDER-BOTTOM: rgb(128,128,128) 1px solid; BACKGROUND-COLOR: rgb(255,255,255)"></span><span id="Codehighlighter1_19_37_Open_Text"><span style="COLOR: rgb(0,0,0)">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  doSomething()<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br />这仅仅是到doSomething()函数的一个引用。this关键字并没有出现在onclick函数中，因此它不指向HTML元素。</font>
<img src ="http://www.blogjava.net/jaunt/aggbug/83825.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-27 16:48 <a href="http://www.blogjava.net/jaunt/archive/2006/11/27/83825.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>认识for…in 循环语句</title><link>http://www.blogjava.net/jaunt/archive/2006/11/26/83562.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Sun, 26 Nov 2006 02:09:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/26/83562.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/83562.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/26/83562.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/83562.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/83562.html</trackback:ping><description><![CDATA[
		<font color="#ffa500">
				<strong>for...in循环的Javascript示例：</strong>
				<br />
		</font>
		<font color="#808080">&lt;html&gt;<br />&lt;head&gt;<br />&lt;title&gt;一个使用到for...in循环的Javascript示例&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&lt;script type="text/javascript"&gt;<br />// 创建一个对象 myObject 以及三个属性 sitename, siteurl, sitecontent。<br />var myObject = new Object();<br />myObject.sitename = "布啦布啦";<br />myObject.siteurl = "blabla.cn";<br />myObject.sitecontent = "网页教程代码图库的中文站点";<br />//遍历对象的所有属性<br />for (prop in myObject)<br />{<br />document.write("属性 '" + prop + "' 为 " + myObject[prop]);<br />document.write("&lt;br&gt;");<br />}<br />&lt;/script&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br /><font color="#ffa500"><strong>今天网上Java Tang博客找到了一个用来遍历JavaScript某个对象所有的属性名称和值的方法，这样想使用方法的时候非常的直观和方便。代码如下：</strong></font><br /></font>
		<div class="hl-surround">
				<ol class="hl-main ln-show" ondblclick="linenumber(this)" title="Double click to hide line number.">
						<li class="hl-firstline">
								<span style="COLOR: rgb(255,165,0)">/*</span>
						</li>
						<li>
								<span style="COLOR: rgb(255,165,0)">* 用来遍历指定对象所有的属性名称和值</span>
						</li>
						<li>
								<span style="COLOR: rgb(255,165,0)">* obj 需要遍历的对象</span>
						</li>
						<li>
								<span style="COLOR: rgb(255,165,0)">* author: Jet Mah</span>
						</li>
						<li>
								<span style="COLOR: rgb(255,165,0)">* website: </span>
								<span style="COLOR: blue">http://www.javatang.com/archives/2006/09/13/442864.html</span>
						</li>
						<li>
								<span style="COLOR: rgb(255,165,0)">*/</span>
						</li>
						<li>
								<span style="COLOR: green">function</span>
								<span style="COLOR: gray"> </span>
								<span style="COLOR: blue">allPrpos</span>
								<span style="COLOR: olive">(</span>
								<span style="COLOR: blue">obj</span>
								<span style="COLOR: olive">)</span>
								<span style="COLOR: gray">
								</span>
								<span style="COLOR: olive">{</span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: rgb(255,165,0)">// 用来保存所有的属性名称和值 </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: green">var</span>
								<span style="COLOR: gray"> </span>
								<span style="COLOR: blue">props</span>
								<span style="COLOR: gray">= </span>
								<span style="COLOR: rgb(139,0,0)">""</span>
								<span style="COLOR: gray">; </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: rgb(255,165,0)">// 开始遍历 </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: green">for</span>
								<span style="COLOR: olive">(</span>
								<span style="COLOR: green">var</span>
								<span style="COLOR: gray"> </span>
								<span style="COLOR: blue">p</span>
								<span style="COLOR: gray">
								</span>
								<span style="COLOR: green">in</span>
								<span style="COLOR: gray">
								</span>
								<span style="COLOR: blue">obj</span>
								<span style="COLOR: olive">){</span>
								<span style="COLOR: gray">  </span>
						</li>
						<li>
								<span style="COLOR: gray">        </span>
								<span style="COLOR: rgb(255,165,0)">// 方法 </span>
						</li>
						<li>
								<span style="COLOR: gray">        </span>
								<span style="COLOR: green">if</span>
								<span style="COLOR: olive">(</span>
								<span style="COLOR: green">typeof</span>
								<span style="COLOR: olive">(</span>
								<span style="COLOR: blue">obj</span>
								<span style="COLOR: olive">[</span>
								<span style="COLOR: blue">p</span>
								<span style="COLOR: olive">])</span>
								<span style="COLOR: gray">==</span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: red">function</span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: olive">){</span>
								<span style="COLOR: gray">  </span>
						</li>
						<li>
								<span style="COLOR: gray">            </span>
								<span style="COLOR: blue">obj</span>
								<span style="COLOR: olive">[</span>
								<span style="COLOR: blue">p</span>
								<span style="COLOR: olive">]()</span>
								<span style="COLOR: gray">; </span>
						</li>
						<li>
								<span style="COLOR: gray">        </span>
								<span style="COLOR: olive">}</span>
								<span style="COLOR: green">else</span>
								<span style="COLOR: olive">{</span>
								<span style="COLOR: gray"> </span>
						</li>
						<li>
								<span style="COLOR: gray">            </span>
								<span style="COLOR: rgb(255,165,0)">// p 为属性名称，obj[p]为对应属性的值 </span>
						</li>
						<li>
								<span style="COLOR: gray">            </span>
								<span style="COLOR: blue">props</span>
								<span style="COLOR: gray">+= </span>
								<span style="COLOR: blue">p</span>
								<span style="COLOR: gray">+ </span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: red">=</span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: gray">+ </span>
								<span style="COLOR: blue">obj</span>
								<span style="COLOR: olive">[</span>
								<span style="COLOR: blue">p</span>
								<span style="COLOR: olive">]</span>
								<span style="COLOR: gray">+ </span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: navy">\t</span>
								<span style="COLOR: rgb(139,0,0)">"</span>
								<span style="COLOR: gray">; </span>
						</li>
						<li>
								<span style="COLOR: gray">        </span>
								<span style="COLOR: olive">}</span>
								<span style="COLOR: gray">  </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: olive">}</span>
								<span style="COLOR: gray">  </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: rgb(255,165,0)">// 最后显示所有的属性 </span>
						</li>
						<li>
								<span style="COLOR: gray">    </span>
								<span style="COLOR: blue">alert</span>
								<span style="COLOR: olive">(</span>
								<span style="COLOR: blue">props</span>
								<span style="COLOR: olive">)</span>
								<span style="COLOR: gray">;</span>
						</li>
						<li>
								<span style="COLOR: olive">}</span>
						</li>
				</ol>
		</div>
		<p>
				<span style="COLOR: olive">
				</span>
				<span style="COLOR: olive">
						<font color="#ffa500">
								<strong>AJAX的JavaScript的反射机制,反射机制指的是程序在运行时能够获取自身的信息。例如一个对象能够在运行时知道自己有哪些方法和属性。 在JavaScript中利用for(…in…)语句实现反射，其语法如下：</strong>
						</font>
				</span>
		</p>
		<p>
				<code>for(var p in obj){ <br />//语句 <br />}<br /><br />在Ajax编程中，经常要能动态的改变界面元素的样式，这可以通过对象的style属性来改变，比如要改变背景色为红色，可以这样写：<br />element.style.backgroundColor="#ff0000";<br /><br />基本上CSS里拥有的属性在JavaScript中都能够使用：<br />function setStyle(_style){ <br />//得到要改变样式的界面对象 <br />var element=getElement(); <br />element.style=_style; <br />}<br /><br />直接将整个style对象作为参数传递了进来：<br />var style={ <br />color:#ffffff, <br />backgroundColor:#ff0000, <br />borderWidth:2px <br />}<br /><br />这时可以这样调用函数：<br />setStyle(style);<br /><br />或者直接写为：<br />setStyle({ color:#ffffff,backgroundColor:#ff0000,borderWidth:2px});<br /><br />这段代码看上去没有任何问题，但实际上，在setStyle函数内部使用参数_style为element.style赋值时，如果element原先已经有了一定的样式，例如曾经执行过：<br />element.style.height="20px";<br /><br />而_style中却没有包括对height的定义，因此element的height样式就丢失了，不是最初所要的结果。要解决这个问题，可以用反射机制来重写setStyle函数：<br />function setStyle(_style){ <br />//得到要改变样式的界面对象 <br />var element=getElement(); <br />for(var p in _style){ <br />element.style[p]=_style[p]; <br />} <br />}<br /><br />程序中遍历_style的每个属性，得到属性名称，然后再使用方括号语法将element.style中的对应的属性赋值为_style中的相应属性的值。从而，element中仅改变指定的样式，而其他样式不会改变，得到了所要的结果。^-^</code>
		</p>
<img src ="http://www.blogjava.net/jaunt/aggbug/83562.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-26 10:09 <a href="http://www.blogjava.net/jaunt/archive/2006/11/26/83562.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript 调试工具</title><link>http://www.blogjava.net/jaunt/archive/2006/11/25/83535.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Sat, 25 Nov 2006 14:32:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/25/83535.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/83535.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/25/83535.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/83535.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/83535.html</trackback:ping><description><![CDATA[
		<p>JavaScript 调试工具 <br /><br />    作者：Flyingis<br />  <br />    JavaScript代码看起来总是要比Java、C#乱的多，可能是自己还不熟悉JavaScript编程，因此一款优秀的JavaScript调试器就显得格外重要。目前在网络和书上见到最多的有：</p>
		<p>    Microsoft Script Debugger: 集成在IE中的一款很原始的调试工具，具备基本的调试功能，除了可以用于调试客户端脚本，还能调试在Microsoft IIS上运行的服务器端脚本。该工具命令窗口是基于文本的，针对VBScript和IE环境进行调试会更加适用。 <br />  <br />    Firefox JavaScript Console: 可以记录JavaScript中出现的所有警告和错误，诊断出大多数错误。工具比较简单实用。 <br />  <br />    Venkman: 一个基于Mozilla的浏览器的JavaScript调试环境，是Mozilla浏览器的一个扩展。Venkman基于Mozilla JavaScript调试API（js/jsd），js/jsd API 构成了 Netscape JavaScript Debugger 1.1的基础，Netscape浏览器4.x系统都提供了这个调试工具。Venkman是目前比较流行的JavaScript调试工具。</p>
		<p>    相关下载：<br />    <a href="http://www.hacksrus.com/~ginda/venkman/">http://www.hacksrus.com/~ginda/venkman/</a><br />    上面最新的版本是0.9.85，对于Firefox只能支持1.5以前的版本。<br />    <a href="https://dwr.dev.java.net/files/documents/2427/22010/venkman-0.9.85.jw2.xpi">https://dwr.dev.java.net/files/documents/2427/22010/venkman-0.9.85.jw2.xpi</a><br />    venkman-0.9.85.jw2.xpi是venkman-0.9.85xpi的修改版本，可以支持Firefox 1.5.0。 <br />    <a href="https://addons.mozilla.org/firefox/216/">https://addons.mozilla.org/firefox/216/</a><br />    在Mozilla官方站点上，venkman有了另外的一个名称——JavaScript Debugger，已经发布了0.9.87版本，支   持Firefox 0.9-3.0，Mozilla 1.0-1.8，Thunderbird 0.9-3.0的所有版本浏览器。<br />    除了官方网站外，该工具的扩展安装也可以通过链接<br />    <a href="/Files/flyingis/javascript_debugger-0.9.87.rar">http://www.blogjava.net/Files/flyingis/javascript_debugger-0.9.87.rar</a>进行本地下载。<br />  <br />    另外有一些JavaScript专用IDE，有兴趣可以试用一下：<br />  <br />    <a href="http://home.earthlink.net/~mafriedman/ide/">Cardinal JavaScript IDE:<br /></a>    <br />    <a href="http://www.basement.org/archives/2005/09/js_eclipse_javascript_ide%20for.html">JavaScript IDE for Eclipse:</a><br />    <br />    <a href="http://www.downloadjunction.com/product/software/42264/index.html">JavaScript IDE(共享软件):<br /></a><br />----------------------------------------------------------------------------------------------------<br /><br />本人现在用的是<a href="https://addons.mozilla.org/firefox/1843/ ">firebug</a>，是一个非常好的小工具集合，它的一些小功能非常方便。比以上的都好.... </p>   <img src ="http://www.blogjava.net/jaunt/aggbug/83535.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-25 22:32 <a href="http://www.blogjava.net/jaunt/archive/2006/11/25/83535.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript：世界上误解最深的语言(转载)</title><link>http://www.blogjava.net/jaunt/archive/2006/11/25/83401.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Fri, 24 Nov 2006 16:24:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/25/83401.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/83401.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/25/83401.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/83401.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/83401.html</trackback:ping><description><![CDATA[
		<span class="tpc_content"> JavaScript:The World's Most Misunderstood Programming Language<br /><br />JavaScript：世界上误解最深的语言<br /><br />Douglas Crockford<br /><br />翻译：袁晓辉<br /><br />JavaScript, aka Mocha, aka LiveScript, aka JScript, aka ECMAScript, is one of the world's most popular programming languages. Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use. JavaScript's popularity is due entirely to its role as the scripting language of the WWW.<br /><br />JavaScript，或者叫 Mocha，或者叫 LiveScript，或者叫 JScript，又或者叫 ECMAScript，是世界上最流行的编程语言之一。事实上世界上的每一台个人电脑都安装并在频繁使用至少一个JavaScript解释器。 JavaScript的流行完全是由于他在WWW脚本语言领域中的地位决定的。<br /><br />Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented general-purpose programming language. How can this be a secret? Why is this language so misunderstood?<br /><br />尽管它很流行，但是很少有人知道JavaScript是一个非常棒的动态面向对象通用编程语言。这居然能成为一个秘密！这门语言为什么被误解如此之深？<br /><br />The Name<br />名字<br /><br />The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. It seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language.<br /><br />Java- 前缀很容易使人联想到Java，并认为它是Java的子集或简化版的Java。看起来最初给它选这个名字是别有用心的，是故意混淆概念、故意制造"误解" 的。JavaScript不是解释执行的Java。Java是解释执行的Java。JavaScript是另外一种语言。<br /><br />JavaScript has a syntactic similarity to Java, much as Java has to C. But it is no more a subset of Java than Java is a subset of C. It is better than Java in the applications that Java (fka Oak) was originally intended for.<br /><br />JavaScript的语法和Java有相似之处，这就像Java的语法和C很相像一样。但是它不是Java的子集，就像Java不是C的子集一样。它在Java（Oak）最初打算进军的领域中比Java更好。<br /><br />JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn't confusing enough.<br /><br />JavaScript不是Sun Microsystems的产品，Sun是Java的家。JavaScript是在Netscape被开发出来的。它最初叫LiveScript，嗯……还是这个名字好。<br /><br />The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language. But it is really a matter of specialization. Compared to C, JavaScript trades performance for expressive power and dynamism.<br /><br />-Script后缀让人认为他不是一门真正的编程语言，和一门"编程语言"还有相当的差距。但是这只是应用领域的问题。和C相比，JavaScript是牺牲了性能但换来了丰富的表现力和灵活的形态。<br /><br />Lisp in C's Clothing<br />披着C皮的Lisp<br /><br />JavaScript's C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.<br /><br />JavaScript的类C语法，包括大括号和语句的形式，让它看起来像普通的面向过程编程语言。这是一种误解，因为JavaScript和函数式语言，比如 Lisp 或 Scheme，有更多的相似之处，而不是和C或Java。它使用数组而不是列表，使用对象而不是属性列表。函数是第一位的，它有闭包（closures 怎么翻译？？），另外你还可以使用lambda表达式。<br /><br />Typecasting<br />类型转换<br /><br />JavaScript was designed to run in Netscape Navigator. Its success there led to it becoming standard equipment in virtually all web browsers. This has resulted in typecasting. JavaScript is the George Reeves of programming languages. JavaScript is well suited to a large class of non-Web-related applications<br /><br />JavaScript最初被设计成在Netscape Navigator中运行，它在Navigator中的成功引领它成为事实上所有web浏览器的标准装备。这就造就了"类型转换"。JavaScript 是编程语言中的 George Reeves（超人），是大量非web程序的称职之选。<br /><br />Moving Target<br />移动靶<br /><br />The first versions of JavaScript were quite weak. They lacked exception handling, inner functions, and inheritance. In its present form, it is now a complete object-oriented programming language. But many opinions of the language are based on its immature forms.<br /><br />JavaScript的最初几版非常弱，没有异常处理，没有内部函数和继承。现如今，它已经成为完全面向对象的编程语言。但是这门语言的许多思想是基于它不成熟的形式的。<br /><br />The ECMA committee that has stewardship over the language is developing extensions which, while well intentioned, will aggravate one of the language's biggest problems: There are already too many versions. This creates confusion.<br /><br />ECMA委员会，这门语言的管家，正在对它进行扩展，也在蓄意恶化它最大的问题：有太多的版本。这是混乱的根源。<br /><br />Design Errors<br />设计上的错误<br /><br />No programming language is perfect. JavaScript has its share of design errors, such as the overloading of + to mean both addition and concatenation with type coercion, and the error-prone with statement should be avoided. The reserved word policies are much too strict. Semicolon insertion was a huge mistake, as was the notation for literal regular expressions. These mistakes have led to programming errors, and called the design of the language as a whole into question. Fortunately, many of these problems can be mitigated with a good lint program.<br /><br />没有什么编程语言是完美的。JavaScript也有它设计上的错误，比如重载的+号随着类型的不同既表示"相加"又表示"连接"，和本该避免的有错误倾向的 with 语句。它的保留字策略过于严格。分号的插入是一个巨大的错误，比如作为字面正则表达式的符号时。这些失误已直接导致编程中的错误，也使这门语言的整体设计遭人质疑。还好，这些问题中有许多都可以在良好的 lint 程序中得以缓解。<br /><br />The design of the language on the whole is quite sound. Surprisingly, the ECMAScript committee does not appear to be interested in correcting these problems. Perhaps they are more interested in making new ones.<br /><br />这门语言的整体设计（上的问题）是相当明显的。奇怪的是ECMAScript委员会并没有对修正其中存在的问题表现出太大的兴趣，也许他们更热衷于制造新的问题。<br /><br />Lousy Implementations<br />糟糕的实现<br /><br />Some of the earlier implementations of JavaScript were quite buggy. This reflected badly on the language. Compounding that, those implementations were embedded in horribly buggy web browsers.<br /><br />JavaScript的一些早期实现有许多bug，这反过来对语言本身产生了很坏的影响。更糟糕的是这些满是bug的实现是嵌入在满是bug的web浏览器中的。<br /><br />Bad Books<br />糟糕的书<br /><br />Nearly all of the books about JavaScript are quite awful. They contain errors, poor examples, and promote bad practices. Important features of the language are often explained poorly, or left out entirely. I have reviewed dozens of JavaScript books, and I can only recommend one: JavaScript: The Definitive Guide (4th Edition) by David Flanagan. (Attention authors: If you have written a good one, please send me a review copy.)<br /><br />几乎所有的JavaScript书都是相当可怕的。它们包含错误，包含不好的例子，并鼓励不好的做法。 JavaScript语言的一些重要特性它们要么没有解释清楚，要么根本就没有提及。我看过很多JavaScript的书，但我只能推荐一本：David Flanagan著的 JavaScript: The Definitive Guide (4th Edition) （《JavaScript权威指南 第四版》）。（作者们请注意：如果你们写出了好书请发给我一份副本，我给你们校对。）<br /><br />Substandard Standard<br />“准标准”的标准<br /><br />The official specification for the language is published by ECMA. The specification is of extremely poor quality. It is difficult to read and very difficult to understand. This has been a contributor to the Bad Book problem because authors have been unable to use the standard document to improve their own understanding of the language. ECMA and the TC39 committee should be deeply embarrassed.<br /><br />ECMA公布的官方语言规范的质量极其的差。不仅难读而且极其难懂。它可为那些"糟糕的书"做出了不小的贡献，因为那些作者无法通过这个标准文档来更深地理解这门语言。ECMA和TC39应该为此感到非常尴尬。<br /><br />Amateurs<br />业余者<br /><br />Most of the people writing in JavaScript are not programmers. They lack the training and discipline to write good programs. JavaScript has so much expressive power that they are able to do useful things in it, anyway. This has given JavaScript a reputation of being strictly for the amateurs, that it is not suitable for professional programming. This is simply not the case.<br /><br />使用JavaScript的人大多不是程序员，他们缺少写良好程序的培训和训练。JavaScript有非常强大的表现力，不管怎样他们也能使用它做有用的事情。这给了JavaScript一个”全然适合业余爱好者而不适合专业程序员“的名声。这很明显是一个错误。<br /><br />Object-Oriented<br />面向对象<br /><br />Is JavaScript object-oriented? It has objects which can contain data and methods that act upon that data. Objects can contain other objects. It does not have classes, but it does have constructors which do what classes do, including acting as containers for class variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented inheritance.<br /><br />JavaScript是面向对象的吗？它有对象，它的对象可以包含数据以及对数据进行操作的方法，对象也可以包含其他的对象。它没有类，但是它有构造函数来做类的事情，包括声明类的变量和方法。它没有面向类的继承，但是他有面向原型的继承。<br /><br />The two main ways of building up object systems are by inheritance (is-a) and by aggregation (has-a). JavaScript does both, but its dynamic nature allows it to excel at aggregation.<br /><br />构建对象系统的两大主要方法是继承（is-a）和聚合（has-a）。这两者JavaScript都有，但是它的动态天性允许有比聚合更好的实现方式。<br /><br />Some argue that JavaScript is not truly object oriented because it does not provide information hiding. That is, objects cannot have private variables and private methods: All members are public.<br /><br />一些关于JavaScript不是真的面向对象的争论其理由是它没有提供信息隐藏。也就是说JavaScript的对象没有私有变量和私有方法：它的所有成员都是公开的。<br /><br /><br />But it turns out that JavaScript objects can have private variables and private methods. (Click here now to find out how.) Of course, few understand this because JavaScript is the world's most misunderstood programming language.<br /><br />但是事实是JavaScript 的对象可以有私有变量和私有方法（点击这里来看如何实现）。当然，之所以很少有人知道这个是因为JavaScript是世界上误解最深的语言嘛。<br /><br />Some argue that JavaScript is not truly object oriented because it does not provide inheritance. But it turns out that JavaScript supports not only classical inheritance, but other code reuse patterns as well.<br /><br />另一些关于JavaScript不是真的面向对象的争论其理由是它没有提供继承。但是事实是JavaScript不但支持经典的继承，而且支持其他一些代码重用的模式。<br /><br />Copyright 2001 Douglas Crockford. All Rights Reserved Wrrrldwide.版权所有&lt;完&gt;<br /><br /><a href="http://www.crockford.com/javascript/javascript.html" target="_blank">http://www.crockford.com/javascript/javascript.html</a></span>
<img src ="http://www.blogjava.net/jaunt/aggbug/83401.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-25 00:24 <a href="http://www.blogjava.net/jaunt/archive/2006/11/25/83401.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript中的Boolean类型</title><link>http://www.blogjava.net/jaunt/archive/2006/11/24/83354.html</link><dc:creator>Jaunt</dc:creator><author>Jaunt</author><pubDate>Fri, 24 Nov 2006 11:11:00 GMT</pubDate><guid>http://www.blogjava.net/jaunt/archive/2006/11/24/83354.html</guid><wfw:comment>http://www.blogjava.net/jaunt/comments/83354.html</wfw:comment><comments>http://www.blogjava.net/jaunt/archive/2006/11/24/83354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jaunt/comments/commentRss/83354.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jaunt/services/trackbacks/83354.html</trackback:ping><description><![CDATA[
		<font face="Verdana" size="2">今天看到</font>
		<a class="headermaintitle" id="Header1_HeaderTitle" href="/majianan/">
				<font face="Verdana" size="3">Oo缘来是你oO</font>
		</a>
		<font face="Verdana" size="2">的博客，关于Boolean 类型一些问题如下：<br /><br />正文：<br /><font color="#0000ff">JavaScript中的Boolean类型</font><br /><br /></font>
		<font size="2">
				<font face="Verdana">
						<font color="#000080">1.   我们所熟悉的<br /></font>
						<br />var x = false;<br />var y = true;<br /><br />这是我们大家都熟悉的，此时我们使用的是原始的Boolean值（<font color="#0000ff">the primitive Boolean values</font> ）true和false<br /><br /><font color="#000080">2.   我们很少用到的</font><br /><br />var xObject = new Boolean(false);<br />var yObject = new Boolean(true);<br /><br />此时我们声明了一个<font color="#0000ff">Boolean对象</font>，Boolean对象是对Boolean值的一个封装。<br />Boolean对象：一个值为true或false的Boolean对象。<br /><br />原始的Boolean值和Boolean对象是有区别的，不要相互混淆，引用<font color="#0000ff">Core JavaScript 1.5 Reference</font>中的一句话：</font>
		</font>
		<font face="Verdana">
				<font size="2">
						<font color="#a52a2a">Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object.<br /></font>
						<br />
						<br />
				</font>
		</font>
		<font face="Verdana">
				<font size="2">
						<font color="#000080">3.   区别<br /></font>
						<br />区别（1）：   声明形式<br /><br />区别（2）：   在条件语句（condition statement）中<br /><br /></font>
				<font face="Verdana">
						<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 97.55%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 218px; BACKGROUND-COLOR: rgb(238,238,238)">
								<font size="2">
										<span style="COLOR: rgb(0,0,255)">var</span>
										<span style="COLOR: rgb(0,0,0)"> x </span>
										<span style="COLOR: rgb(0,0,0)">=</span>
										<span style="COLOR: rgb(0,0,0)"> </span>
										<span style="COLOR: rgb(0,0,255)">false</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">;<br /></span>
										<span style="COLOR: rgb(0,0,255)">var</span>
										<span style="COLOR: rgb(0,0,0)"> xObject </span>
										<span style="COLOR: rgb(0,0,0)">=</span>
										<span style="COLOR: rgb(0,0,0)"> </span>
										<span style="COLOR: rgb(0,0,255)">new</span>
										<span style="COLOR: rgb(0,0,0)"> Boolean(</span>
										<span style="COLOR: rgb(0,0,255)">false</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">);<br /><br /></span>
										<span style="COLOR: rgb(0,0,255)">if</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">(x)<br />    alert(</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">x = true</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">);<br /></span>
										<span style="COLOR: rgb(0,0,255)">else</span>
								</font>
								<span style="COLOR: rgb(0,0,0)">
										<br />
										<font size="2">    alert(</font>
								</span>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">x = false</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">);<br /><br /></span>
										<span style="COLOR: rgb(0,0,255)">if</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">(xObject)<br />    alert(</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">xObject = </span>
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)"> </span>
										<span style="COLOR: rgb(0,0,0)">+</span>
										<span style="COLOR: rgb(0,0,0)"> xObject </span>
										<span style="COLOR: rgb(0,0,0)">+</span>
										<span style="COLOR: rgb(0,0,0)"> </span>
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">, but in the condition statement, the xObject value is evaluated to true</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
								</font>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">);<br /></span>
										<span style="COLOR: rgb(0,0,255)">else</span>
								</font>
								<span style="COLOR: rgb(0,0,0)">
										<br />
										<font size="2">    alert(</font>
								</span>
								<font size="2">
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">xObject = false</span>
										<span style="COLOR: rgb(0,0,0)">"</span>
										<span style="COLOR: rgb(0,0,0)">);</span>
								</font>
						</div>
						<br />
						<font size="2">输出结果：<br /><br /></font>
						<font face="Verdana">
								<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98.11%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 42px; BACKGROUND-COLOR: rgb(238,238,238)">
										<font size="2">
												<span style="COLOR: rgb(0,0,0)">x </span>
												<span style="COLOR: rgb(0,0,0)">=</span>
												<span style="COLOR: rgb(0,0,0)"> </span>
												<span style="COLOR: rgb(0,0,255)">false</span>
										</font>
										<span style="COLOR: rgb(0,0,0)">
												<br />
												<font size="2">xObject </font>
										</span>
										<font size="2">
												<span style="COLOR: rgb(0,0,0)">=</span>
												<span style="COLOR: rgb(0,0,0)"> </span>
												<span style="COLOR: rgb(0,0,255)">false, <font color="#000000"> but in the condition statement, the xObject value is evaluated to true</font></span>
										</font>
								</div>
								<br />
								<font size="2">区别（3）：初始化Boolean对象<br /><br />声明一个Boolean对象，如果我们用一个值为false的Boolean对象对其进行初始化，则新的Boolean对象的值为true<br /><br /></font>
								<font face="Verdana">
										<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98.12%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 58px; BACKGROUND-COLOR: rgb(238,238,238)">
												<font size="2">
														<span style="COLOR: rgb(0,0,255)">var</span>
														<span style="COLOR: rgb(0,0,0)"> xObject </span>
														<span style="COLOR: rgb(0,0,0)">=</span>
														<span style="COLOR: rgb(0,0,0)"> </span>
														<span style="COLOR: rgb(0,0,255)">new</span>
														<span style="COLOR: rgb(0,0,0)"> Boolean(</span>
														<span style="COLOR: rgb(0,0,255)">false</span>
												</font>
												<font size="2">
														<span style="COLOR: rgb(0,0,0)">);<br /></span>
														<span style="COLOR: rgb(0,0,255)">var</span>
														<span style="COLOR: rgb(0,0,0)"> resXObject </span>
														<span style="COLOR: rgb(0,0,0)">=</span>
														<span style="COLOR: rgb(0,0,0)"> </span>
														<span style="COLOR: rgb(0,0,255)">new</span>
												</font>
												<font size="2">
														<span style="COLOR: rgb(0,0,0)"> Boolean(xObject);<br />alert(</span>
														<span style="COLOR: rgb(0,0,0)">"</span>
														<span style="COLOR: rgb(0,0,0)">The resXObject value is </span>
														<span style="COLOR: rgb(0,0,0)">"</span>
														<span style="COLOR: rgb(0,0,0)"> </span>
														<span style="COLOR: rgb(0,0,0)">+</span>
														<span style="COLOR: rgb(0,0,0)"> resXObject);</span>
												</font>
										</div>
										<br />
										<a class="headermaintitle" id="Header1_HeaderTitle" href="/majianan/">
												<font size="2">Oo缘来是你oO</font>
										</a>
										<font size="2">的博客中</font>
										<a href="/majianan">
												<font color="#0000ff" size="2">马嘉楠</font>
										</a>
										<font size="2"> 遇到这个问题，查了一些资料才知道，学无止境啊。可是我的问题依然没有解决。<br />我的问题是关于Boolean对象的初始化。代码如下，<br /><br /></font>
										<font face="Verdana">
												<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 97.98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 106px; BACKGROUND-COLOR: rgb(238,238,238)">
														<font size="2">
																<span style="COLOR: rgb(0,0,255)">var</span>
																<span style="COLOR: rgb(0,0,0)"> ob1 </span>
																<span style="COLOR: rgb(0,0,0)">=</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,255)">new</span>
																<span style="COLOR: rgb(0,0,0)"> Boolean(</span>
																<span style="COLOR: rgb(0,0,255)">false</span>
														</font>
														<font size="2">
																<span style="COLOR: rgb(0,0,0)">);<br /></span>
																<span style="COLOR: rgb(0,0,255)">var</span>
																<span style="COLOR: rgb(0,0,0)"> ob2 </span>
																<span style="COLOR: rgb(0,0,0)">=</span>
																<span style="COLOR: rgb(0,0,0)"> (ob1</span>
																<span style="COLOR: rgb(0,0,0)">&amp;&amp;</span>
																<span style="COLOR: rgb(0,0,255)">true</span>
														</font>
														<font size="2">
																<span style="COLOR: rgb(0,0,0)">);<br /></span>
																<span style="COLOR: rgb(0,0,255)">var</span>
																<span style="COLOR: rgb(0,0,0)"> ob3 </span>
																<span style="COLOR: rgb(0,0,0)">=</span>
																<span style="COLOR: rgb(0,0,0)"> (</span>
																<span style="COLOR: rgb(0,0,255)">true</span>
																<span style="COLOR: rgb(0,0,0)">&amp;&amp;</span>
														</font>
														<font size="2">
																<span style="COLOR: rgb(0,0,0)">ob1);<br /></span>
																<span style="COLOR: rgb(0,0,255)">var</span>
																<span style="COLOR: rgb(0,0,0)"> ob4 </span>
																<span style="COLOR: rgb(0,0,0)">=</span>
																<span style="COLOR: rgb(0,0,0)"> Boolean(ob1</span>
																<span style="COLOR: rgb(0,0,0)">&amp;&amp;</span>
																<span style="COLOR: rgb(0,0,255)">true</span>
														</font>
														<font size="2">
																<span style="COLOR: rgb(0,0,0)">);<br /></span>
																<span style="COLOR: rgb(0,0,255)">var</span>
																<span style="COLOR: rgb(0,0,0)"> ob5 </span>
																<span style="COLOR: rgb(0,0,0)">=</span>
																<span style="COLOR: rgb(0,0,0)"> Boolean(</span>
																<span style="COLOR: rgb(0,0,255)">true</span>
																<span style="COLOR: rgb(0,0,0)">&amp;&amp;</span>
														</font>
														<font size="2">
																<span style="COLOR: rgb(0,0,0)">ob1);<br />alert(</span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)">ob2 = </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> ob2 </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> ob3 = </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> ob3 </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> ob4 = </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> ob4 </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> ob5 = </span>
																<span style="COLOR: rgb(0,0,0)">"</span>
																<span style="COLOR: rgb(0,0,0)"> </span>
																<span style="COLOR: rgb(0,0,0)">+</span>
																<span style="COLOR: rgb(0,0,0)"> ob5);</span>
														</font>
												</div>
												<br />
												<font size="2">结果：<br /></font>
												<font face="Verdana">
														<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 97.85%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; HEIGHT: 26px; BACKGROUND-COLOR: rgb(238,238,238)">
																<font size="2">
																		<span style="COLOR: rgb(0,0,0)">ob2 </span>
																		<span style="COLOR: rgb(0,0,0)">=</span>
																		<span style="COLOR: rgb(0,0,0)"> </span>
																		<span style="COLOR: rgb(0,0,255)">true</span>
																		<span style="COLOR: rgb(0,0,0)"> ob3 </span>
																		<span style="COLOR: rgb(0,0,0)">=</span>
																		<span style="COLOR: rgb(0,0,0)"> </span>
																		<span style="COLOR: rgb(0,0,255)">false</span>
																		<span style="COLOR: rgb(0,0,0)"> ob4 </span>
																		<span style="COLOR: rgb(0,0,0)">=</span>
																		<span style="COLOR: rgb(0,0,0)"> </span>
																		<span style="COLOR: rgb(0,0,255)">true</span>
																		<span style="COLOR: rgb(0,0,0)"> ob5 </span>
																		<span style="COLOR: rgb(0,0,0)">=</span>
																		<span style="COLOR: rgb(0,0,0)"> </span>
																		<span style="COLOR: rgb(0,0,255)">true</span>
																</font>
														</div>
														<br />
														<font size="2">
																<font color="#ff0000">问题已经解决：</font>
																<br />
																<br />
																<font color="#0000ff">||是这样运算的</font>：从第一个开始，遇到有意义的返回，否则返回最后一个表达式（注意不一定是Boolean值）； <br /><br /><font color="#0000ff">&amp;&amp;是这样运算的</font>：从第一个开始，遇到无意义的返回，否则返回最后一个表达式（注意同上）； <br /></font>
														<font color="#0000ff">
																<br />
																<font size="2">!是这样运算的：</font>
														</font>
														<font size="2">对表达式的值取非（注意不是对表达式）。 <br /><br />什么是无意义呢：如下六个 0,null,undefined,"",false,NaN。除此，视为有意义。 <br /><br />new Boolean(),new Boolean(false)是同一个东西，由于它是一个对象，故是有意义的，但其值为false，所以，可以看为“有意义的false”，所以结果为最后一个表达式的值。 </font>
												</font>
										</font>
								</font>
						</font>
				</font>
		</font>
<img src ="http://www.blogjava.net/jaunt/aggbug/83354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jaunt/" target="_blank">Jaunt</a> 2006-11-24 19:11 <a href="http://www.blogjava.net/jaunt/archive/2006/11/24/83354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>