<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_一直在学习</title><subtitle type="text"/><id>http://feed.cnblogs.com/blog/u/14488/rss</id><updated>2011-03-25T07:29:05Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/14488/rss"/><entry><id>http://www.cnblogs.com/Aldebaran/archive/2011/03/25/1995520.html</id><title type="text">Levenshtein distance算法:计算两个字符串的差异</title><summary type="text">LEVENSHTEIN DISTANCE(LD)-计算两字符串相似度算法两字符串相似度计算方法有好多，现对基于编距的算法的相似度计算自己总结下。简单介绍下Levenshtein Distance(LD)：LD 可能衡量两字符串的相似性。它们的距离就是一个字符串转换成那一个字符串过程中的添加、删除、修改数值。举例：如果str1=&amp;quot;test&amp;quot;，str2=&amp;quot;test&amp;quot;，那么LD(str1,str2) = 0。没有经过转换。如果str1=&amp;quot;test&amp;quot;，str2=&amp;quot;tent&amp;quot;，那么LD(str1,str2) = 1。str1</summary><published>2011-03-25T07:29:00Z</published><updated>2011-03-25T07:29:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2011/03/25/1995520.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2011/03/25/1995520.html"/><content type="html">&lt;span style="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: 16px sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" &gt;&lt;span style="line-height: 19px; font-size: 13px" &gt;&amp;nbsp;&lt;span style="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium 'Times New Roman'; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" &gt;&lt;span style="text-align: left; line-height: 18px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px" &gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)" id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"&gt;LEVENSHTEIN DISTANCE(LD)-计算两字符串相似度算法&lt;/span&gt;&lt;/span&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;两字符串相似度计算方法有好多，现对基于编距的算法的相似度计算自己总结下。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;简单介绍下Levenshtein Distance(LD)：LD 可能衡量两字符串的相似性。它们的距离就是一个字符串转换成那一个字符串过程中的添加、删除、修改数值。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;举例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;如果str1="test"，str2="test"，那么LD(str1,str2) = 0。没有经过转换。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;如果str1="test"，str2="tent"，那么LD(str1,str2) = 1。str1的"s"转换"n"，转换了一个字符，所以是1。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;如果它们的距离越大，说明它们越是不同。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;Levenshtein distance最先是由俄国科学家Vladimir Levenshtein在1965年发明，用他的名字命名。不会拼读，可以叫它edit distance（编辑距离）。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;Levenshtein distance可以用来：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;Spell checking(拼写检查)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;Speech recognition(语句识别)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;DNA analysis(DNA分析)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;Plagiarism detection(抄袭检测)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;LD用m*n的矩阵存储距离值。算法大概过程：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;str1或str2的长度为0返回另一个字符串的长度。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;初始化(n+1)*(m+1)的矩阵d，并让第一行和列的值从0开始增长。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;扫描两字符串（n*m级的），如果：str1[i] == str2[j]，用temp记录它，为0。否则temp记为1。然后在矩阵d[i][j]赋于d[i-1][j]+1 、d[i][j-1]+1、d[i-1][j-1]+temp三者的最小值。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;扫描完后，返回矩阵的最后一个值即d[n][m]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: rgb(51,102,255)"&gt;最后返回的是它们的距离。怎么根据这个距离求出相似度呢？因为它们的最大距离就是两字符串长度的最大值。对字符串不是很敏感。现我把相似度计算公式定为1-它们的距离/字符串长度最大值。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 1.5em; margin: 0.4em 0px 0.5em"&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;div style="background-color: #F5F5F5;border: 1px solid #CCCCCC;padding-left:5px;padding-right:5px;"&gt;&#xD;
&lt;div&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;Int32&amp;nbsp;levenshtein(String&amp;nbsp;a,&amp;nbsp;String&amp;nbsp;b)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.IsNullOrEmpty(a))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style="color: #000000"&gt;!&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.IsNullOrEmpty(b))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;b.Length;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.IsNullOrEmpty(b))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style="color: #000000"&gt;!&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.IsNullOrEmpty(a))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;a.Length;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32&amp;nbsp;cost;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32[,]&amp;nbsp;d&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&lt;span style="color: #000000"&gt;[a.Length&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;,&amp;nbsp;b.Length&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32&amp;nbsp;min1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32&amp;nbsp;min2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Int32&amp;nbsp;min3;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(Int32&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;);&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d[i,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(Int32&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;);&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d[&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;,&amp;nbsp;i]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(Int32&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;);&amp;nbsp;i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;(Int32&amp;nbsp;j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;&amp;nbsp;j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;);&amp;nbsp;j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cost&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;Convert.ToInt32(&lt;/span&gt;&lt;span style="color: #000000"&gt;!&lt;/span&gt;&lt;span style="color: #000000"&gt;(a[i&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;b[j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;]));&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;min1&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d[i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;,&amp;nbsp;j]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;min2&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d[i,&amp;nbsp;j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;min3&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d[i&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;,&amp;nbsp;j&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;cost;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d[i,&amp;nbsp;j]&amp;nbsp;&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;Math.Min(Math.Min(min1,&amp;nbsp;min2),&amp;nbsp;min3);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;nbsp;d[d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;),&amp;nbsp;d.GetUpperBound(&lt;/span&gt;&lt;span style="color: #800080"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;)];&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 1.5em; margin: 0.4em 0px 0.5em"&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/Aldebaran/aggbug/1995520.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/Aldebaran/archive/2011/03/25/1995520.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2010/07/14/1777646.html</id><title type="text">SQL 调优</title><summary type="text">内存: OS相关计数器Memory :Available Mbytes &amp;gt;100MBMemory :Free System Page Table Entries &amp;gt;7000Memory :Pages Input/Sec &amp;lt;10Paging File :Paging File: %Usage &amp;lt; 70%内存: SQL Server相关计数器Target Server Memo...</summary><published>2010-07-14T15:23:00Z</published><updated>2010-07-14T15:23:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2010/07/14/1777646.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2010/07/14/1777646.html"/><content type="html">&lt;font face="Times New Roman"&gt;&amp;nbsp;&lt;/font&gt; &#xD;
&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;内存: OS相关计数器&lt;br /&gt;Memory :Available Mbytes &amp;gt;100MB&lt;br /&gt;Memory :Free System Page Table Entries &amp;gt;7000&lt;br /&gt;Memory :Pages Input/Sec &amp;lt;10&lt;br /&gt;Paging File :Paging File: %Usage &amp;lt; 70%&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;内存: SQL Server相关计数器&lt;br /&gt;Target Server Memory (KB)&lt;br /&gt;Total Server Memory (KB)&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;CPU:OS相关计数器&lt;br /&gt;Processor: Processor Time &amp;lt; 80%&lt;br /&gt;Processor: Privileged Time &amp;lt; 30% of Total %Processor Time&lt;br /&gt;System: Context Switches/sec&amp;lt; 3000 *&lt;br /&gt;System: Processor Queue Length &amp;lt; 4 * &lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;* per CPU&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;CPU: SQL Server相关计数器&lt;br /&gt;Process(sqlservr) :% Processor Time &amp;lt; 80%&lt;br /&gt;Process(sqlservr): % Privileged Time &amp;lt; &amp;lt; 30% of %Processor Time (sqlservr)&lt;/font&gt;&lt;/p&gt;&lt;font size="3" face="Times New Roman"&gt;&#xD;
&lt;p&gt;&lt;br /&gt;Physical Disk 读相关计数器&lt;br /&gt;Avg. Disk sec/Read&lt;br /&gt;Excellent &amp;lt;&amp;nbsp; 08 MS&lt;br /&gt;Good&amp;nbsp; &amp;lt;&amp;nbsp; 12 MS&lt;br /&gt;Fair&amp;nbsp; &amp;lt;&amp;nbsp; 20 MS&lt;br /&gt;Poor&amp;nbsp; &amp;gt;&amp;nbsp; 20 MS&lt;/p&gt;&#xD;
&lt;p&gt;Physical Disk 写相关计数器&lt;br /&gt;Non cached Writes&lt;br /&gt;Excellent &amp;lt;&amp;nbsp; 08 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Good&amp;nbsp; &amp;lt;&amp;nbsp; 12 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Fair&amp;nbsp; &amp;lt;&amp;nbsp; 20 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Poor&amp;nbsp; &amp;gt;&amp;nbsp; 20 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&#xD;
&lt;p&gt;Cached Writes Only相关计数器&lt;br /&gt;Excellent &amp;lt;&amp;nbsp; 01 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Good&amp;nbsp; &amp;lt;&amp;nbsp; 02 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Fair&amp;nbsp; &amp;lt;&amp;nbsp; 04 MS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Poor&amp;nbsp; &amp;gt;&amp;nbsp; 04 MS&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;SQL Server, Access Methods相关计数器&lt;br /&gt;Forwarded Records/sec: &amp;lt; batch /10&lt;br /&gt;FreeSpace Scans/sec &amp;lt;batch /10&lt;br /&gt;Index Searches/sec:Full Scans/sec &amp;gt; 1000&lt;br /&gt;Page Splits/sec &amp;lt; batch /5&lt;br /&gt;Worktables Created/sec &amp;lt; 200&lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;SQL Server, Buffer Manager相关计数器&lt;br /&gt;Buffer cache hit ratio &amp;gt; 97%&lt;br /&gt;Checkpoint pages/sec&lt;br /&gt;Lazy writes/sec &amp;lt; 20&lt;br /&gt;Page life expectancy &amp;gt; 300&lt;br /&gt;Page lookups/sec &amp;lt; batch /sec x 100&lt;br /&gt;Page reads/sec, Page writes/sec &amp;lt; 90&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server, General Statistics&lt;br /&gt;Logins/sec, Logouts/sec &amp;lt;2&lt;br /&gt;Processes Blocked non zero&lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;SQL Server, Latches &lt;br /&gt;(Total Latch Wait Time) / (Latch Waits/Sec) &amp;lt; 10&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server, Locks&lt;br /&gt;(Lock Request/sec)/(Batch Requests/sec) &amp;lt; 500&lt;br /&gt;Number of Deadlocks/sec &amp;lt; 1&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server, SQL Statistics&lt;br /&gt;Batch Requests/sec&lt;br /&gt;SQL Compilations/sec&lt;br /&gt;&amp;lt; Batch Requests/sec x 10% (SQL2k)&lt;br /&gt;&amp;lt; Batch Requests/sec x 20% (SQL2k5)&lt;br /&gt;SQL Re-Compilations/sec&lt;br /&gt;&amp;lt; SQL Compilations/sec x 10% (SQL2k)&lt;br /&gt;&amp;lt; SQL Compilations/sec x 20% (SQL2k5)&lt;/p&gt;&#xD;
&lt;p&gt;Inside SQL Server 系列 (2005)&lt;br /&gt;SQL Server Internal (2008)&lt;/p&gt;&lt;/font&gt;&lt;img src="http://www.cnblogs.com/Aldebaran/aggbug/1777646.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/Aldebaran/archive/2010/07/14/1777646.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2010/05/15/1735906.html</id><title type="text">IE 与 FireFox差别 ---javascript</title><summary type="text">这篇文章中，我会略述一下 Internet Explorer 和 Firefox 在 JavaScript 语法上不同的 7 个方面。 1. CSS “float” 属性 获取给定对象的特定 CSS 属性的基本语法是 object.style 属性，而且有连字符的属性要用骆驼命名法来代替。例如，获取一个 ID 为 “header” 的 div 的 background-color 属性，我们要用如...</summary><published>2010-05-14T23:35:00Z</published><updated>2010-05-14T23:35:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2010/05/15/1735906.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2010/05/15/1735906.html"/><content type="html">&lt;span style="line-height: 22px; font-family: arial" &gt; &lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;这篇文章中，我会略述一下 Internet Explorer 和 Firefox 在 JavaScript 语法上不同的 7 个方面。&lt;/p&gt; &lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;1. CSS “float” 属性&lt;/strong&gt;&lt;/p&gt; &lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;获取给定对象的特定 CSS 属性的基本语法是 object.style 属性，而且有连字符的属性要用骆驼命名法来代替。例如，获取一个 ID 为 “header” 的 div 的 background-color 属性，我们要用如下语法：&lt;/p&gt; &lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt; &lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;style&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;borderBottom&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"1px solid #ccc"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;但是由于 “float” 是 JavaScript 的保留词，我们就无法使用 object.style.float 来获取 “float” 属性了。一下是我们在两种浏览器中的使用的方法：&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;style&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;styleFloat&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"left"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;style&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;cssFloat&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"left"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;2. 元素的计算样式&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;通过使用上述的 object.style.property， JavaScript 可以很容易的获取和修改对象的设定 CSS 样式。但是这一语法的局限在于，它只能取得内联在 HTML 里的样式，或者直接使用 JavaScript 设定的样式。style 对象不能获取使用外部样式表设定的样式。为了获取对象的”计算样式”，我们使用以下代码：&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt; &#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myStyle &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;currentStyle&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;backgroundColor&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myComputedStyle &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;defaultView&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getComputedStyle&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;myObject&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;,&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;null&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myStyle &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myComputedStyle.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;backgroundColor&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;3. 获取元素的”class”属性&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;类似于”float”属性的情况，这两种浏览器使用不同的 JavaScript 方法来获取这个属性。&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myAttribute &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getAttribute&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"className"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"header"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myAttribute &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getAttribute&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"class"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;4. 获取 label 标签的 “for” 属性&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;和 3 一样，使用 JavaScript获取 label 的 “for” 属性也有不同语法。&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"myLabel"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myAttribute &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getAttribute&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"htmlFor"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"myLabel"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myAttribute &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getAttribute&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"for"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;对于 setAtrribute 方法来说也是同样的语法。&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;5. 获取光标位置&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;获取元素的光标位置比较少见，如果需要这么做，IE 和 Firefox 的语法也是不同的。这个示例代码是相当基础的，一般用作许多复杂事件处理的一部分，这里仅用来描述差异。需要注意的是，IE 中的结果和 Firefox 中是不同的，因此这个方法有些问题。通常，这个差异可以通过获取 “滚动位置” 来补偿 － 但那是另外一篇文章的课题了。&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myCursorPosition &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;,&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myCursorPosition&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; event.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;clientX&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myCursorPosition&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;1&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; event.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;clientY&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myCursorPosition &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;,&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myCursorPosition&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; event.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;pageX&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myCursorPosition&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;1&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; event.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;pageY&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;6. 获取视窗或浏览器窗口的尺寸&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;有时需要找出浏览器的有效窗口空间的尺寸，一般成为”视窗”。&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myBrowserSize &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;,&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myBrowserSize&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;documentElement&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;clientWidth&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myBrowserSize&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;1&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;documentElement&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;clientHeight&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myBrowserSize &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;,&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myBrowserSize&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; window.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;innerWidth&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myBrowserSize&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;[&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;1&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;]&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; window.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;innerHeight&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h2 style="line-height: 34px; font-family: arial, sans-serif, 宋体"&gt;7. Alpha 透明&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;嗯，这其实不是 JavaScript 的语法项目 - alpha 透明是通过 CSS 来设置的。但是当对象通过 JavaScript 设置为淡入淡出时，这就需要通过获取 CSS 的 alpha 设定来实现，一般是在循环内部。要通过以下 JavaScript 来改变 CSS 代码：&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;#myElement &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;{&lt;/span&gt;&#xD;
filter&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;:&lt;/span&gt; alpha&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;opacity&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;50&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;#myElement &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;{&lt;/span&gt;&#xD;
opacity&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;:&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #cc0000"&gt;0.5&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;要使用 JavaScript 获取这些值，需要使用 style 对象：&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;IE 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"myElement"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;style&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;filter&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"alpha(opacity=80)"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;Firefox 语法：&lt;/p&gt;&#xD;
&lt;div style="padding-bottom: 0px; line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&#xD;
&lt;div style="line-height: 22px; font-family: arial, sans-serif, 宋体" &gt;&lt;pre style="border-bottom: #cccccc 2px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; line-height: 1.3em; overflow-x: auto; overflow-y: auto; background-color: #f8f8f8; margin: 4px 0px; padding-left: 8px; padding-right: 8px; font-family: monospace; word-wrap: normal; color: #333333; font-size: 13px; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px" &gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #003366; font-weight: bold"&gt;var&lt;/span&gt; myObject &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; document.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;getElementById&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;(&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"myElement"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #009900"&gt;)&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&#xD;
myObject.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;style&lt;/span&gt;.&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #660066"&gt;opacity&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;=&lt;/span&gt; &lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #3366cc"&gt;"0.5"&lt;/span&gt;&lt;span style="line-height: 21px; font-family: arial, sans-serif, 宋体; color: #339933"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;&lt;/p&gt;&#xD;
&lt;p style="line-height: 22px; font-family: arial, sans-serif, 宋体"&gt;当然，已经说到了，一般是在循环中间来改变 opcity/alpha，来创建动画效果，但这这是个简单的例子，只是为了明白地描述方法是如何实现地。&lt;/p&gt;&lt;/span&gt;&lt;img src="http://www.cnblogs.com/Aldebaran/aggbug/1735906.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/Aldebaran/archive/2010/05/15/1735906.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/12/08/1350710.html</id><title type="text">我的常用工具</title><summary type="text">Reflector:http://files.cnblogs.com/Aldebaran/reflector.zip 常用CHM.rar JQuery1.2.6.rarhttp://files.cnblogs.com/Aldebaran/WizardDemo.ziphttp://files.cnblogs.com/Aldebaran/DesignTimeWizard.zip http://file...</summary><published>2008-12-08T14:33:00Z</published><updated>2008-12-08T14:33:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/12/08/1350710.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/12/08/1350710.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/08/21/1273199.html</id><title type="text">Html的一些小东西</title><summary type="text">Event cancelBubble设置或获取当前事件是否要在事件句柄中向上冒泡。 Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.  &amp;lt;SCRIPT LANGUAGE="JScript"&amp;gt;  function checkCancel() {  if...</summary><published>2008-08-21T06:51:00Z</published><updated>2008-08-21T06:51:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/08/21/1273199.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/08/21/1273199.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/08/19/1270958.html</id><title type="text">职业发展三岔口-技术还是管理?那太难抉择了</title><summary type="text">做程序员快两年了，本想继续发展下去成高级程序员，转管理？那是30岁左右的事情。我热爱编程，因为编程和游戏一样好玩，可是就在我准备再在技术上大展鸿图的时候，继续做技术和还是转管理的两条截然不同的发展岔路却突然来到了面前。背景：我毕业才两年，一直在公司参与产品开发，并担任了技术负责人角色，后来公司和某大型国企（以下简称国企）建立了战略合作伙伴关系，并在国企内部实施了一个OA系统，该系统是由公司研发的产...</summary><published>2008-08-19T02:58:00Z</published><updated>2008-08-19T02:58:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/08/19/1270958.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/08/19/1270958.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/07/24/1250389.html</id><title type="text">Nhibernate学习点滴&amp;lt;一&amp;gt; 配置注意事项</title><summary type="text">数据库对象的配置文件×××.hbm.xml,一定要将生成操作设置成嵌入的资源  ×××.hbm.xml中的内容 &amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&amp;lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"&amp;gt; &amp;lt;class name="NhibernateStudy.Portal...</summary><published>2008-07-24T03:57:00Z</published><updated>2008-07-24T03:57:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/24/1250389.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/24/1250389.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/07/18/1246232.html</id><title type="text">WebPart全接触1（如何管理自己的WebPart个性化数据）</title><summary type="text">是不是觉得WebPart存储在asp.net自带的数据库中觉得很不保险？每次做一个带WebPart的项目都必须让asp.net部署一个aspnetdb数据库，好像WebPart的数据并不能完全融入自己的系统体系中。本文将介绍如何从Asp.net中获取WebPart个性化数据，如何存储这些数据。1 在Asp.Net2.0中，是如何存取WebPart数据的？在Asp.Net2.0中，默认是通过SqlP...</summary><published>2008-07-18T09:25:00Z</published><updated>2008-07-18T09:25:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/18/1246232.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/18/1246232.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/07/08/1238162.html</id><title type="text">比尔·盖茨 经典语录</title><summary type="text">在比尔·盖茨写给高中毕业生和大学毕业生的书里，有一个单子上面列有10项学生没能在学校里学到的事情。它们是： ·生活是不公平的，要去适应它。 ·这世界并不会在意你的自尊。这世界指望你在自我感觉良好之前先要有所成就。 ·高中刚毕业你不会成为一个公司的副总裁，直到你将此职位挣到手。 ·如果你认为你的老师严厉，等你有了老板再这样想。老板可是没有任期限制的。 ·如果你陷入困境，不要尖声抱怨我们的错误，要从中...</summary><published>2008-07-08T06:23:00Z</published><updated>2008-07-08T06:23:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/08/1238162.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/08/1238162.html"/></entry><entry><id>http://www.cnblogs.com/Aldebaran/archive/2008/07/05/1236270.html</id><title type="text">您的PC还处于待机中吗？让他参与科学计算吧！</title><summary type="text">不知道有园子里多少人中午休息时是不关机器的？大家又是怎样利用这段时间的？下载电影或游戏吗？这是一个不错的选择！其实还有一个不错的选择，让您的机器参与科学计算。我的机器参与科学计算？这不就是现在开始风行的“云计算”吗？没错，就是让您的机器成为某个某个分布式计算项目的一个客户端，关于云计算的概念，我就不多说了，大家可以访问http://subject.csdn.net/yunjs.htm来了解云计算的...</summary><published>2008-07-05T06:24:00Z</published><updated>2008-07-05T06:24:00Z</updated><author><name>Aldebaran's Home</name><uri>http://www.cnblogs.com/Aldebaran/</uri></author><link rel="alternate" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/05/1236270.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/Aldebaran/archive/2008/07/05/1236270.html"/></entry></feed>
