﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-weidagang2046的专栏-文章分类-Javascript</title><link>http://www.blogjava.net/weidagang2046/category/17206.html</link><description>物格而后知致</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 03:39:27 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 03:39:27 GMT</pubDate><ttl>60</ttl><item><title>JavaScript中的arguments,callee,caller,call,appy</title><link>http://www.blogjava.net/weidagang2046/articles/93554.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sat, 13 Jan 2007 00:52:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/93554.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/93554.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/93554.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/93554.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/93554.html</trackback:ping><description><![CDATA[
		<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		<span style="COLOR: #000000">&lt;</span>
		<span style="COLOR: #000000">script language</span>
		<span style="COLOR: #000000">=</span>
		<span style="COLOR: #000000">"</span>
		<span style="COLOR: #000000">JavaScript</span>
		<span style="COLOR: #000000">"</span>
		<span style="COLOR: #000000">&gt;</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_31_66_Open_Image" onclick="this.style.display='none'; Codehighlighter1_31_66_Open_Text.style.display='none'; Codehighlighter1_31_66_Closed_Image.style.display='inline'; Codehighlighter1_31_66_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_31_66_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_31_66_Closed_Text.style.display='none'; Codehighlighter1_31_66_Open_Image.style.display='inline'; Codehighlighter1_31_66_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span id="Codehighlighter1_31_66_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
		<span id="Codehighlighter1_31_66_Open_Text">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 演示arguments的用法,如何获取实参数和形数数<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span>
				<span style="COLOR: #008000">*/</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_93_329_Open_Image" onclick="this.style.display='none'; Codehighlighter1_93_329_Open_Text.style.display='none'; Codehighlighter1_93_329_Closed_Image.style.display='inline'; Codehighlighter1_93_329_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_93_329_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_93_329_Closed_Text.style.display='none'; Codehighlighter1_93_329_Open_Image.style.display='inline'; Codehighlighter1_93_329_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> argTest(a,b,c,d)</span>
		<span id="Codehighlighter1_93_329_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_93_329_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">var</span>
				<span style="COLOR: #000000"> numargs </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> arguments.length;     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 获取被传递参数的数值。</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
				</span>
				<span style="COLOR: #000000">    </span>
				<span style="COLOR: #0000ff">var</span>
				<span style="COLOR: #000000"> expargs </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> argTest.length;       </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 获取期望参数的数值。</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
				</span>
				<span style="COLOR: #000000">    alert(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">实参数目为:</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">numargs)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">形数数目为:</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">expargs)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(arguments[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">])         <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(argTest[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">])          </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">undefined 没有这种用法</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />
				</span>
				<span style="COLOR: #000000">}</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">argTest(1,2)</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />//</span>
		<span style="COLOR: #008000">argTest(1,2,3,4,5)</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_368_399_Open_Image" onclick="this.style.display='none'; Codehighlighter1_368_399_Open_Text.style.display='none'; Codehighlighter1_368_399_Closed_Image.style.display='inline'; Codehighlighter1_368_399_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_368_399_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_368_399_Closed_Text.style.display='none'; Codehighlighter1_368_399_Open_Image.style.display='inline'; Codehighlighter1_368_399_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span id="Codehighlighter1_368_399_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
		<span id="Codehighlighter1_368_399_Open_Text">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> *  arguments不是数组(Array类)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span>
				<span style="COLOR: #008000">*/</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Array.prototype.selfvalue </span>
		<span style="COLOR: #000000">=</span>
		<span style="COLOR: #000000"> </span>
		<span style="COLOR: #000000">1</span>
		<span style="COLOR: #000000">;<br /><img id="Codehighlighter1_456_513_Open_Image" onclick="this.style.display='none'; Codehighlighter1_456_513_Open_Text.style.display='none'; Codehighlighter1_456_513_Closed_Image.style.display='inline'; Codehighlighter1_456_513_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_456_513_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_456_513_Closed_Text.style.display='none'; Codehighlighter1_456_513_Open_Image.style.display='inline'; Codehighlighter1_456_513_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> testAguments()</span>
		<span id="Codehighlighter1_456_513_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_456_513_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">arguments.selfvalue=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">arguments.selfvalue);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">alert("Array.sefvalue="+new Array().selfvalue);</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />//</span>
		<span style="COLOR: #008000">testAguments();</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img id="Codehighlighter1_588_653_Open_Image" onclick="this.style.display='none'; Codehighlighter1_588_653_Open_Text.style.display='none'; Codehighlighter1_588_653_Closed_Image.style.display='inline'; Codehighlighter1_588_653_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_588_653_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_588_653_Closed_Text.style.display='none'; Codehighlighter1_588_653_Open_Image.style.display='inline'; Codehighlighter1_588_653_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span id="Codehighlighter1_588_653_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
		<span id="Codehighlighter1_588_653_Open_Text">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 演示函数的caller属性.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 说明:(当前函数).caller:返回一个对函数的引用，该函数调用了当前函数<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span>
				<span style="COLOR: #008000">*/</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img id="Codehighlighter1_678_834_Open_Image" onclick="this.style.display='none'; Codehighlighter1_678_834_Open_Text.style.display='none'; Codehighlighter1_678_834_Closed_Image.style.display='inline'; Codehighlighter1_678_834_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_678_834_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_678_834_Closed_Text.style.display='none'; Codehighlighter1_678_834_Open_Image.style.display='inline'; Codehighlighter1_678_834_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> callerDemo() </span>
		<span id="Codehighlighter1_678_834_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_678_834_Open_Text">
				<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_707_778_Open_Image" onclick="this.style.display='none'; Codehighlighter1_707_778_Open_Text.style.display='none'; Codehighlighter1_707_778_Closed_Image.style.display='inline'; Codehighlighter1_707_778_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_707_778_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_707_778_Closed_Text.style.display='none'; Codehighlighter1_707_778_Open_Image.style.display='inline'; Codehighlighter1_707_778_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (callerDemo.caller) </span>
				<span id="Codehighlighter1_707_778_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_707_778_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">var</span>
						<span style="COLOR: #000000"> a</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> callerDemo.caller.arguments[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">];<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        alert(a);<br /><img id="Codehighlighter1_785_832_Open_Image" onclick="this.style.display='none'; Codehighlighter1_785_832_Open_Text.style.display='none'; Codehighlighter1_785_832_Closed_Image.style.display='inline'; Codehighlighter1_785_832_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_785_832_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_785_832_Closed_Text.style.display='none'; Codehighlighter1_785_832_Open_Image.style.display='inline'; Codehighlighter1_785_832_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    }</span>
				</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_785_832_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_785_832_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        alert(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">this is a top function</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_860_880_Open_Image" onclick="this.style.display='none'; Codehighlighter1_860_880_Open_Text.style.display='none'; Codehighlighter1_860_880_Closed_Image.style.display='inline'; Codehighlighter1_860_880_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_860_880_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_860_880_Closed_Text.style.display='none'; Codehighlighter1_860_880_Open_Image.style.display='inline'; Codehighlighter1_860_880_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> handleCaller() </span>
		<span id="Codehighlighter1_860_880_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_860_880_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    callerDemo();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">callerDemo();</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />//</span>
		<span style="COLOR: #008000">handleCaller("参数1","参数2");</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img id="Codehighlighter1_930_1006_Open_Image" onclick="this.style.display='none'; Codehighlighter1_930_1006_Open_Text.style.display='none'; Codehighlighter1_930_1006_Closed_Image.style.display='inline'; Codehighlighter1_930_1006_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_930_1006_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_930_1006_Closed_Text.style.display='none'; Codehighlighter1_930_1006_Open_Image.style.display='inline'; Codehighlighter1_930_1006_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span id="Codehighlighter1_930_1006_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
		<span id="Codehighlighter1_930_1006_Open_Text">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 演示函数的callee属性.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 说明:arguments.callee:初始值就是正被执行的 Function 对象,用于匿名函数<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span>
				<span style="COLOR: #008000">*/</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_1030_1061_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1030_1061_Open_Text.style.display='none'; Codehighlighter1_1030_1061_Closed_Image.style.display='inline'; Codehighlighter1_1030_1061_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_1030_1061_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1030_1061_Closed_Text.style.display='none'; Codehighlighter1_1030_1061_Open_Image.style.display='inline'; Codehighlighter1_1030_1061_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> calleeDemo() </span>
		<span id="Codehighlighter1_1030_1061_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_1030_1061_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(arguments.callee);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">calleeDemo();</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />//</span>
		<span style="COLOR: #008000">(function(arg0,arg1){alert("形数数目为:"+arguments.callee.length)})();</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img id="Codehighlighter1_1149_1321_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1149_1321_Open_Text.style.display='none'; Codehighlighter1_1149_1321_Closed_Image.style.display='inline'; Codehighlighter1_1149_1321_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_1149_1321_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1149_1321_Closed_Text.style.display='none'; Codehighlighter1_1149_1321_Open_Image.style.display='inline'; Codehighlighter1_1149_1321_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
		</span>
		<span id="Codehighlighter1_1149_1321_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
		<span id="Codehighlighter1_1149_1321_Open_Text">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 演示apply,call函数的用法<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * 说明:作用都是将函数绑定到另外一个对象上去运行，两者仅在定义参数方式有所区别：<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> *       apply(thisArg,argArray);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> *     call(thisArg[,arg1,arg2…] ]);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> *     即所有函数内部的this指针都会被赋值为thisArg<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span>
				<span style="COLOR: #008000">*/</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img id="Codehighlighter1_1343_1451_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1343_1451_Open_Text.style.display='none'; Codehighlighter1_1343_1451_Closed_Image.style.display='inline'; Codehighlighter1_1343_1451_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_1343_1451_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1343_1451_Closed_Text.style.display='none'; Codehighlighter1_1343_1451_Open_Image.style.display='inline'; Codehighlighter1_1343_1451_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> ObjectA()</span>
		<span id="Codehighlighter1_1343_1451_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_1343_1451_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">执行ObjectA()</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(arguments[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">]);<br /><img id="Codehighlighter1_1413_1424_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1413_1424_Open_Text.style.display='none'; Codehighlighter1_1413_1424_Closed_Image.style.display='inline'; Codehighlighter1_1413_1424_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1413_1424_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1413_1424_Closed_Text.style.display='none'; Codehighlighter1_1413_1424_Open_Image.style.display='inline'; Codehighlighter1_1413_1424_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">.hit</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000">(msg)</span>
				<span id="Codehighlighter1_1413_1424_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_1413_1424_Open_Text">
						<span style="COLOR: #000000">{alert(msg)}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">.info</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">我来自ObjectA</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> }</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> <br /><img id="Codehighlighter1_1474_1629_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1474_1629_Open_Text.style.display='none'; Codehighlighter1_1474_1629_Closed_Image.style.display='inline'; Codehighlighter1_1474_1629_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1474_1629_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1474_1629_Closed_Text.style.display='none'; Codehighlighter1_1474_1629_Open_Image.style.display='inline'; Codehighlighter1_1474_1629_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> ObjectB()</span>
		<span id="Codehighlighter1_1474_1629_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_1474_1629_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">执行ObjectB()</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">调用ObjectA()方法,同时ObjectA构造函数中的所有this就会被ObjectB中的this替代</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
				</span>
				<span style="COLOR: #000000">    ObjectA.apply(</span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">,arguments);</span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">ObjectA.call(this);</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
				</span>
				<span style="COLOR: #000000">    alert(</span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">.info);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> }</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> </span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">ObjectB('参数0');</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> </span>
		<span style="COLOR: #0000ff">var</span>
		<span style="COLOR: #000000"> value</span>
		<span style="COLOR: #000000">=</span>
		<span style="COLOR: #000000">"</span>
		<span style="COLOR: #000000">global 变量</span>
		<span style="COLOR: #000000">"</span>
		<span style="COLOR: #000000">;<br /><img id="Codehighlighter1_1691_1716_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1691_1716_Open_Text.style.display='none'; Codehighlighter1_1691_1716_Closed_Image.style.display='inline'; Codehighlighter1_1691_1716_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1691_1716_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1691_1716_Closed_Text.style.display='none'; Codehighlighter1_1691_1716_Open_Image.style.display='inline'; Codehighlighter1_1691_1716_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> Obj()</span>
		<span id="Codehighlighter1_1691_1716_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_1691_1716_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">.value</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">对象！</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> }</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img id="Codehighlighter1_1734_1757_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1734_1757_Open_Text.style.display='none'; Codehighlighter1_1734_1757_Closed_Image.style.display='inline'; Codehighlighter1_1734_1757_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_1734_1757_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1734_1757_Closed_Text.style.display='none'; Codehighlighter1_1734_1757_Open_Image.style.display='inline'; Codehighlighter1_1734_1757_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span>
		<span style="COLOR: #0000ff">function</span>
		<span style="COLOR: #000000"> Fun1()</span>
		<span id="Codehighlighter1_1734_1757_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				<img src="http://www.blogjava.net/images/dot.gif" />
		</span>
		<span id="Codehighlighter1_1734_1757_Open_Text">
				<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    alert(</span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000">.value);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> }</span>
		</span>
		<span style="COLOR: #000000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /> </span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">Fun1();</span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000"> </span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">Fun1.apply(window); </span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000"> </span>
		<span style="COLOR: #008000">//</span>
		<span style="COLOR: #008000">Fun1.apply(new Obj()); </span>
		<span style="COLOR: #008000">
				<br />
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
		</span>
		<span style="COLOR: #000000">&lt;/</span>
		<span style="COLOR: #000000">script</span>
		<span style="COLOR: #000000">&gt;<br /><br />from: <a href="/xfan/archive/2007/01/12/93504.html">http://www.blogjava.net/xfan/archive/2007/01/12/93504.html</a></span>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/93554.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2007-01-13 08:52 <a href="http://www.blogjava.net/weidagang2046/articles/93554.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搜索引擎页面分析中的 javascript 处理</title><link>http://www.blogjava.net/weidagang2046/articles/88202.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sat, 16 Dec 2006 08:19:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/88202.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/88202.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/88202.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/88202.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/88202.html</trackback:ping><description><![CDATA[搜索引擎页面分析中的 javascript 处理——在制作搜索引擎的时候、或者做页面分析及数据提取的时候，经常面临页面中存在许多javascript，而页面内容，相当一部分写入到了这些js脚本的命令中，而导致正常的DOM分析失败，无法提取所需的信息。 <br /><br />　　在制作搜索引擎的时候、或者做页面分析及数据提取的时候，经常面临页面中存在许多javascript，而页面内容，相当一部分写入到了这些js脚本的命令中，而导致正常的DOM分析失败，无法提取所需的信息。当然，如果这个页面模板确定，针对这个页面制作信息提取模板也不很难，每个页面人工的分析出需要提取的信息的位置，然后制作模板。可是对于general 的网页搜索的话，这就不大现实了。正巧前两天和朋友讨论到这个问题，有些想法。在这里，提供两个思路，供大家参考。 1、做一个简化的 javascript 解释器，执行脚本片段 做一个完整的 javascript 解释器是比较难得，但是做一个简化的 javascript 解释器则很容易。我们不需要那些复杂的库，我们只将基本的 javascript 语法实现，并且将涉及文字输出的函数部分实现就可以了。这样做的目的并不是要真正的完整执行这个javascript，而是将脚本中的字符串，按照其程序逻辑进行组合，最后输出这个脚本的完整输出。这样自然不全面，肯定由于很多功能没实现，导致输出的字符串和真实的输出不完全一样。但是，如果不出意外， <br /><br />　　在制作搜索引擎的时候、或者做页面分析及数据提取的时候，经常面临页面中存在许多javascript，这些javascript 比较烦人，因为有相当部分页面内容写入到了这些js脚本的命令中，而导致正常的DOM分析看不到这些文字，而使其中的文字数据提取失败。 <br /><br />　　当然，如果这个页面模板确定，针对这个特定的页面制作信息提取模板也不很难，每个页面人工的分析出需要提取的信息的位置，然后制作模板。可是对于general的网页搜索的话，这就不大现实了。正巧前两天和朋友讨论到这个问题，有些想法。在这里，提供两个思路，供大家参考。 <br /><br />　　1、做一个简化的 javascript 解释器，执行脚本片段 <br /><br />　　做一个完整的 javascript 解释器是比较难得，但是做一个简化的 javascript 解释器则很容易。我们不需要那些复杂的库，我们只将基本的 javascript 语法实现，并且将涉及文字输出的函数部分实现就可以了。 <br /><br />　　这样做的目的并不是要真正的完整执行这个javascript，而是将脚本中的字符串，按照其程序逻辑进行组合，最后输出这个脚本的完整输出。这样自然不全面，肯定由于很多功能没实现，导致输出的字符串和真实的输出不完全一样。但是，如果不出意外，应该不会产生太多的遗漏。因为所有的字符串输出部分我们都实现了，那么完全可以将这些字符串按照其将要输出的逻辑组合在一起。 <br /><br />　　对于根据动态条件做动态的事情的问题，如果这些条件无法确定，比如根据浏览器类型或者什么的。完全可以将两个分支的结果都输出。当然，我们不应该将这两块文字组合，中间应该有我们理解的分割符。 <br /><br />　　这样做得好处是高性能。这个解释器可以做得很小巧，由于并非完整执行js，所以性能也较之迅速一些。缺点是由于是简化的解释器，因此和真实的结果会有差异。但是一般来说，信息只会多而不会少，(因为同时输出了不同分支的结果)，所以，对于搜索引擎的页面分析来说，差不多是够用了。 <br /><br />　　2、用HTML渲染引擎完整的解析页面，最后从显示结果中取数据 <br /><br />　　采用Gecko (Firefox) 或者Trident (mshtml.dll) (IE) 这些用于浏览器的 HTML 渲染引擎来对页面进行完整的解析和渲染。最后对这些引擎的解析结果进行分析。 <br /><br />　　这样做得好处是和显示结果最接近，因为他们是页面的真实解析结果。但是缺点是性能相对较差，因为是对页面的所有元素的完整解析，所以做了很多与提取文字信息无用的劳动，如果分析大数据量的页面的时候，需要权衡一下。<br /><br />from: <a href="http://sskb.cn/yingxiao/914-search-java.htm">http://sskb.cn/yingxiao/914-search-java.htm</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/88202.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-16 16:19 <a href="http://www.blogjava.net/weidagang2046/articles/88202.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ajax中文乱码问题解决方案（servlet）</title><link>http://www.blogjava.net/weidagang2046/articles/86610.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sat, 09 Dec 2006 15:06:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/86610.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/86610.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/86610.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/86610.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/86610.html</trackback:ping><description><![CDATA[
		<div class="postbody">最近研究ajax，在界面上text中输入中文，发送出去后返回乱码。经过一个晚上的测试，以及得到满意答案，代码如下：<br /><br />HTML：<br />    ……<br />    //实际上这里的charset=utf-8 也是可以的，因为在中文平台下<br />    //用了GB2312<br />    &lt;meta http-equiv="Content-Type" content="text/html; charset=GB2312"&gt;<br /><br />JS：<br />    <font color="#ff0000">我用了两个方法提交：GET 和 POST。<br />    在服务器端要对应不同的提交方式转换不同的编码。</font><br />   ……<br />    //要传递的参数<br />   var queryString = "firstName=" + firstName + "&amp;lastName=" + lastName<br />                          + "&amp;birthday=" + birthday;    function  <br /> <br />    //GET方式提交<br />    doRequestUsingGET() {<br />        createXMLHttpRequest();<br />        var url = "GetAndPostExample?" + queryString + "&amp;timeStamp="<br />                          + new Date().getTime();<br />        xmlHttp.onreadystatechange = handleStateChange;<br />        xmlHttp.open("GET", url, true);<br />        xmlHttp.send(null);<br />    }<br /><br />    //POST方式提交<br />    function doRequestUsingPOST() {<br />        createXMLHttpRequest();<br />        var url = "GetAndPostExample?timeStamp=" + new Date().getTime();<br />        xmlHttp.open("POST", url, true);<br />        xmlHttp.onreadystatechange = handleStateChange;<br />        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");<br />        xmlHttp.send(queryString);<br />    }<br /><br />servlet：<br />        response.setContentType("text/xml");<br /><br />        //<font color="#ff0000">这个一定要设置，这里的设置应该跟HTML中的一样，但是我在这里</font><br />        //用了 uft-8， 结果也是一样。<br />        response.setCharacterEncoding("GB2312");<br />      <br />        //<font color="#ff0000">当用POST方法时，一定要设置成utf-8，否则乱码</font><br />        String firstName = new String(request.getParameter("firstName").getBytes("ISO-8859-1"), "<font color="#ff0000">utf-8</font>");<br /><br />        //<font color="#ff0000">当用GET方法时，要设置成GB2312，否则乱码。</font><br />        String lastName = new String(request.getParameter("lastName").getBytes("ISO-8859-1"), "<font color="#ff0000">GB2312</font>");<br /><br />测试结果：<br />因为界面上两个控件firstName 和  lastName都输入中文。<br />接收xmlHttp.responseText后，会发现其中一个为乱码，一个可以正常显示中文。<br /><br />在网上还发现有人说用：<br />“老问题了，最简单的方法是，全部escape后发送。取回后unescape，绝对没有编码问题。”<br />我测试后发现escape后的东西全部变成null了。不知道有谁成功用过这个方法的，或者还有什么更好的解决乱码的方法，请拿出来共享一下吧 ：）<br /><br />from: <a href="http://www.themore.net/page/7/37/2006_08/detail_407_1.html">http://www.themore.net/page/7/37/2006_08/detail_407_1.html</a></div>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/86610.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-09 23:06 <a href="http://www.blogjava.net/weidagang2046/articles/86610.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript 的面向对象特性参考</title><link>http://www.blogjava.net/weidagang2046/articles/86324.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Fri, 08 Dec 2006 06:00:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/86324.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/86324.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/86324.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/86324.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/86324.html</trackback:ping><description><![CDATA[
		<p>最近在看用javascript+css实现rich client。javascript 也是一个蛮有意思的语言。特别是其面向对象的实现和其他“标准”的OO launguage有很大的不同。但是，都是动态语言，我还是觉得它比起python语法和库都差得太远。可是没有explorer支持python开发啊。。。：（ </p>
		<br />
		<p>这是我学习javascript中面向对象特性的一点总结。希望对具有其他语言的面向对象设计经验的朋友理解javascript的OO有所帮助。我具有c++,java和python的面向对象设计的经验。</p>
		<p>总的感受， javascript作为一种弱类型的动态语言，语法接近于java，但其面向对象的方式更和python相识。</p>
		<p>
				<strong>1 面向对象的特性</strong>
		</p>
		<br />
		<p>类，成员变量，成员函数，类变量，类方法，继承，多态</p>
		<p>
				<strong>1） 类</strong>
		</p>
		<br />
		<p>类的定义：function Circle(r) { this.r = r; } </p>
		<br />
		<p>类的实例化： c = Circle(3);</p>
		<p>
				<strong>2）成员变量</strong>
		</p>
		<br />
		<p>成员变量在初始化函数里申明：this.r = r; </p>
		<br />
		<p>注意，在对象生成后，你也可以给它附上成员变量，比如c.name="my circle"， </p>
		<br />
		<p>但是除非特别的需要，我强烈建议你不要这样做。也就是所有的成员都应在初始化函数里声明。我认为这是一种好的style。 </p>
		<br />
		<p>这一点和python很相识。</p>
		<p>
				<strong>3）成员函数</strong>
		</p>
		<br />
		<p>成员函数的标准形式是这样的： </p>
		<br />
		<p>Cricle.prototype.area = function() { return 3.14 * this.r * this.r; } </p>
		<br />
		<p>这和java或python或c++都大不一样。但为了帮助理解，你可以把prototype看作基类。 </p>
		<br />
		<p>prototype里面的变量或方法，是所有对象共享的。 </p>
		<br />
		<p>比如，c.area()调用最终就会让解释器调用到Circle.prototype.area(). </p>
		<p>相比于java和c++，javascript具有他们都没有的一个语义，也就是你可以在prototype里定义变量。定义在prototype里的变量可以被所有的实例共享量。所以一般它应该是一个常数，比如：Circle.prototype.PI = 3.14.</p>
		<p>显然，prototype里的变量和方法都应该是不变的。每一个对象实例都不应该取修改prototype中的内容。虽然语言允许你可以这样做，但这样做没有任何意义，也违反了面向对象的语义（想想，java会让你动态修改一个类的方法吗）。 </p>
		<br />
		<p>当然，对于多态是另外一回事，在后面详述。 </p>
		<p>而且，我建议所有的成员函数都在紧接类定义的地方定义。而不应该在代码运行的某个地方对一个对象实例增加/修改成员函数。这样的结果是javascript的类定义尽量向java看齐。使得代码更清晰。</p>
		<p>
				<strong>4）类变量</strong>
		</p>
		<br />
		<p>类变量是属于一个类的变量。就像java里用static修饰的变量。因为它属于类，所以它也应该是一个常量。实例不应该去修改它，虽然你可以（java里可以用final修饰，使得类变量一旦定义，就不能修改）。这里可以看到，类变量和prototype里定义的变量的功能是相似的。确实如此，他们的目的都是一样的。但他们的访问方式 </p>
		<br />
		<p>不一样。比如： </p>
		<br />
		<p>Circle.prototype.PI = 3.14; </p>
		<br />
		<p>Circle.PI = 3.14; </p>
		<br />
		<p>
				<em>//用prototype里的变量</em>
		</p>
		<br />
		<p>Circle.prototype.area1 = function() { return this.PI * this.r * this.r; } </p>
		<br />
		<p>
				<em>//用类变量</em>
		</p>
		<br />
		<p>Circle.prototype.area2 = function() { return Circle.PI * this.r * this.r; }</p>
		<p>
				<strong>5）类方法</strong>
		</p>
		<br />
		<p>这个概念应该很简单。注意类方法里绝对不要用this关键字，和java完全一样。 </p>
		<br />
		<p>Circle.max = function(a, b) {<br />    return a.r &gt; b.r ? a : b; <br />} </p>
		<br />
		<p>theMax = Circle(new Circle(1), new Circle(4));</p>
		<p>
				<strong>6）继承</strong>
		</p>
		<br />
		<p>子类继承父类，那么 “子类实例” 具有和 “父类实例” 完全一样的行为。javascript是这样实现的。 </p>
		<br />
		<p>function SubCircle(x, y, r) { <br />  this.x = x;<br />  this.y = y;<br />  this.r =r;<br />} </p>
		<br />
		<p>SubCircle.prototype = new Circle(0);<br />记得前面说的吗？可以把prototype看作一个基类。这里，prototype确确实实是一个基类。它是如何实现的呢？ </p>
		<br />
		<p>举例如下：<br />sc = SubCirlce(1,1,3); <br />sc.area(); </p>
		<br />
		<p>调用的传递：<br />sc.area()-&gt;sc.prototype.area()-&gt;Circle(0).area()-&gt;Circle.prototype.area().<br />看来是不是很奇妙呢。 </p>
		<br />
		<p>通过这种方式，javascript实现了继承。</p>
		<p>
				<strong>7）多态</strong>
		</p>
		<br />
		<p>多态是子类会定义和父类具有相同signature的方法。假设在SubCircle所在的空间PI=100,而面积公式也变为 PI*R*R*R。 </p>
		<br />
		<p>SubCircle.prototype.PI = 100 </p>
		<br />
		<p>SubCircle.prototype.area = function() {<br />   return this.PI*this.r*this.r*this.r; <br />}<br />Sc.area() </p>
		<p>这样的操作可以认为是: </p>
		<br />
		<p>Sc.PI-&gt;sc.prototype.PI-&gt;Cricle(0).PI = 100 </p>
		<br />
		<p>Sc.area()-&gt;sc.prototype.area()-&gt;Circle(0).area.<br />这个时候，调用过程是这样的 </p>
		<br />
		<p>sc.area()-&gt;sc.prototype.area(),在这里解释器发现了area这个方法，于是它就调用此方法。 </p>
		<br />
		<p>而Cricle.prototype.area就永远也不会被调用。PI的调用也是如此。那么子类如何想调用父类的方法应怎么办呢？好像没有什么办法哦，谁知道可以告诉我。但面向对象的理论告诉我们，继承主要是提供接口而不是代码复用，所以还是少有这样的念头为好 ：）。 </p>
		<br />
		<p>下面是一个例子程序。包含上面的所有的概念。<br /><font color="#333333"><font face="宋体"><strong>例子<br /></strong>///////////define: Cricle//////////////////<br />function Circle(r) {<br />this.r = r;<br />}<br />Circle.PI = 3.14;<br />Circle.prototype.PI = 3.14;<br />Circle.prototype.area = function() { return Circle.PI*this.r*this.r; }<br />Circle.prototype.area2 = function() { return this.PI*this.r*this.r; } </font></font></p>
		<br />
		<p>
				<br />//// test<br />c = new Circle(3);<br />//alert("area1 :"+c.area());<br />//alert("area2 :"+c.area2());</p>
		<p>Circle.max = function(a, b) { return a.r&gt;b.r ? a.r : b.r; }<br />//alert("max is "+Circle.max(new Circle(1), new Circle(3)));</p>
		<p>c1 = new Circle(1);<br />c2 = new Circle(1);<br />c2.PI = 100;//Circle.prototype.PI=100;</p>
		<p>//alert("c1.area1 "+c1.area());<br />//alert("c1.area2 "+c1.area2());<br />//alert("c2.area1 "+c2.area());<br />//alert("c2.area2 "+c2.area2());</p>
		<br />
		<p>////////////////////////define: SubCircle //////////////////<br />function SubCircle(x, y, r) {<br />this.x = x;<br />this.y = y;<br />this.r = r;<br />}<br />SubCircle.prototype = new Circle(0);<br />SubCircle.prototype.PI = 100;<br />SubCircle.prototype.move2 = function(x, y) { this.x = x; this.y = y;}<br />SubCircle.prototype.area = function() { return this.PI*this.r*this.r*this.r; }</p>
		<p>//// test<br />sc = new SubCircle(0,0,2);</p>
		<p>alert(sc.area());<br /><br />from: <a href="http://www.klstudio.com/post/52.html">http://www.klstudio.com/post/52.html</a></p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/86324.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-08 14:00 <a href="http://www.blogjava.net/weidagang2046/articles/86324.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个xmlhttp读取xml的例子</title><link>http://www.blogjava.net/weidagang2046/articles/85981.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 06 Dec 2006 15:59:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/85981.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/85981.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/85981.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/85981.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/85981.html</trackback:ping><description><![CDATA[
		<font face="Courier New"> </font>
		<p>
				<font face="Courier New">这是一个网友在论坛上问的一个问题。大体上在javascript中用xmlhttp读取一个xml文件：</font>
		</p>
		<p>
				<font face="Courier New">xml文件内容如下：</font>
		</p>
		<p>
				<font face="Courier New">  </font>
		</p>
		<table cellspacing="1" cellpadding="1" width="98%" border="0">
				<tbody>
						<tr>
								<td bgcolor="#ffcc00">
										<font face="Courier New"> &lt;?xml version="1.0" encoding="gb2312"?&gt;<br />&lt;RECORDS&gt;<br />   &lt;CATEGORY_CARS&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1040372&lt;/URL&gt;<br />      &lt;TITLE&gt;9成新绿亮牌电动车转让&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;今年51购买发票、车牌齐全，松下48V电瓶，可以续行110分钟&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1041502&lt;/URL&gt;<br />      &lt;TITLE&gt;特价转让桑塔纳2000&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;原产配置,无事故车况好有手续,可办理过户并可按客户要求送到指定地点&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1044092&lt;/URL&gt;<br />      &lt;TITLE&gt;忍痛转让汽动滑板车&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;购置仅一周，状况良好，百公里耗油不足两升，速度可达３０多公里每小时&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1044448&lt;/URL&gt;<br />      &lt;TITLE&gt;特惠售电瓶车一辆&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;购买不足一月因工作关系转让，手续齐全，有意者请尽快联系！&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1050116&lt;/URL&gt;<br />      &lt;TITLE&gt;诚意转扬子江摩托车(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;YZJ50QT-2，买了两年，八成新车况极好，因工作只好忍痛割爱&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1050587&lt;/URL&gt;<br />      &lt;TITLE&gt;急购二手电瓶车&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;7成以上新，型号稍大脚踏板出可站小孩较好就在这两三天内&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1052652&lt;/URL&gt;<br />      &lt;TITLE&gt;转自用黑色呈捷一辆(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;TR2001B，9成新，车况良好，液压避震，金属反光镜，晨新真空胎&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1043941&lt;/URL&gt;<br />      &lt;TITLE&gt;广州本田马自达M6求租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男30A照10年以上驾龄，熟悉上海及江浙一带周边道路，提供长短期用车业务&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1047092&lt;/URL&gt;<br />      &lt;TITLE&gt;全新别克诚意出租(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;真皮座椅，车况极佳。本人驾驶技术娴熟，熟悉市内道路并会简单英日文交流&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1052187&lt;/URL&gt;<br />      &lt;TITLE&gt;求购二手电瓶车一部&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;6成新以上，最好在普陀区交易，有意者msn联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1053335&lt;/URL&gt;<br />      &lt;TITLE&gt;几乎全新自行车转让&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男士山地26型女式永久牌26型，购于家乐福均有发票，因搬迁诚意转让&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1044190&lt;/URL&gt;<br />      &lt;TITLE&gt;求好骑的二手车&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;品质好吉安特、永久的都可以，价钱好商量在浦东世纪公园附近交易&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1041523&lt;/URL&gt;<br />      &lt;TITLE&gt;寻人拼车费用面议&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;彭浦新村到徐家汇漕溪路，８点前到晚５点回程，有４-５人长包上下班&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051441&lt;/URL&gt;<br />      &lt;TITLE&gt;寻同路人拼车上下班&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男，住虹口汶水东路在淮海中路上班，时间8：30－17：00&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1054749&lt;/URL&gt;<br />      &lt;TITLE&gt;面包车带车求职&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;全新东南得利卡面包车，三十年专职营运驾驶经验，低价出租亦可&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1038500&lt;/URL&gt;<br />      &lt;TITLE&gt;三十年驾龄B照带车求职&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;全新东南得利卡11座面包车带驾车可座十人.承接各种租车服务,专营司机&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_CARS&gt;<br />   &lt;CATEGORY_CITYLIFE&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1036176&lt;/URL&gt;<br />      &lt;TITLE&gt;刘若英世界巡演上海站&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;刘若英“公主彻夜未眠”世界巡回演唱会，锁定11/18上海大舞台&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1040570&lt;/URL&gt;<br />      &lt;TITLE&gt;国庆寻大鬼路子玩家&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;一直凑不足六人,有兴趣的朋友可以一起出来玩,时间初步定在10/5,地点看大家方便&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1043379&lt;/URL&gt;<br />      &lt;TITLE&gt;九折转让超女演唱会门票&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;因外出旅游欲九折转让，致电上海票务，他们负责送票上门&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1043153&lt;/URL&gt;<br />      &lt;TITLE&gt;专业汽车租赁公司&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;拥有大/中/小豪华及标准车型，性能好价格实惠，并可根据宾客的需要提供陪驾/代驾服务&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051918&lt;/URL&gt;<br />      &lt;TITLE&gt;想和王军霞一起跑步吗？&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;安利纽崔莱健康跑报名中，王军霞亲自领跑，参加健康跑，你就是健康冠军&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1048868&lt;/URL&gt;<br />      &lt;TITLE&gt;免费赠送波斯猫(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;本人因工作非常繁忙不能很好的照顾爱猫, 希望有爱猫的朋友能帮我照顾它&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ589655&lt;/URL&gt;<br />      &lt;TITLE&gt;有可爱的狗狗需要照顾吗?&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;喜欢小狗的我一只未能如愿，现在有条件了希望可以领养一只健康可爱的小狗&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1049943&lt;/URL&gt;<br />      &lt;TITLE&gt;征需要内存的朋友团购&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;大家一起买的话一定便宜啊，或者有谁认识人的，内部购买更便宜啊！&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1003751&lt;/URL&gt;<br />      &lt;TITLE&gt;陈奕迅2005上海演唱会&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;带给你优美动人平实的抒情歌曲,只有想不到,没有唱不到&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1019595&lt;/URL&gt;<br />      &lt;TITLE&gt;国际动漫展太空堡垒主题馆&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;太空堡垒中国联盟上海分部邀您重温传奇史诗,精彩不容错过&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1003779&lt;/URL&gt;<br />      &lt;TITLE&gt;迈克学摇滚倾情演唱会&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;F1中国大奖赛闭幕晚会,风靡世界的MLTR带给你抚动心弦的音乐&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ964856&lt;/URL&gt;<br />      &lt;TITLE&gt;温情迷你派对尽显女人魅力&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;晚免费的“魅力的我-色彩/彩妆学习秀”,快来加入这个美丽轻松的聚会吧 &lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ980288&lt;/URL&gt;<br />      &lt;TITLE&gt;寻共同练习salsa舞的朋友&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;每星期1－2次,每次一小时左右,愿意和你一起提高舞技,男士更好&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1016965&lt;/URL&gt;<br />      &lt;TITLE&gt;寻找：一起学古筝的朋友们&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;邀请和我一样爱好古筝的朋友共同学习,共同进步&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1032275&lt;/URL&gt;<br />      &lt;TITLE&gt;国家二级运动员陪练乒乓球&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;本人经过专业乒乓球训练12年,愿在业余时间与有兴趣人士切磋、教学&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1033483&lt;/URL&gt;<br />      &lt;TITLE&gt;寻人领养京巴小狗&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;因为工作关系无暇照看忍痛割爱,希望喜欢小狗且有一定收养条件的人来照顾她&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_CITYLIFE&gt;<br />   &lt;CATEGORY_FRIEND&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1015877&lt;/URL&gt;<br />      &lt;TITLE&gt;随和男人寻成熟女友(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;温和，追求简单生活，寻真诚热爱家庭生活的女性相知相爱&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1041173&lt;/URL&gt;<br />      &lt;TITLE&gt;两mm征驴友游三亚(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;我们两个女孩子想在11月份去三亚玩，具体时间未定，行程5天，费用自理&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1038755&lt;/URL&gt;<br />      &lt;TITLE&gt;十一象山看海征人同往 &lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;吹吹海风,品品海鲜，有兴趣的朋友赶快联系我吧 &lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1042714&lt;/URL&gt;<br />      &lt;TITLE&gt;高薪工程师寻有缘人 &lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男74年生1米77,外企从事</font>
										<a href="http://tech.acnow.net/Html/SoftWare/" target="_blank">
												<font face="Courier New">软件</font>
										</a>
										<font face="Courier New">开发，高薪，欲结识一位有爱心女子为友&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1050886&lt;/URL&gt;<br />      &lt;TITLE&gt;女幼教寻男友(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;女８１年生，丰满成熟气质佳，望找一名本科学历以上的男士&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1056619&lt;/URL&gt;<br />      &lt;TITLE&gt;寻湖北咸宁“任我行”&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;我是罗倩，我的手机丢找不到你，见广告请速与我联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1042486&lt;/URL&gt;<br />      &lt;TITLE&gt;寻师妹游丽娜&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;曾一起在福州市综艺武术馆习武的林松很想你，请速和我联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1056846&lt;/URL&gt;<br />      &lt;TITLE&gt;山东小伙诚征女友(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;山东人85年生，高大英俊有固定收入，心底善良，非诚勿扰&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1032110&lt;/URL&gt;<br />      &lt;TITLE&gt;优秀男人找相宜女友&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男174cm,名牌大学硕士研究生,市政府机关工作,品貌佳&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1027200&lt;/URL&gt;<br />      &lt;TITLE&gt;想在国庆行走漓江两畔吗?&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;因部分队员临时有事,故尚缺3-4名旅伴,邀有意者国庆同游阳朔山水&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1029016&lt;/URL&gt;<br />      &lt;TITLE&gt;寻友国庆周边一日游&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;十一假期期间任意一天,现只有我一人,寻同样孤单的朋友同玩&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd?AdId=953993&lt;/URL&gt;<br />      &lt;TITLE&gt;上海女孩诚征韩国朋友(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;我在新加坡留学,假期想结交几个韩国朋友互相进行语言学习,联系我吧&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ601190&lt;/URL&gt;<br />      &lt;TITLE&gt;温柔女人寻成熟稳重男士&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;25岁,开朗大方,国企工作,欲觅一个比较成熟型男士走过以后的岁月&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1026506&lt;/URL&gt;<br />      &lt;TITLE&gt;高挑美丽女店主寻成熟男士&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;自营服装店女店主,81年生,高挑美丽,月收入5000,有独居房&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1016313&lt;/URL&gt;<br />      &lt;TITLE&gt;衢州户外体验游&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;登山/穿越/篝火/烧烤/游湖/探索千古之谜,等你一起和大自然亲密接触&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1029693&lt;/URL&gt;<br />      &lt;TITLE&gt;寻原中百一店的袁伟&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;现在你在何处,不知可好,在此我真心祝愿你幸福快乐&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_FRIEND&gt;<br />   &lt;CATEGORY_HOUSING&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1041036&lt;/URL&gt;<br />      &lt;TITLE&gt;工商银行家属院寻求合租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;有热水器、电视、家具、床本人在任职TCL工业事业部，长期出差&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1040748&lt;/URL&gt;<br />      &lt;TITLE&gt;莘潭路莘松三村好房招租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;两室一厅一卫,全套家电 ,部分家具周围配套设施齐全交通便利&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1039380&lt;/URL&gt;<br />      &lt;TITLE&gt;七宝南国花园房寻合租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;三房两厅出租其中两间朝南，16平米，有大床/衣橱/电视/电话&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1041154&lt;/URL&gt;<br />      &lt;TITLE&gt;求租普通民房&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;一个人住，有床水电即可，位置在人民医院周围2里路附近&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1050278&lt;/URL&gt;<br />      &lt;TITLE&gt;适合男生的合租房&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;近华师大，出行交通便利，基本生活设施齐全，有阳台&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051094&lt;/URL&gt;<br />      &lt;TITLE&gt;求西藏南路附近租房 &lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;近瞿溪路口用于上钢琴课，有意者请尽快联系我&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1055107&lt;/URL&gt;<br />      &lt;TITLE&gt;出租莘庄地铁附近好房&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;小区环境优美品质高，生活/交通便利，设施全装修好，可短租&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1049382&lt;/URL&gt;<br />      &lt;TITLE&gt;急寻长宁区古北路附近租房&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;因工作需要急需在附近寻合租房，最好是一辆车能到古北路的69/72路等，有请速和我联系,急!&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1042000&lt;/URL&gt;<br />      &lt;TITLE&gt;平南四村全配房寻女性合租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;近漕宝路两室一厅一卫，小区周围配套设施齐全，交通便利&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1055161&lt;/URL&gt;<br />      &lt;TITLE&gt;浦东好房出租可看高楼夜景&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;步行10分钟可到2号线东昌路站，12平米+卫生间，有空调/冰箱/家具，仅限一人&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1053216&lt;/URL&gt;<br />      &lt;TITLE&gt;张江玉兰新苑等你入住&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;空调，电视，厨房设备齐全配备微波炉，仅剩下一间欲租从速&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051912&lt;/URL&gt;<br />      &lt;TITLE&gt;南方商城附近寻女生合租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;租房大，设施齐全，出行方便，寻工作稳定生活规律易相处的女生入住&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051207&lt;/URL&gt;<br />      &lt;TITLE&gt;寻市区合租伙伴&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;年后到市区上班，寻较好地段带简易家具/家电/淋浴室的合租房，限女生&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1047572&lt;/URL&gt;<br />      &lt;TITLE&gt;带小花园的好房出租&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;东方路蓝村路临近新地铁站,一室一厅.厨卫齐全室内新装修,家具齐全&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1056539&lt;/URL&gt;<br />      &lt;TITLE&gt;求租长宁区2室1厅房&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;长宁东华大学附近或者金沙江轻轨站附近，有生活设施，长租，价格面谈&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ895455&lt;/URL&gt;<br />      &lt;TITLE&gt;求租长宁区一室户&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;单间，天山路附近最佳，请尽快跟我联系，杨先生&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_HOUSING&gt;<br />   &lt;CATEGORY_JOBS&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ605259&lt;/URL&gt;<br />      &lt;TITLE&gt;礼品派发及现场礼仪&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;演唱会记者招待会,只限在校生或高中/三校毕业生,男女生不限&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1014811&lt;/URL&gt;<br />      &lt;TITLE&gt;想和明星近距离接触吗？&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;华世影视招影视演员/兼职见习,展示您演艺才华的舞台,提供专业发展机会&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1031231&lt;/URL&gt;<br />      &lt;TITLE&gt;高薪招聘网络客服人员&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;高中/高中以上文凭,普通话好善于沟通,有网上销售经验者优先&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1029787&lt;/URL&gt;<br />      &lt;TITLE&gt;国际乐器展览会兼职机会&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;2005上海国际乐器展览会招礼仪/录入/服务等兼职人员,欢迎报名&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1027170&lt;/URL&gt;<br />      &lt;TITLE&gt;卡思奇感诚聘幼教人员&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;亲和力强,形象好,素质高,有意者请携简历及近照到公司面谈&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1030616&lt;/URL&gt;<br />      &lt;TITLE&gt;高薪招聘</font>
										<a href="http://tech.acnow.net/Html/Program/Soft_Project/" target="_blank">
												<font face="Courier New">软件工程</font>
										</a>
										<font face="Courier New">师&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;精通JAVA/delphi/SQL serve,浦东陆家嘴上班,待遇从优&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1008972&lt;/URL&gt;<br />      &lt;TITLE&gt;仓管人员兼职的好去处&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;本公司经营印刷业务,欲招仓管或相关人员兼职,待遇优厚,机不可失&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1024270&lt;/URL&gt;<br />      &lt;TITLE&gt;豪斯婚礼天马影视招实习&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;广告</font>
										<a href="http://tech.acnow.net/Html/SoftWare/DesignOnline/" target="_blank">
												<font face="Courier New">设计</font>
										</a>
										<font face="Courier New">/影视制作/摄影/</font>
										<a href="http://tech.acnow.net/html/SoftWare/DesignOnline/artist/" target="_blank">
												<font face="Courier New">美工</font>
										</a>
										<font face="Courier New">设计/新娘化妆等实习机会,提供实战平台&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1027163&lt;/URL&gt;<br />      &lt;TITLE&gt;酒吧诚聘业务主管&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;本酒吧位于长宁区武夷路88号,现招聘酒吧业务主管一名,待遇从优&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1029926&lt;/URL&gt;<br />      &lt;TITLE&gt;招双休日派发人员&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;各类食品、日常用品、化妆品双休日派发,工作地点就近安排&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1016030&lt;/URL&gt;<br />      &lt;TITLE&gt;高薪聘请平面设计人员&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;熟练掌握photoshop等软件从业经验最好在一年以上,最好有喷绘操作经验&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1027149&lt;/URL&gt;<br />      &lt;TITLE&gt;诚聘专职/兼职销售人员&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;美国独资化妆品销售企业诚聘全职/兼职销售代表,回报丰厚&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1002288&lt;/URL&gt;<br />      &lt;TITLE&gt;正国机电招会计人员 &lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;女性有会计师从业资格证,3年以上相关专业工作经验,能够熟练操作电脑&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd?AdId=966377&lt;/URL&gt;<br />      &lt;TITLE&gt;传媒公司高薪招业务主任&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;22－28岁,大专以上学历,有房地产/酒店/餐饮/金融方面工作经验者优先&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1029151&lt;/URL&gt;<br />      &lt;TITLE&gt;高薪聘请文职人员若干&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;电话回访员/区域服务员/收费员各5名,沪高中,30-45岁,待遇从优&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1034664&lt;/URL&gt;<br />      &lt;TITLE&gt;招聘酒吧服务生&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;位于徐汇区，可兼职，晚7点至次日凌晨2点上班，待遇面谈&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_JOBS&gt;<br />   &lt;CATEGORY_SECONDHAND&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1035728&lt;/URL&gt;<br />      &lt;TITLE&gt;经典超薄笔记本!(图)&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;PIII1.2G/256M/40G/DVD/14.1TFT/LI电,全球联保至06年4月 &lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1005327&lt;/URL&gt;<br />      &lt;TITLE&gt;出步步高复读机/VCD&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;步步高复读机BK-791八成新,步步高便捷式VCD播放器-F7,全部低价出售&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1056362&lt;/URL&gt;<br />      &lt;TITLE&gt;超低价转让二手家具电器&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;因搬迁想尽快处理掉，自行车和家电都有发票，对需要的人来说真的实惠&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051854&lt;/URL&gt;<br />      &lt;TITLE&gt;寻找二手洗衣机&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;急需二手洗衣机一台,4.0G 公斤以上,最好能送货上门,价格可议&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1042275&lt;/URL&gt;<br />      &lt;TITLE&gt;低价转女士自行车/饮水机&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;凤凰牌26寸六成新，骑起来很轻松；美的台式饮水机，9成新，半价出售&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1039422&lt;/URL&gt;<br />      &lt;TITLE&gt;求购二手电脑&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;我在张江，不要太贵能用就行，有的朋友请跟我联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1054825&lt;/URL&gt;<br />      &lt;TITLE&gt;出让超女演唱会门票&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;本人是“笔笔”的粉丝，临时决定去旅游不能去了，有意者请与我联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051809&lt;/URL&gt;<br />      &lt;TITLE&gt;低价转星之健健身单次卡&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;适用于上海的七家星之健门店，环境舒适，有效期长至明年4月19日&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1051691&lt;/URL&gt;<br />      &lt;TITLE&gt;折价转让国际烟花节门票&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;两张，因工作原因无法前去，有意者请速联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1049993&lt;/URL&gt;<br />      &lt;TITLE&gt;求购二手彩屏手机&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;非国产，最好诺基亚，包括电池板和充电器&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1016140&lt;/URL&gt;<br />      &lt;TITLE&gt;超酷非利谱859转让&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;今年7月买进，手续齐全，有保，有意者请速联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1048154&lt;/URL&gt;<br />      &lt;TITLE&gt;出售超薄松下ＣＤ机&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;银色 ９成新 15.8mm仅重127克，金属味十足，高档气派&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1044191&lt;/URL&gt;<br />      &lt;TITLE&gt;转让原版CFA一二级教材&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;自购的原版教材，现考试已通过故出售，今年一二级的考生都用得着&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1055629&lt;/URL&gt;<br />      &lt;TITLE&gt;惊喜价全新兰蔻果汁唇彩&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;Ultra Shiny Lip Gloss，15ml装，法国原产，绝对实惠&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1049930&lt;/URL&gt;<br />      &lt;TITLE&gt;出国带回的sk-II面膜&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;净白修护，另有兰蔻洗面奶,数量不多欲购从速&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;RECORD&gt;<br />      &lt;URL&gt;http://shanghai.kijiji.com.cn/classifieds/ViewAd-W0QQAdIdZ1049911&lt;/URL&gt;<br />      &lt;TITLE&gt;低价出高夫礼盒&lt;/TITLE&gt;<br />      &lt;DESCRIPTION&gt;男士用的高夫三件套的礼盒，现低价出售或置换，有意者请电话联系&lt;/DESCRIPTION&gt;<br />   &lt;/RECORD&gt;<br />   &lt;/CATEGORY_SECONDHAND&gt;<br />&lt;/RECORDS&gt;<br /></font>
								</td>
						</tr>
				</tbody>
		</table>
		<font face="Courier New">
		</font>
		<p>
				<font face="Courier New">假设其网络地址为：</font>
				<a href="http://tech.acnow.net/rss/listings.xml">
						<font face="Courier New">/rss/listings.xml</font>
				</a>
		</p>
		<p>
				<font face="Courier New">则，针对网友的这个需求：</font>
		</p>
		<p>
		</p>
		<table cellspacing="1" cellpadding="1" width="98%" border="0">
				<tbody>
						<tr>
								<td bgcolor="#339999">
										<font face="Courier New"> 不过这个xml中有&lt;CATEGORY_FRIEND&gt;&lt;CATEGORY_CARS&gt;的各个节点,我想分别读出每个&lt;category&gt;中的数据,并随机显示一条出来即可。不知道改如何做。<br /></font>
								</td>
						</tr>
				</tbody>
		</table>
		<p>
				<font face="Courier New">写的代码如下：</font>
		</p>
		<font face="Courier New">&lt;body&gt;<br />&lt;div id=t&gt;&lt;/div&gt;<br />&lt;/body&gt;<br />&lt; script &gt;<br />x =new ActiveXObject("Microsoft.</font>
		<a href="http://tech.acnow.net/Html/Web/XML/" target="_blank">
				<font face="Courier New">XML</font>
		</a>
		<font face="Courier New">HTTP")<br />x.open("GET","/rss/listings.xml",false)<br />x.send()<br />if(x.status==200)<br />{<br />d = x.responseXML<br />c = "&lt;table&gt;"<br />nodes = d.selectNodes("//RECORDS") for(i = 0;i&lt;nodes[0].childNodes.length;i++)<br />{<br />   subnodes=nodes[0].childNodes[i].childNodes;<br />   j=Math.floor(subnodes.length * Math.random())<br />  <br />   c+="&lt;tr&gt;&lt;td style='color:ff0000;font-weight:bold'&gt;" +  nodes[0].childNodes[i].nodeName + "：&lt;/td&gt;&lt;/tr&gt;"<br />   c+="&lt;tr&gt;&lt;td&gt;&lt;a href='" + subnodes[j].childNodes[0].text + "'&gt;" + subnodes[j].childNodes[1].text + "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;"<br />   c+="&lt;tr&gt;&lt;td&gt;" +subnodes[j].childNodes[2].text + "&lt;/td&gt;&lt;/tr&gt;"<br />}c += "&lt;/table&gt;"<br />document.all.t.inner</font>
		<a href="http://tech.acnow.net/Html/Web/HTML/" target="_blank">
				<font face="Courier New">HTML</font>
		</a>
		<font face="Courier New"> = c<br />}<br />&lt;/script&gt;<br /></font>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/85981.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-06 23:59 <a href="http://www.blogjava.net/weidagang2046/articles/85981.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>编写高性能Web应用程序的10个入门技巧</title><link>http://www.blogjava.net/weidagang2046/articles/85980.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 06 Dec 2006 15:57:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/85980.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/85980.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/85980.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/85980.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/85980.html</trackback:ping><description><![CDATA[
		<p>编写高性能Web应用程序的10个入门技巧<br /><br />  数据层性能 <br />  技巧 1 — 返回多个结果集 <br />  技巧 2 — 分页的数据访问 <br />  技巧 3 — 连接池 <br />  技巧 4 — ASP.NET 缓存 API <br />  技巧 5 — 每请求缓存 <br />  技巧 6 — 后台处理 <br />  技巧 7 — 页输出缓存和代理<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a><br />  技巧 8 — 运行 IIS 6.0（只要用于内核缓存） <br />  技巧 9 — 使用 Gzip 压缩 <br />  技巧 10 — <a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件视图状态 <br />  <br /><br />使用 ASP.NET 编写 Web 应用程序的简单程度令人不敢相信。正因为如此简单，所以很多<br />开发人员就不会花时间来设计其应用程序的结构，以获得更好的性能了。在本文中，我将<br />讲述 10 个用于编写高性能 Web 应用程序的技巧。但是我并不会将这些建议仅局限于 <br />ASP.NET 应用程序，因为这些应用程序只是 Web 应用程序的一部分。本文不作为对 Web <br />应用程序进行性能调整的权威性指南 — 一整本书恐怕都无法轻松讲清楚这个问题。请将<br />本文视作一个很好的起点。 <br /><br />成为工作狂之前，我原来喜欢攀岩。在进行任何大型攀岩活动之前，我都会首先仔细查看<br />指南中的路线，阅读以前游客提出的建议。但是，无论指南怎么好，您都需要真正的攀岩<br />体验，然后才能尝试一个特别具有挑战性的攀登。与之相似，当您面临修复性能问题或者<br />运行一个高吞吐量站点的问题时，您只能学习如何编写高性能 Web 应用程序。<br /><br />我的个人体验来自在 Microsoft 的 ASP.NET 部门作为基础架构程序经理的经验，在此期<br />间我运行和管理 www.ASP.NET，帮助设计社区<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的结构，社区<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>是几个著名 <br />ASP.NET 应用程序（组合到一个平台的 ASP.NET Forums、.Text 和 nGallery）。我确信<br />有些曾经帮助过我的技巧对您肯定也会有所帮助。<br /><br />您应该考虑将应用程序分为几个逻辑层。您可能听说过 3 层（或者 n 层）物理体系结构<br />一词。这些通常都是规定好的体系结构方式，将功能在进程和/或硬件之间进行了物理分离<br />。当系统需要扩大时，可以很轻松地添加更多的硬件。但是会出现一个与进程和机器跳跃<br />相关的性能下降，因此应该避免。所以，如果可能的话，请尽量在同一个应用程序中一起<br />运行 ASP.NET 页及其相关组件。<br /><br />因为代码分离以及层之间的边界，所以使用 Web 服务或远程处理将会使得性能下降 20% <br />甚至更多。<br /><br />数据层有点与众不同，因为通常情况下，最好具有专用于<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>的硬件。然而进程跳跃到<br /><a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>的成本依然很高，因此数据层的性能是您在优化代码时首先要考虑的问题。<br /><br />在深入应用程序的性能修复问题之前，请首先确保对应用程序进行剖析，以便找出具体的<br />问题所在。主要性能计数器（如表示执行垃圾回收所需时间百分比的计数器）对于找出应<br />用程序在哪些位置花费了其主要时间也非常有用。然而花费时间的位置通常非常不直观。<br /><br />本文讲述了两种类型的性能改善：大型优化（如使用 ASP.NET 缓存），和进行自身重复的<br />小型优化。这些小型优化有时特别有意思。您对代码进行一点小小的更改，就会获得很多<br />很多时间。使用大型优化，您可能会看到整体性能的较大飞跃。而使用小型优化时，对于<br />某个特定请求可能只会节省几毫秒的时间，但是每天所有请求加起来，则可能会产生巨大<br />的改善。<br /><br />数据层性能<br /><br /><br />谈到应用程序的性能调整，有一个试纸性的测试可用来对工作进行优先级划分：代码是否<br />访问<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>？如果是，频率是怎样的？请注意，这一相同测试也可应用于使用 Web 服务或<br />远程处理的代码，但是本文对这些内容未做讲述。<br /><br />如果某个特定的代码路径中必需进行<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>请求，并且您认为要首先优化其他领域（如字<br />符串操作），则请停止，然后执行这个试纸性测试。如果您的性能问题不是非常严重的话<br />，最好花一些时间来优化一下与<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>、返回的数据量、进出<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>的往返频率相关的花<br />费时间。<br /><br />了解这些常规信息之后，我们来看一下可能会有助于提高应用程序性能的十个技巧。首先<br />，我要讲述可能会引起最大改观的更改。<br /><br /><br />技巧 1 — 返回多个结果集<br /><br /><br />仔细查看您的<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>代码，看是否存在多次进入<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>的请求路径。每个这样的往返都会<br />降低应用程序可以提供的每秒请求数量。通过在一个<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>请求中返回多个结果集，可以<br />节省与<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>进行通信所需的总时间长度。同时因为减少了<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a><a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>管理请求的工作<br />，还会使得系统伸缩性更强。<br /><br />虽然可以使用动态 SQL 返回多个结果集，但是我首选使用存储过程。关于业务逻辑是否应<br />该驻留于存储过程的问题还存在一些争议，但是我认为，如果存储过程中的逻辑可以约束<br />返回数据的话（缩小数据集的大小、缩短网络上所花费时间，不必筛选逻辑层的数据），<br />则应赞成这样做。<br /><br />使用 SqlCommand 实例及其 ExecuteReader 方法填充强类型的业务类时，可以通过调用 <br />NextResult 将结果集指针向前移动。图 1 显示了使用类型类填充几个 ArrayList 的示例<br />会话。只从<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>返回您需要的数据将进一步减少<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>上的内存分配。 <br /><br />Figure 1 Extracting Multiple Resultsets from a DataReader<br />// read the first resultset<br />reader = command.ExecuteReader();<br /><br />// read the data from that resultset<br />while (reader.Read()) {<br />    suppliers.Add(PopulateSupplierFromIDataReader( reader ));<br />}<br /><br />// read the next resultset<br />reader.NextResult();<br /><br />// read the data from that second resultset<br />while (reader.Read()) {<br />    products.Add(PopulateProductFromIDataReader( reader ));<br />}<br /><br /><br />技巧 2 — 分页的数据访问<br /><br /><br />ASP.NET DataGrid 具有一个很好的功能：数据分页支持。在 DataGrid 中启用分页时，一<br />次会显示固定数量的记录。另外，在 DataGrid 的底部还会显示分页 UI，以便在记录之间<br />进行导航。该分页 UI 使您能够在所显示的数据之间向前和向后导航，并且一次显示固定<br />数量的记录。<br /><br />还有一个小小的波折。使用 DataGrid 的分页需要所有数据均与网格进行绑定。例如，您<br />的数据层需要返回所有数据，那么 DataGrid 就会基于当前页筛选显示的所有记录。如果<br />通过 DataGrid 进行分页时返回了 100,000 个记录，那么针对每个请求会放弃 99,975 个<br />记录（假设每页大小为 25 个记录）。当记录的数量不断增加时，应用程序的性能就会受<br />到影响，因为针对每个请求必须发送越来越多的数据。<br /><br />要编写性能更好的分页代码，一个极佳的方式是使用存储过程。图 2 显示了针对 <br />Northwind <a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>中的 Orders 表进行分页的一个示例存储过程。简而言之，您此时要做<br />的只是传递页索引和页大小。然后就会计算合适的结果集，并将其返回。 <br /><br />Figure 2 Paging Through the Orders Table<br />CREATE PROCEDURE northwind_OrdersPaged<br />(<br />    @PageIndex int, <br />    @PageSize int<br />)<br />AS<br />BEGIN<br />DECLARE @PageLowerBound int<br />DECLARE @PageUpperBound int<br />DECLARE @RowsToReturn int<br /><br />-- First set the rowcount<br />SET @RowsToReturn = @PageSize * (@PageIndex + 1)<br />SET ROWCOUNT @RowsToReturn<br /><br />-- Set the page bounds<br />SET @PageLowerBound = @PageSize * @PageIndex<br />SET @PageUpperBound = @PageLowerBound + @PageSize + 1<br /><br />-- Create a temp table to store the select results<br />CREATE TABLE #PageIndex <br />(<br />    IndexId int IDENTITY (1, 1) NOT NULL,<br />    OrderID int<br />)<br /><br />-- Insert into the temp table<br />INSERT INTO #PageIndex (OrderID)<br />SELECT <br />    OrderID<br />FROM <br />    Orders<br />ORDER BY <br />    OrderID DESC<br /><br />-- Return total count<br />SELECT COUNT(OrderID) FROM Orders<br /><br />-- Return paged results<br />SELECT <br />    O.*<br />FROM <br />    Orders O,<br />    #PageIndex PageIndex<br />WHERE <br />    O.OrderID = PageIndex.OrderID AND<br />    PageIndex.IndexID &gt; @PageLowerBound AND<br />    PageIndex.IndexID &lt; @PageUpperBound<br />ORDER BY <br />    PageIndex.IndexID<br /><br />END<br /><br /><br /><br />在社区<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>中，我们编写了一个分页<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件，以完成所有的数据分页。您将会看到<br />，我使用的就是技巧 1 中讨论的理念，从一个存储过程返回两个结果集：记录的总数和请<br />求的数据。<br /><br />返回记录的总数可能会根据所执行查询的不同而有所变化。例如，WHERE 子句可用来约束<br />返回的数据。为了计算在分页 UI 中显示的总页数，必须了解要返回记录的总数。例如，<br />如果总共有 1,000,000 条记录，并且要使用一个 WHERE 子句将其筛选为 1000 条记录，<br />那么分页逻辑就需要了解记录的总数才能正确呈现分页 UI。<br /><br /><br />技巧 3 — 连接池<br /><br /><br />在 Web 应用程序和 <a href="http://www.chinahtml.com/databases/2/" target="_blank">SQL Server</a>? 之间设置 TCP 连接可能是一个非常消耗资源的操作。Mi<br />crosoft 的开发人员到目前为止能够使用连接池已经有一段时间了，这使得他们能够重用<br /><a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>连接。他们不是针对每个请求都设置一个新的 TCP 连接，而是只在连接池中没有任<br />何连接时才设置新连接。当连接关闭时，它会返回连接池，在其中它会保持与<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>的连<br />接，而不是完全破坏该 TCP 连接。<br /><br />当然，您需要小心是否会出现泄漏连接。当您完成使用连接时，请一定要关闭这些连接。<br />再重复一遍：无论任何人对 Microsoft?.NET Framework 中的垃圾回收有什么评论，请一<br />定要在完成使用连接时针对该连接显式调用 Close 或 Dispose。不要相信公共语言运行库<br />(CLR) 会在预先确定的时间为您清除和关闭连接。尽管 CLR 最终会破坏该类，并强制连<br />接关闭，但是当针对对象的垃圾回收真正发生时，并不能保证。 <br /><br />要以最优化的方式使用连接池，需要遵守一些规则。首先打开连接，执行操作，然后关闭<br />该连接。如果您必须如此的话，可以针对每个请求多次打开和关闭连接（最好应用技巧 1<br />），但是不要一直将连接保持打开状态并使用各种不同的方法对其进行进出传递。第二，<br />使用相同的连接字符串（如果使用集成身份验证的话，还要使用相同的线程标识）。如果<br />不使用相同的连接字符串，例如根据登录的用户自定义连接字符串，那么您将无法得到连<br />接池提供的同一个优化值。如果您使用集成身份验证，同时还要模拟大量用户，连接池的<br />效率也会大大下降。尝试跟踪与连接池相关的任何性能问题时，.NET CLR 数据性能计数器<br />可能非常有用。 <br /><br />每当应用程序连接资源时，如在另一个进程中运行的<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>，您都应该重点考虑连接该资<br />源所花时间、发送或检索数据所花时间，以及往返的数量，从而进行优化。优化应用程序<br />中任何种类的进程跳跃都是获得更佳性能的首要一点。<br /><br />应用层包含了连接数据层、将数据转换为有意义类实例和业务流程的逻辑。例如社区服务<br />器，您要在其中填充Forums 或 Threads集合，应用业务规则（如权限）；最重要的是要在<br />其中执行缓存逻辑。<br /><br /><br />技巧 4 — ASP.NET 缓存 API<br /><br /><br />编写应用程序代码行之前，一个首要完成的操作是设计应用层的结构，以便最大化利用 <br />ASP.NET 缓存功能。<br /><br />如果您的组件要在 ASP.NET 应用程序中运行，则只需在该应用程序项目中包括一个 <br />System.Web.dll 引用。当您需要访问该缓存时，请使用 HttpRuntime.Cache 属性（通过 <br />Page.Cache 和 HttpContext.Cache 也可访问这个对象）。<br /><br />对于缓存数据，有几个规则。首先，如果数据可能会多次使用时，则这是使用缓存的一个<br />很好的备选情况。第二，如果数据是通用的，而不特定于某个具体的请求或用户时，则也<br />是使用缓存的一个很好的备选情况。如果数据是特定于用户或请求的，但是寿命较长的话<br />，仍然可以对其进行缓存，但是这种情况可能并不经常使用。第三，一个经常被忽略的规<br />则是，有时可能您缓存得太多。通常在一个 x86 计算机上，为了减少内存不足错误出现的<br />机会，您会想使用不高于 800MB 的专用字节运行进程。因此缓存应该有个限度。换句话说<br />，您可能能够重用某个计算结果，但是如果该计算采用 10 个参数的话，您可能要尝试缓<br />存 10 个排列，这样有可能给您带来麻烦。一个要求 ASP.NET 的最常见支持是由于过度缓<br />存引起的内存不足错误，尤其是对于大型数据集。<br /><br /><br />缓存有几个极佳的功能，您需要对它们有所了解。首先，缓存会实现最近最少使用的算法<br />，使得 ASP.NET 能够在内存运行效率较低的情况下强制缓存清除 － 从缓存自动删除未使<br />用过的项目。第二，缓存支持可以强制失效的过期依赖项。这些依赖项包括时间、密钥和<br />文件。时间经常会用到，但是对于 ASP.NET 2.0，引入了一个功能更强的新失效类型：数<br />据库缓存失效。它指的是当<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a>中的数据发生变化时自动删除缓存中的项。有关<a href="http://www.chinahtml.com/databases/" target="_blank">数据库</a><br />缓存失效的详细信息，请参阅 MSDN?Magazine 2004 年 7 月的 Dino Esposito Cutting <br />Edge 专栏。要了解缓存的体系结构，请参阅图 3。<br /><br />技巧 5 — 每请求缓存<br /><br />在本文前面部分，我提到了经常遍历代码路径的一些小改善可能会导致较大的整体性能收<br />益。对于这些小改善，其中有一个绝对是我的最爱，我将其称之为"每请求缓存"。<br /><br />缓存 API 的设计目的是为了将数据缓存较长的一段时间，或者缓存至满足某些条件时，但<br />每请求缓存则意味着只将数据缓存为该请求的持续时间。对于每个请求，要经常访问某个<br />特定的代码路径，但是数据却只需提取、应用、修改或更新一次。这听起来有些理论化，<br />那么我们来举一个具体的示例。<br /><br />在社区<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的论坛应用程序中，页面上使用的每个<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件都需要个性化的数据来确<br />定使用什么外观、使用什么样式表，以及其他个性化数据。这些数据中有些可以长期缓存<br />，但是有些数据却只针对每个请求提取一次，然后在执行该请求期间对其重用多次，如要<br />用于控件的外观。<br /><br />为了达到每请求缓存，请使用 ASP.NET HttpContext。对于每个请求，都会创建一个 <br />HttpContext 实例，在该请求期间从 HttpContext.Current 属性的任何位置都可访问该实<br />例。该 HttpContext 类具有一个特殊的 Items 集合属性；添加到此 Items 集合的对象和<br />数据只在该请求持续期间内进行缓存。正如您可以使用缓存来存储经常访问的数据一样，<br />您也可以使用 HttpContext.Items 来存储只基于每个请求使用的数据。它背后的逻辑非常<br />简单：数据在它不存在的时候添加到 HttpContext.Items 集合，在后来的查找中，只是返<br />回 HttpContext.Items 中的数据。<br /><br /><br />技巧 6 — 后台处理<br /><br /><br />通往代码的路径应该尽可能快速，是吗？可能有时您会觉得针对每个请求执行的或者每 <br />n 个请求执行一次的任务所需资源非常多。发送电子邮件或者分析和验证传入数据就是这<br />样的一些例子。<br /><br />剖析 ASP.NET Forums 1.0 并重新构建组成社区<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的内容时，我们发现添加新张贴的<br />代码路径非常慢。每次添加新张贴时，应用程序首先需要确保没有重复的张贴，然后必须<br />使用"坏词"筛选器分析该张贴，分析张贴的字符图释，对张贴添加标记并进行索引，请求<br />时将张贴添加到合适的队列，验证附件，最终张贴之后，立即向所有订阅者发出电子邮件<br />通知。很清楚，这涉及很多操作。<br /><br />经研究发现，大多数时间都花在了索引逻辑和发送电子邮件上。对张贴进行索引是一个非<br />常耗时的操作，人们发现内置的 System.Web.Mail 功能要连接 SMYP <a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>，然后连续发<br />送电子邮件。当某个特定张贴或主题领域的订阅者数量增加时，执行 AddPost 功能所需的<br />时间也越来越长。<br /><br />并不需要针对每个请求都进行电子邮件索引。理想情况下，我们想要将此操作进行批处理<br />，一次索引 25 个张贴或者每五分钟发送一次所有电子邮件。我们决定使用以前用于对数<br />据缓存失效进行原型设计的代码，这个失效是用于最终进入 Visual Studio? 2005 的内容<br />的。<br /><br />System.Threading 命名空间中的 Timer 类非常有用，但是在 .NET Framework 中不是很<br />有名，至少对于 Web 开发人员来说是这样。创建之后，这个 Timer 类将以一个可配置的<br />间隔针对 ThreadPool 中的某个线程调用指定的回调。这就表示，您可以对代码进行设置<br />，使其能够在没有对 ASP.NET 应用程序进行传入请求的情况下得以执行，这是后台处理的<br />理想情况。您还可以在此后台进程中执行如索引或发送电子邮件之类的操作。 <br /><br />但是，这一技术有几个问题。如果应用程序域卸载，该计时器实例将停止触发其事件。另<br />外，因为 CLR 对于每个进程的线程数量具有一个硬性标准，所以可能会出现这样的情形：<br /><a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>负载很重，其中计时器可能没有可在其基础上得以完成的线程，在某种程度上可能<br />会造成延迟。ASP.NET 通过在进程中保留一定数量的可用线程，并且仅使用总线程的一部<br />分用于请求处理，试图将上述情况发生的机会降到最低。但是，如果您具有很多异步操作<br />时，这可能就是一个问题了。 <br /><br />这里没有足够的空间来放置该代码，但是您可以下载一个可以看懂的示例，网址是 <br />www.rob-howard.net。请了解一下 Blackbelt TechEd 2004 演示中的幻灯片和演示。<br /><br /><br />技巧 7 — 页输出缓存和代理<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a><br /><br /><br />ASP.NET 是您的表示层（或者说应该是您的表示层）；它由页、用户控件、<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件（H<br />ttpHandlers 和 HttpModules）以及它们生成的内容组成。如果您具有一个 ASP.NET 页，<br />它会生成输出（HTML、XML、图像或任何其他数据），并且您针对每个请求运行此代码时，<br />它都会生成相同的输出，那么您就拥有一个可用于页输出缓存的绝佳备选内容。 <br /><br />将此行内容添加页的最上端 <br /><br />&lt;%@ Page OutputCache VaryByParams="none" Duration="60" %&gt; <br /><br />就可以高效地为此页生成一次输出，然后对它进行多次重用，时间最长为 60 秒，此时该<br />页将重新执行，输出也将再一次添加到 ASP.NET 缓存。通过使用一些低级程序化 API 也<br />可以完成此行为。对于输出缓存有几个可配置的设置，如刚刚讲到的 VaryByParams 属性<br />。VaryByParams 刚好被请求到，但还允许您指定 HTTP GET 或 HTTP POST 参数来更改缓<br />存项。例如，只需设置 VaryByParam="Report" 即可对 default.aspx?Report=1 或 <br />default.aspx?Report=2 进行输出缓存。通过指定一个以分号分隔的列表，还可以指定其<br />他参数。 <br /><br />很多人都不知道何时使用输出缓存，ASP.NET 页还会生成一些位于缓存<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>下游的 <br />HTTP 标头，如 Microsoft Internet Security and Acceleration Server 或 Akamai 使<br />用的标头。设置了 HTTP 缓存标头之后，可以在这些网络资源上对文档进行缓存，客户端<br />请求也可在不必返回原始<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的情况下得以满足。<br /><br />因此，使用页输出缓存不会使得您的应用程序效率更高，但是它可能会减少<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>上的负<br />载，因为下游缓存技术会缓存文档。当然，这可能只是匿名内容；一旦它成为下游之后，<br />您就再也不会看到这些请求，并且再也无法执行身份验证以阻止对它的访问了。<br /><br /><br />技巧 8 — 运行 IIS 6.0（只要用于内核缓存）<br /><br /><br />如果您未运行 IIS 6.0 (<a href="http://www.chinahtml.com/systems/2/" target="_blank">Windows</a> Server? 2003)，那么您就错过了 Microsoft Web 服务<br />器中的一些很好的性能增强。在技巧 7 中，我讨论了输出缓存。在 IIS 5.0 中，请求是<br />通过 IIS 然后进入 ASP.NET 的。涉及到缓存时，ASP.NET 中的 HttpModule 会接收该请<br />求，并返回缓存中的内容。<br /><br />如果您正在使用 IIS 6.0，就会发现一个很好的小功能，称为内核缓存，它不需要对 <br />ASP.NET 进行任何代码更改。当请求由 ASP.NET 进行输出缓存时，IIS 内核缓存会接收缓<br />存数据的一个副本。当请求来自网络驱动程序时，内核级别的驱动程序（无上下文切换到<br />用户模式）就会接收该请求，如果经过了缓存，则会将缓存的数据刷新到响应，然后完成<br />执行。这就表示，当您将内核模式缓存与 IIS 和 ASP.NET 输出缓存一起使用时，就会看<br />到令人不敢相信的性能结果。在 ASP.NET 的 Visual Studio 2005 开发过程中，我一度是<br />负责 ASP.NET 性能的程序经理。开发人员完成具体工作，但是我要看到每天进行的所有报<br />告。内核模式缓存结果总是最有意思的。最常见的特征是网络充满了请求/响应，而 IIS <br />运行时的 CPU 使用率只有大约 5%。这太令人震惊了！当然使用 IIS 6.0 还有一些其他原<br />因，但是内核模式缓存是其中最明显的一个。<br /><br /><br />技巧 9 — 使用 Gzip 压缩<br /><br /><br />虽然使用 gzip 并不一定是<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>性能技巧（因为您可能会看到 CPU 使用率的提高），但<br />是使用 gzip 压缩可以减少<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>发送的字节数量。这就使人们觉得页速度加快了，并且<br />还减少了带宽的用量。根据所发送数据、可以压缩的程度以及客户端浏览器是否支持（IIS<br />只会向支持 gzip 压缩的客户端发送经过 gzip 压缩的内容，如 Internet Explorer <br />6.0 和 Firefox），您的<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>每秒可以服务于更多的请求。实际上，几乎每当您减少所<br />返回数据的数量时，都会增加每秒请求数。 <br /><br />Gzip 压缩已经内置到 IIS 6.0 中，并且其性能比 IIS 5.0 中使用的 gzip 压缩要好的多<br />，这是好消息。但不幸的是，当尝试在 IIS 6.0 中打开 gzip 压缩时，您可能无法在 <br />IIS 的属性对话中找到该设置。IIS 小组在该<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>中置入了卓越的 gzip 功能，但是忘<br />了包括一个用于启用该功能的管理 UI。要启用 gzip 压缩，您必须深入到 IIS 6.0 的 <br />XML 配置设置内部（这样不会引起心脏虚弱）。顺便提一句，这归功于 OrcsWeb 的 <br />Scott Forsyth，他帮助我提出了在 OrcsWeb 上宿主的 www.asp.net <a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的这个问题。<br /><br /><br />本文就不讲述步骤了，请阅读 Brad Wilson 的文章，网址是 IIS6 Compression。还有一<br />篇有关为 ASPX 启用压缩的知识库文章，网址是 Enable ASPX Compression in IIS。但是<br />您应该注意，由于一些实施细节，IIS 6.0 中不能同时存在动态压缩和内核缓存。<br /><br /><br />技巧 10 — <a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件视图状态<br /><br /><br />视图状态是一个有趣的名称，用于表示在所生成页的隐藏输出字段中存储一些状态数据的 <br />ASP.NET。当该页张贴回<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>时，<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>可以分析、验证、并将此视图状态数据应用回该<br />页的控件树。视图状态是一个非常强大的功能，因为它允许状态与客户端一起保持，并且<br />它不需要 cookie 或<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>内存即可保存此状态。很多 ASP.NET <a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件都使用视图状<br />态来保持在与页元素进行交互期间创建的设置，例如保存对数据进行分页时显示的当前页<br />。 <br /><br />然而使用视图状态也有一些缺点。首先，服务或请求页时，它都会增加页的总负载。对张<br />贴回<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>的视图状态数据进行序列化或取消序列化时，也会发生额外的开销。最后，视<br />图状态会增加<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>上的内存分配。<br /><br />几个<a href="http://www.chinahtml.com/systems/" target="_blank">服务器</a>控件有着过度使用视图状态的趋势，即使在并不需要的情况下也要使用它，其<br />中最著名的是 DataGrid。ViewState 属性的默认行为是启用，但是如果您不需要，则可以<br />在控件或页级别关闭。在控件内，只需将 EnableViewState 属性设置为 false，或者在页<br />中使用下列设置即可对其进行全局设置： <br /><br />&lt;%@ Page EnableViewState="false" %&gt;<br /><br />如果您不回发页，或者总是针对每个请求重新生成页上的控件，则应该在页级别禁用视图<br />状态。 <br /><br /><br />我为您讲述了一些我认为在编写高性能 ASP.NET 应用程序时有所帮助的技巧。正如我在本<br />文前面部分提到的那样，这是一个初步指南，并不是 ASP.NET 性能的最后结果。（有关改<br />善 ASP.NET 应用程序性能的信息，请参阅 Improving ASP.NET Performance。）只有通过<br />自己的亲身体验才能找出解决具体性能问题的最好方法。但是，在您的旅程中，这些技巧<br />应该会为您提供一些好的指南。在软件开发中，几乎没有绝对的东西；每个应用程序都是<br />唯一的。<br /><br />from: <a href="http://www.chinahtml.com/programming/8/2006/11622676777784_2.shtml">http://www.chinahtml.com/programming/8/2006/11622676777784_2.shtml</a><br /></p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/85980.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-06 23:57 <a href="http://www.blogjava.net/weidagang2046/articles/85980.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用Ajax读取XML格式的数据</title><link>http://www.blogjava.net/weidagang2046/articles/85978.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 06 Dec 2006 15:52:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/85978.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/85978.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/85978.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/85978.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/85978.html</trackback:ping><description><![CDATA[用Ajax读取XML格式的数据，只需要读取XMLHttpRequest对象返回的responseXML属性即可。代码如下：<br /><p>　　1、Client - helloworld.htm<br /></p><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: rgb(0,0,255)">&lt;!</span><span style="COLOR: rgb(255,0,255)">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">html</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">head</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">title</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)">Ajax Hello World</span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">title</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">script </span><span style="COLOR: rgb(255,0,0)">type</span><span style="COLOR: rgb(0,0,255)">="text/javascript"</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"><br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> xmlHttp;<br /><br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> createXMLHttpRequest(){<br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(window.ActiveXObject){<br />xmlHttp </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">new</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> ActiveXObject(</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">Microsoft.XMLHTTP</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />}<br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">else</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(window.XMLHttpRequest){<br />xmlHttp </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">new</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> XMLHttpRequest();<br />}<br />}<br /><br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> startRequest(){<br />createXMLHttpRequest();<br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">try</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">{<br />xmlHttp.onreadystatechange </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> handleStateChange;<br />xmlHttp.open(</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">GET</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">, </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">data.xml</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">, </span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">true</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />xmlHttp.send(</span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">null</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">); <br />}</span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">catch</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(exception){<br />alert(</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">您要访问的资源不存在!</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">);<br />}<br />}<br /><br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">function</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> handleStateChange(){ <br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(xmlHttp.readyState </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">4</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){ <br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">if</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> (xmlHttp.status </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">200</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">||</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> xmlHttp.status </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">==</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">){<br /></span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> 取得XML的DOM对象</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"><br /></span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> xmlDOM </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> xmlHttp.responseXML;<br /></span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> 取得XML文档的根</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"><br /></span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> root </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> xmlDOM.documentElement; <br /></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">try</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"><br />{<br /></span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> 取得&lt;info&gt;结果</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"><br /></span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"></span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">var</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> info </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">=</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> root.getElementsByTagName('info');<br /></span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)">//</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"> 显示返回结果</span><span style="COLOR: rgb(0,128,0); BACKGROUND-COLOR: rgb(245,245,245)"><br /></span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">alert(</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">responseXML's value: </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">"</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> </span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">+</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)"> info[</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">0</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">].firstChild.data);<br />}</span><span style="COLOR: rgb(0,0,255); BACKGROUND-COLOR: rgb(245,245,245)">catch</span><span style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(245,245,245)">(exception)<br />{<br /><br />}<br />}<br />}<br />}<br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">script</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">head</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">body</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">div</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">input </span><span style="COLOR: rgb(255,0,0)">type</span><span style="COLOR: rgb(0,0,255)">="button"</span><span style="COLOR: rgb(255,0,0)"> value</span><span style="COLOR: rgb(0,0,255)">="return ajax responseXML's value"</span><span style="COLOR: rgb(255,0,0)"><br />onclick</span><span style="COLOR: rgb(0,0,255)">="startRequest();"</span><span style="COLOR: rgb(255,0,0)"> </span><span style="COLOR: rgb(0,0,255)">/&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">div</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">body</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">html</span><span style="COLOR: rgb(0,0,255)">&gt;</span></div><br />2、Server - data.xml<br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: rgb(0,0,255)">&lt;?</span><span style="COLOR: rgb(255,0,255)">xml version="1.0" encoding="GB2312" </span><span style="COLOR: rgb(0,0,255)">?&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">root</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;</span><span style="COLOR: rgb(128,0,0)">info</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)">hello world!</span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">info</span><span style="COLOR: rgb(0,0,255)">&gt;</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,0,255)">&lt;/</span><span style="COLOR: rgb(128,0,0)">root</span><span style="COLOR: rgb(0,0,255)">&gt;</span></div><br />from: <a href="http://www.chinahtml.com/programming/8/2006/11624391147871.shtml">http://www.chinahtml.com/programming/8/2006/11624391147871.shtml</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/85978.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-06 23:52 <a href="http://www.blogjava.net/weidagang2046/articles/85978.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Javascript Closures</title><link>http://www.blogjava.net/weidagang2046/articles/85721.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 05 Dec 2006 15:54:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/85721.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/85721.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/85721.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/85721.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/85721.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Javascript Closures														Introduction														The Resolution of Property Names on Objects																								Assignment of Values																										Re...&nbsp;&nbsp;<a href='http://www.blogjava.net/weidagang2046/articles/85721.html'>阅读全文</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/85721.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-05 23:54 <a href="http://www.blogjava.net/weidagang2046/articles/85721.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>URL中文参数传递问题</title><link>http://www.blogjava.net/weidagang2046/articles/84943.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Fri, 01 Dec 2006 12:43:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84943.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84943.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84943.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84943.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84943.html</trackback:ping><description><![CDATA[
		<p>(1)确定JSP页面头部是否有:&lt;%@ page contentType="text/html; charset=GBK" %&gt;<br />(2)用这个转码:<br />     String param= new String(request.getParameter("param").getBytes("ISO-8859-1"), "GBK");<br />(3)添加filter字符过滤器</p>
		<p>(4)如果是通过"a.jsp?param=中文"传递参数,则需要:<br />     a.在传参数之前先把参数进行转码:java.net.URLEncoder.encode(param);<br />       取值用java.net.URLDncoder.decode(param);再转回中文<br />     b.在你的Tomcat目录--&gt;conf目录--&gt;server.xml里找出这段:<br />       &lt;Connector <br />         port="8080"               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<br />               enableLookups="false" redirectPort="8443" acceptCount="100"<br />               debug="0" connectionTimeout="20000" <br />               disableUploadTimeout="true" &lt;!--在里边加上这个参数--&gt;URIEncoding="gb2312"/&gt; <br /><br />from: <a href="http://www.yuanma.org/data/2006/0911/article_1503.htm">http://www.yuanma.org/data/2006/0911/article_1503.htm</a></p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/84943.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-01 20:43 <a href="http://www.blogjava.net/weidagang2046/articles/84943.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>url传递中文的解决方案总结 </title><link>http://www.blogjava.net/weidagang2046/articles/84941.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Fri, 01 Dec 2006 12:40:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84941.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84941.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84941.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84941.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84941.html</trackback:ping><description><![CDATA[1.设置web.config文件。<br />&lt;system.web&gt; <br />...... <br />&lt;globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" /&gt; <br />...... <br />&lt;/system.web&gt; <br /><br />或者：<br />aspx文件中:<br />&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312"&gt;<br /><br />2.传递中文之前，将要传递的中文参数进行编码，在接收时再进行解码。 <br />&gt;&gt; 进行传递 <br />string Name = "中文参数"; <br />Response.Redirect("B.aspx?Name="+Server.UrlEncode(Name)); <br /><br />&gt;&gt; 进行接收 <br />string Name = Request.QueryString["Name"]; <br />Response.Write(Server.UrlDecode(Name)); <br />或者：<br /><br />NavigateURL='&lt;%# "WebForm2.aspx?Singer=" + HttpUtility.UrlEncode("中国人", System.Text.Encoding.GetEncoding("GB2312")) %&gt;'<br /><br /><br />3.如果是从 .HTML 文件向 .Aspx 文件进行传递中文参数的话（即不从后台用 Redirect()方法进行 Url 转换）。一样要将传递的中文参数进行编码，在接收时再进行解码。 <br />&gt;&gt; 进行传递 <br />&lt;script language="JavaScript"&gt; <br />function GoUrl() <br />{ <br />var Name = "中文参数"; <br />location.href = "B.aspx?Name="+escape(Name); <br />} <br />&lt;/script&gt; <br />&lt;body onclick="GoUrl()"&gt; <br />&gt;&gt; 进行接收 <br />string Name = Request.QueryString["Name"]; <br />Response.Write(Server.UrlDecode(Name)); <br /><br />一般来说。设置web.config文件就可以了。但是如果你用 JavaScript 调用 webservice 方法的话（往webservice里面传递中文参数）。设置 web.config 文件好象无效。 <br /><br />————————————————————<br />在html中实现编解码：<br /><br />&lt;script language="javascript"&gt;<br />function openUrl(src)<br />{<br />var strUrl=escape(src);<br />window.open(strUrl);<br />}<br /><br /><br />function change_url(src)<br />{<br />document.location.href=escape(src);<br />}<br /><br />&lt;/script&gt; <br /><br />在新窗口保存<br />&lt;a href='javascript:openUrl("css/20040603123628交易中心烟叶网上集中交易系统合同.doc");' &gt;20040603123628交易中心网上集中交易系统合同&lt;/a&gt;<br /><br /><br />当前位置保存，无闪烁。<br />&lt;a href="#" onclick=javascript:change_url("css/20040603123628交易中心烟叶网上集中交易系统合同.doc")&gt;20040603123628交易中心网上集中交易系统合同&lt;/a&gt;<br /><br />注意：路径中的斜线是：“/”，而不是“\”，否则也不行啊。<br /><br /><br /><br /><br />－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br />前一阵遇到在做.net Web开发时，碰到一个很奇怪的问题，就是Url中，如果将中文字符作为参数值传递时，QueryString得到的值可能会出错。简单的说，比如下面这个Url：<br />UrlParmTest.aspx?parm1=中国&amp;parm2=中国人<br />在Request.QueryString时，parm1和parm2得到都是"中国"，显然出现了问题，可是在某些情况下却是正常的。<br /><br />如果请求不是直接通过URL，而使用Response.Redirect在服务器端操作，没有遇到过类似的问题。<br /><br />当时我想中文是双字节编码，可能传递的时候就是有不确定性，还是用英文好。<br /><br />可是为什么在Server端Redirect就是正常的，问题在哪里呢？<br /><br />：<br />如果在.cs文件中设置中文参数，请在中文参数外使用Server.UrlEncode("中文")对中文进行Encode<br />如果在.aspx文件中设置，请使用&lt;%=Server.UrlEncode("中文")%&gt;进行Encode<br />在QueryString时，不用再进行Decode，可以获得正常的中文字符串<br /><br />下面是给出的一些解释：<br />UrlEncode把一些多字节字符转换成url里允许的单字节字符，本来浏览器就会自动做的，但是目前确实存在一些问题，所以自己再Encode一下，在接受端会自动对Url进行Decode。<br /><br />我想Response.Redirect可能可以确保作Encode的工作，所以没有问题。<br /><br />from: <a href="http://blog.iecn.net/article/html/tid-870.html">http://blog.iecn.net/article/html/tid-870.html</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/84941.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-01 20:40 <a href="http://www.blogjava.net/weidagang2046/articles/84941.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决Tomcat 5.0.19中文参数传递问题</title><link>http://www.blogjava.net/weidagang2046/articles/84939.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Fri, 01 Dec 2006 12:38:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84939.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84939.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84939.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84939.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84939.html</trackback:ping><description><![CDATA[
		<span class="javascript" id="text44042">實際運用 Tomcat 5.0.19，我們了解在不修改 Tomcat 原始碼的狀況下，使用者透過 Form submit 的資料將一律以 ISO8859-1 處理，程式設計師必須自行將字串將轉換為 Big5(繁體中文) or GB2312/GBK(簡體中文)，我們在應用程式中，對所有的 request.getParameter("xx"); 作了 toBig5String() 的處理，理論上，所有的中文問題應該不會出現才對，結果，還是發現某些狀況下，中文還是變成亂碼！ <br /><br />經過分析整理，我們發現問題出在 QueryString 的解析，以前在 Tomcat 4.x 時代，無論 SUBMIT 時採用 GET or POST，Tomcat server 對 parameters 的處理都採用相同的編碼，但在 Tomcat 5.x 版，不知何故，卻將 QueryString 的解析獨立出來，目前確認，Form 的 Method 採用 GET 及直接將參數寫在 URL 上的中文，上傳到 Tomcat 時，無論如何轉碼，都會變成亂碼，那怕你事先作過 URLEncode 也一樣。 <br /><br />網站上，有人針對這個問題，建議將所有中文改採用 base64 編碼，到了 server 上，程式將自行土 base64 decode 回來，確保中文不會發生問題。這樣作法當然可以解決這個問題，但是所有網頁變成限定要採用 POST，且程式設計師要隨時分清楚，那個參數是採用 GET 上傳，那個參數是採用 POST 上傳，然後再針對不同的方式採用不同的解析，這樣的程式一點兒移植性都沒有，更別提跨平台、跨國際語言了。 <br /><br />研究 Tomcat 的文件及原始碼，我們找到了問題所在及解決的方法，只有按著以下的作法，才能使 Form submit 的資料完全按著 ISO8859-1 的編碼，當然，若是全照著 Tomcat 的文件說明去作，肯定還是不行，你還是得加上這個參數到 server.xml 中才行。 <br /><br />解決方案 <br /><br />請先研究 $TOMCAT_HOME/webapps/tomcat-docs/config/http.html 這個說明檔，擷錄重點如下： <br /><b>URIEncoding</b>：This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used. <br /><br /><b>useBodyEncodingForURI</b>：This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding. This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitely set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is false. <br /><br />上述二個 Tomcat 參數，是設定在 server.xml 中的 http &lt;Connector /&gt; 區塊，要解決 QueryString 中文變成亂碼的問題，你必須至少設定這二個參數其中之一。 <br />URIEncoding 請設定為 URIEncoding="ISO-8859-1" 指定為 "ISO-8859-1" 編碼，讓 QueryString 的字元編碼與 post body 相同。 <br />useBodyEncodingForURI 這是用來相容 Tomcat 4.x 版的，設定的值是 "true" or "false"，意思是指 "要不要讓 QueryString 與 POST BODY 採用相同的字元編碼 ?"，若是設成 true，那也可達到 "ISO-8859-1" 編碼的需求。 <br />建議，採用 URIEncoding 的設定，畢竟 useBodyEncodingForURI 的作法是為了相容 Tomcat 4.X。不過若照原文的說明，理論上這二個參數都不設，Tomcat 也該採用 "ISO-8859-1" 的編碼，那為什麼還是會有問題呢 ? 我們由 Tomcat Source Code 來看就清楚了。 <br /><table class="java" cellspacing="1" cellpadding="3" bgcolor="#999999" border="0"><tbody><tr><td valign="top" align="left" width="1" bgcolor="#dddddd"><pre><font color="#555555">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></font></pre></td><td valign="top" align="left" bgcolor="#ffffff"><pre><font class="java-comment">// 這一段碼是 Tomcat 用來解 QueryString 的程式，</font><font class="java-comment">// 在 org.apache.tomcat.util.http.Parameters 這個 class 裡。</font><font class="java-reserved_word"><b>private</b></font> String urlDecode(ByteChunk bc, String enc)
  <font class="java-reserved_word"><b>throws</b></font> IOException <font class="java-bracket">{</font><font class="java-reserved_word"><b>if</b></font>( urlDec==<font class="java-reserved_word"><b>null</b></font> ) <font class="java-bracket">{</font>
     urlDec=<font class="java-reserved_word"><b>new</b></font> UDecoder(); 
  <font class="java-bracket">}</font>
  urlDec.convert(bc);
  String result = <font class="java-reserved_word"><b>null</b></font>;
  <font class="java-reserved_word"><b>if</b></font> (enc != <font class="java-reserved_word"><b>null</b></font>) <font class="java-bracket">{</font>
    bc.setEncoding(enc);
    result = bc.toString();
  <font class="java-bracket">}</font><font class="java-reserved_word"><b>else</b></font><font class="java-bracket">{</font>
    CharChunk cc = tmpNameC;
    cc.allocate(bc.getLength(), -1);
    <font class="java-comment">// Default encoding: fast conversion</font><font class="java-reserved_word"><b>byte</b></font>[] bbuf = bc.getBuffer();
    <font class="java-reserved_word"><b>char</b></font>[] cbuf = cc.getBuffer();
    <font class="java-reserved_word"><b>int</b></font> start = bc.getStart();
    <font class="java-reserved_word"><b>for</b></font> (<font class="java-reserved_word"><b>int</b></font> i = 0; i &lt; bc.getLength(); i++) <font class="java-bracket">{</font>
      cbuf[i] = (<font class="java-reserved_word"><b>char</b></font>) (bbuf[i + start] &amp; 0xff);
    <font class="java-bracket">}</font>
    cc.setChars(cbuf, 0, bc.getLength());
    result = cc.toString();
    cc.recycle();
  <font class="java-bracket">}</font><font class="java-reserved_word"><b>return</b></font> result;
<font class="java-bracket">}</font></pre></td></tr></tbody></table><br />請特別注意紅色區塊，當 Tomcat 發現 QueryString 並沒有設定 encode 時，並非像文件中所說預設採用 ISO-8859-1 的編碼，而是用一段 fast conversion 來處理，才會造成中文問題，所以，還是必須在 Server.xml 中，加上 URLEncoding 的參數設定才行哦。 <br /><br />Connector 的設定範例： <br /><table class="java" cellspacing="1" cellpadding="3" bgcolor="#999999" border="0"><tbody><tr><td valign="top" align="left" width="1" bgcolor="#dddddd"><pre><font color="#555555">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></font></pre></td><td valign="top" align="left" bgcolor="#ffffff"><pre>&lt;Connector
debug=<font class="java-string">"0"</font>
acceptCount=<font class="java-string">"100"</font>
connectionTimeout=<font class="java-string">"20000"</font>
disableUploadTimeout=<font class="java-string">"true"</font>
port=<font class="java-string">"80"</font>
redirectPort=<font class="java-string">"8443"</font>
enableLookups=<font class="java-string">"false"</font>
minSpareThreads=<font class="java-string">"25"</font>
maxSpareThreads=<font class="java-string">"75"</font>
maxThreads=<font class="java-string">"150"</font>
maxPostSize=<font class="java-string">"0"</font>
URIEncoding=<font class="java-string">"ISO-8859-1"</font>
&gt;
&lt;/Connector&gt;
</pre></td></tr></tbody></table></span>
		<br />from: <a href="http://www.javaworld.com.tw/jute/post/view?bid=9&amp;id=44042&amp;sty=1&amp;tpg=1&amp;age=0">http://www.javaworld.com.tw/jute/post/view?bid=9&amp;id=44042&amp;sty=1&amp;tpg=1&amp;age=0</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/84939.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-01 20:38 <a href="http://www.blogjava.net/weidagang2046/articles/84939.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用XMLHTTP Post/Get HTML页面时的中文乱码问题之完全Script解决方案</title><link>http://www.blogjava.net/weidagang2046/articles/84938.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Fri, 01 Dec 2006 12:35:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84938.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84938.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84938.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84938.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84938.html</trackback:ping><description><![CDATA[
		<font face="Verdana"> </font>
		<p>用XMLHTTP Post/Get HTML页面时的中文乱码问题之完全Script解决方案</p>
		<p>关键词：VBScript, ASP, JavaScript, Java, XML</p>
		<p>以前我曾经贴过一篇用XMLHTTP Post Form 的帖子，那里的代码中我Post E文的Value毫无问题，但是后来发现Post含有中文的表单时会出现乱码，原因当然是UTF-8 和GB2312 之间的转换问题了！TNND，打倒GB2312！大家都用UTF8多好。</p>
		<p>用XMLHTTP Post Form时的表单乱码有两方面的原因??Post表单数据时中文乱码；服务器Response被XMLHTTP不正确编码引起的乱码。换句话说，本文主要解决两个问题??怎样正确Post中文内容&amp;怎样正确显示得到的中文内容。</p>
		<p>Part I Post中文内容</p>
		<p>先看看E文的表单是怎么提交的：//from www.<a href="http://www.w3sky.com/">w3sky</a>.com</p>
		<p>&lt;SCRIPT language="JavaScript"&gt;<br />strA = "submit1=Submit&amp;text1=scsdfsd";<br />var oReq = new ActiveXObject("MSXML2.XMLHTTP");<br />oReq.open("POST","http://ServerName/VDir/TstResult.asp",false);<br />oReq.setRequestHeader("Content-Length",strA.length);  <br />oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");<br />oReq.send(strA);<br />&lt;/ScRIPT&gt;</p>
		<p>如果把strA = "submit1=Submit&amp;text1=scsdfsd";换成：<br />strA = "submit1=Submit&amp;text1=中文";</p>
		<p>你会发现提交上去的东东根本不对，ASP中Request.Form("Text1"）根本取不到值。俺用Request.BinaryRead把一个HTML Form中的Post内容写出来看了看，才发现问题??Form提交时也要编码的，编码后的中文是类似于%??%??的转义字符，比如“中文”就被编码为：%D6%D0%CE%C4。呵呵，也怪俺笨，人家CONTENT-TYPE里明明写的清清楚楚??application/x-www-form-urlencoded，urlencoded嘛当然就是这个样子了。既然这样,那我们也知道该怎么办了??自己做转换，代码见下：</p>
		<p>&lt;SCRIPT language="VBScript"&gt;<br />Function URLEncoding(vstrIn)<br />    strReturn = ""<br />    For i = 1 To Len(vstrIn)<br />        ThisChr = Mid(vStrIn,i,1)<br />        If Abs(Asc(ThisChr)) &lt; &amp;HFF Then<br />            strReturn = strReturn &amp; ThisChr<br />        Else<br />            innerCode = Asc(ThisChr)<br />            If innerCode &lt; 0 Then<br />                innerCode = innerCode + &amp;H10000<br />            End If<br />            Hight8 = (innerCode  And &amp;HFF00) &amp;HFF<br />            Low8 = innerCode And &amp;HFF<br />            strReturn = strReturn &amp; "%" &amp; Hex(Hight8) &amp;  "%" &amp; Hex(Low8)<br />        End If<br />    Next<br />    URLEncoding = strReturn<br />End Function</p>
		<p>strA = URLEncoding("submit1=Submit&amp;text1=中文")<br />oReq = CreateObject("MSXML2.XMLHTTP")<br />oReq.open "POST","http://ServerName/VDir/TstResult.asp",false<br />oReq.setRequestHeader "Content-Length",Len(strA)<br />oReq.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"<br />oReq.send strA<br />&lt;/ScRIPT&gt;</p>
		<p>（在这里俺把前面的JavaScript的代码改成了VBScript，不是吃饱了撑的没事干，原因见后）</p>
		<p>Part II.正确显示得到的中文内容</p>
		<p>OK，如果你在Server端把Form的内容写到数据库/文件的话，你在那里看到的中文毫无问题，但是，假如你想看看Server的Response??问题来了：如果Response的结果不是XML，XMLHTTP.responseXML里当然是不会有东东的，那就用responseText好了，在代码的最后加一句：</p>
		<p>alert(oReq.responseText)<br />看看俺们辛勤劳动的结果  :P</p>
		<p>但是但是.....怎么所有的中文全变成了方格? （我打不出来，有兴趣自己去试，也不用Post，Get一个含有中文的网页就可以发现了。）</p>
		<p>原因很简单：XMLHTTP得到Response时假定Response是UTF8编码的，如果Response是XML，那还可以通过encoding来指定编码，但HTML就不行了。（见鬼的GB2312，再次打倒！）所以它把含GB2312编码的HTML当成UTF8格式，不出错才有鬼！</p>
		<p>不过好在还有补救的办法：XMLHTTP的responseBody 属性里包含的可是未解码的Resonse??"a raw undecoded bytes as received directly from the server" ：），唯一的问题是，responseBody返回的是一个unsigned bytes数组，我们怎么去访问它，怎么把它转换成BSTR？</p>
		<p>这就是为什么我在上面把代码改成VBScript的原因??VBScript Can do it,but JavaScript Cannot!</p>
		<p>代码见下：<br />&lt;SCRIPT language="VBScript"&gt;<br />Function URLEncoding(vstrIn)<br />    strReturn = ""<br />    For i = 1 To Len(vstrIn)<br />        ThisChr = Mid(vStrIn,i,1)<br />        If Abs(Asc(ThisChr)) &lt; &amp;HFF Then<br />            strReturn = strReturn &amp; ThisChr<br />        Else<br />            innerCode = Asc(ThisChr)<br />            If innerCode &lt; 0 Then<br />                innerCode = innerCode + &amp;H10000<br />            End If<br />            Hight8 = (innerCode  And &amp;HFF00) &amp;HFF<br />            Low8 = innerCode And &amp;HFF<br />            strReturn = strReturn &amp; "%" &amp; Hex(Hight8) &amp;  "%" &amp; Hex(Low8)<br />        End If<br />    Next<br />    URLEncoding = strReturn<br />End Function</p>
		<p>Function bytes2BSTR(vIn)<br />    strReturn = ""<br />    For i = 1 To LenB(vIn)<br />        ThisCharCode = AscB(MidB(vIn,i,1))<br />        If ThisCharCode &lt; &amp;H80 Then<br />            strReturn = strReturn &amp; Chr(ThisCharCode)<br />        Else<br />            NextCharCode = AscB(MidB(vIn,i+1,1))<br />            strReturn = strReturn &amp; Chr(CLng(ThisCharCode) * &amp;H100 + CInt(NextCharCode))<br />            i = i + 1<br />        End If<br />    Next<br />    bytes2BSTR = strReturn<br />End Function</p>
		<p>strA = URLEncoding("submit1=Submit&amp;text1=中文")<br />oReq = CreateObject("MSXML2.XMLHTTP")<br />oReq.open "POST","http://ServerName/VDir/TstResult.asp",false<br />oReq.setRequestHeader "Content-Length",Len(strA)<br />oReq.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"<br />oReq.send strA<br />alert bytes2BSTR(oReq.responseBody)<br />&lt;/ScRIPT&gt;</p>
		<p>嘿嘿，是不是很简单啊，用这个再试试看？一切OK！</p>
		<p>（顺便说说byte()，这个东东在VBScript里的表现只能用妖来形容??对它调用VarType 返回8209??vbArray + vbByte,用LBound、UBound能拿到数组的上界下界，但是就是不能用name(i)的形式访问，搞得我以为在Script里根本没法处理这种类型，在bytes2BSTR函数里可以看到我是把它当成String来处理的??LenB/MidB什么的，发现这点纯属意外??我开始往这个函数里传的是XMLHTTP.responseText，想一个Byte一个Byte地看看里面到底有点什么，后来一时性起把responseText改成responseBody，结果就中奖了，哈哈）</p>
		<p>最后的废话：//from www.<a href="http://www.w3sky.com/">w3sky</a>.com<br />1、以上代码在MSXML Parser 3 Release＋VBScript 5.5环境下通过。那位兄弟有早一点版本的Script可以帮我试试看能不能成。<br />2、一直以为JavaScript vs VBScript应该是JavaScript略好，所以有时候想彻底抛弃VBScript，ASP Server/Client统统用JavaScript，看来未必是个好主意。<br /><br />from: <a href="http://www.w3sky.com/2/2402.html">http://www.w3sky.com/2/2402.html</a></p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/84938.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-12-01 20:35 <a href="http://www.blogjava.net/weidagang2046/articles/84938.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TEXTAREA自适应文字行数并隐藏滚动条</title><link>http://www.blogjava.net/weidagang2046/articles/84341.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 29 Nov 2006 06:12:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84341.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84341.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84341.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84341.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84341.html</trackback:ping><description><![CDATA[&lt;textarea name="textarea" cols="70" style="overflow-y:visible"&gt; &lt;/textarea&gt;<br /><br />textarea_notes.style.overflow = "hidden";<br /><br />from: <a href="http://club.xiashanet.com/keywords/view-20502.html">http://club.xiashanet.com/keywords/view-20502.html</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/84341.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-29 14:12 <a href="http://www.blogjava.net/weidagang2046/articles/84341.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>限制TextArea区的文字输入数量</title><link>http://www.blogjava.net/weidagang2046/articles/84335.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 29 Nov 2006 05:41:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/84335.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/84335.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/84335.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/84335.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/84335.html</trackback:ping><description><![CDATA[一般情况下TextArea区输入的文字数量是没有限制的，在这里你可以限制输入的文字数量同时显示尚能继续输入的字符数。 <br />  <br />如下javascript代码加入html的&lt;head&gt;...&lt;/head&gt;之间： <br /><br />&lt;SCRIPT LANGUAGE="JavaScript"&gt; <br />&lt;!--// <br />function textCounter(field, countfield, maxlimit) { <br />// 定义函数，传入3个参数，分别为表单区的名字，表单域元素名，字符限制； <br />if (field.value.length &gt; maxlimit) <br />//如果元素区字符数大于最大字符数，按照最大字符数截断； <br />field.value = field.value.substring(0, maxlimit); <br />else <br />//在记数区文本框内显示剩余的字符数； <br />countfield.value = maxlimit - field.value.length; <br />} <br />//--&gt; <br />&lt;/SCRIPT&gt; <br /><br />如下是表单区，在HTML的&lt;body&gt;...&lt;/body&gt;之间：action指向任意指定的处理程序。 <br /><br />&lt;form name=myform action=""&gt; <br />&lt;textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"&gt; <br />&lt;/textarea&gt; <br />&lt;br&gt; <br />尚能输入 <br />&lt;input readonly type=text name=remLen size=4 maxlength=3 value="125"&gt; <br />个字符&lt;/div&gt; <br />&lt;/form&gt;<img height="1" src="http://www.moon-soft.com/doc/down_info.asp?id=45041" width="1" border="0" /><br /><br />from: <a href="http://www.moon-soft.com/doc/45041.htm">http://www.moon-soft.com/doc/45041.htm</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/84335.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-29 13:41 <a href="http://www.blogjava.net/weidagang2046/articles/84335.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>web应用的跨域访问解决方案 </title><link>http://www.blogjava.net/weidagang2046/articles/82619.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 21 Nov 2006 14:12:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82619.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82619.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82619.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82619.html</trackback:ping><description><![CDATA[
		<p>做过跨越多个网站的Ajax开发的朋友都知道，如果在A网站中，我们希望使用Ajax来获得B网站中的特定内容，如果A网站与B网站不在同一个域中，那么就出现了跨域访问问题。Ajax的跨域访问问题是现有的Ajax开发人员比较常遇到的问题。</p>
		<p>IE对于跨域访问的处理是，弹出警告框，提醒用户。如果用户将该网站纳入可信任网站，或者调低安全级别，那么这个问题IE就不会在提醒你。</p>
		<p>FireFox等其它非微软的浏览器遇到跨域访问，则解决方案统一是拒绝访问。</p>
		<p>有人说，IE是主流浏览器，只要它能正常使用就好了。此言差已，IE虽然能够处理，但是是有前提的，要么用户不厌其烦地在页面弹出警告框之后点击是（点击否就不执行该Ajax调用了），要么用户将该网站纳入可信任站点。这两种做法，在企业管理系统的应用中倒是比较常见，因为系统管理员可以以行政手段保证用户的行为。但是对于互联网上的网站或者门户开发，这种做法则不行。</p>
		<p>最近遇到了这个问题，需要在跨域访问结束之后完成使主窗口出现一些特效，搜索了一些资料，通过不断尝试以及在不同浏览器中进行兼容性测试，找到了几个可行的方案：</p>
		<p>1、Web代理的方式。即用户访问A网站时所产生的对B网站的跨域访问请求均提交到A网站的指定页面，由该页面代替用户页面完成交互，从而返回合适的结果。此方案可以解决现阶段所能够想到的多数跨域访问问题，但要求A网站提供Web代理的支持，因此A网站与B网站之间必须是紧密协作的，且每次交互过程，A网站的服务器负担增加，且无法代用户保存session状态。</p>
		<p>2、on-Demand方式。MYMSN的门户就用的这种方式，不过MYMSN中不涉及跨域访问问题。动态控制script标记的生成，通过修改script标记的src属性完成对跨域页面的调用。此方案存在的缺陷是，script的src属性完成该调用时采取的方式时get方式，如果请求时传递的字符串过大时，可能会无法正常运行。不过此方案非常适合聚合类门户使用。</p>
		<p>3、iframe方式。查看过醒来在javaeye上的一篇关于跨域访问的帖子，他提到自己已经用iframe的方式解决了跨域访问问题。数据提交跟获取，采用iframe这种方式的确可以了，但由于父窗口与子窗口之间不能交互（跨域访问的情况下，这种交互被拒绝），因此无法完成对父窗口效果的影响。</p>
		<p>4、用户本地转储方式：IE本身依附于windows平台的特性为我们提供了一种基于iframe，利用内存来“绕行”的方案，即两个window之间可以在客户端通过windows剪贴板的方式进行数据传输，只需要在接受数据的一方设置Interval进行轮询，获得结果后清除Interval即可。FF的平台独立性决定了它不支持剪贴板这种方式，而以往版本的FF中存在的插件漏洞又被fixed了，所以FF无法通过内存来完成暗渡陈仓。而由于文件操作FF也没有提供支持（无法通过Cookie跨域完成数据传递），致使这种技巧性的方式只能在IE中使用。</p>
		<p>5、我自己用于解决这类问题的方式：结合了前面几种方式，在访问A网站时，先请求B网站完成数据处理，再根据返回的标识来获得所需的结果。这种方法的缺点也很明显，B网站的负载增大了。优点，对session也实现了保持，同时A网站与B网站页面间的交互能力增强了。最重要的一点，这种方案满足了我的全部需要。</p>
		<p>总结一下，以上方案中可选择的情况下，我最推荐on-Demand方式，在不需要提交大量数据的情况下，这种方式能够解决您的大部分问题。<br /><br />from: <a href="http://blog.csdn.net/macroway/archive/2006/05/14/728090.aspx">http://blog.csdn.net/macroway/archive/2006/05/14/728090.aspx</a></p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/82619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-21 22:12 <a href="http://www.blogjava.net/weidagang2046/articles/82619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用script方式解决iframe中不能跨域访问的问题</title><link>http://www.blogjava.net/weidagang2046/articles/82613.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 21 Nov 2006 13:41:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82613.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82613.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82613.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82613.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82613.html</trackback:ping><description><![CDATA[标题的措词拼凑了半天，现在看来还是不太通顺。其实就是这么一个问题，在网页中iframe的页面如果和主页面的域名不一致的话，那么是不能互相访问和控制的，而在实际应用中很可能就需要实现跨域访问的功能，那么我们就可以用script的方式来实现。<br /><br />在我们的一个项目中有这样的“在线注册”应用：各个客户的网站有一个在线注册页面（siteA.com/send.asp，我们称之为A），这个页面要求用户填写自己的序列号，然后提交给我们公司一个统一的注册地址（siteB.com/makepsw.asp，称之为B），在这个统一页面(B)计算注册码，然后发回给客户的注册页面，客户取得注册码以后，在先前的注册页面(A)中再提交给自己的系统而完成注册过程。<br /><br />这是A页面的基本代码：<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #ff0000"> action</span><span style="COLOR: #0000ff">=""</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">请输入软件序列号：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="sn"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="ipt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="sn"</span><span style="COLOR: #ff0000"> size</span><span style="COLOR: #0000ff">="26"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">请输入注册密码：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="ipt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000"> size</span><span style="COLOR: #0000ff">="50"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="getpsw"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="button"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="bt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="getpsw"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="width:90px"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="获取注册密码"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="reg"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="button"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="bt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="reg"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="注 册"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />注：这儿就是要实现当用户点击“获取注册密码”按钮以后，注册密码获取以后会自动填写到相应的输入表单中。</span></div>一开始想到了用iframe来实现，当B页面获取以后，用如<strong>parent.document.form1.password.value=?</strong>这样的代码来实现自动填写，在本机上测试都正常了，可是传到网上就出了错：
<div class="UBBContent"><span style="COLOR: red">Error: 拒绝访问。<br /><br /><font color="#000000">最后还是放弃iframe方式，改用script方式，效果非常好，基本上实现了我开始设想的功能。因为script正好是允许跨域调用的，可以举出最近的例子：一个就是</font><a href="http://www.pjhome.net/" target="_blank">PJBlog</a><font color="#000000">的后台首页一段提醒用户该升级的代码，另一个就是</font><a href="http://www.google.com/" target="_blank">Google</a><font color="#000000">的</font><a href="https://www.google.com/adsense/" target="_blank">ADSense</a><font color="#000000">代码。</font><br /><br /></span><span style="COLOR: red"><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="text/html; charset=gb2312"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">系统在线注册</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_158_700_Open_Image" onclick="this.style.display='none'; Codehighlighter1_158_700_Open_Text.style.display='none'; Codehighlighter1_158_700_Closed_Image.style.display='inline'; Codehighlighter1_158_700_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_158_700_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_158_700_Closed_Text.style.display='none'; Codehighlighter1_158_700_Open_Image.style.display='inline'; Codehighlighter1_158_700_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">script </span><span style="COLOR: #ff0000">language</span><span style="COLOR: #0000ff">="JavaScript"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text/JavaScript"</span><span style="COLOR: #0000ff">&gt;</span><span id="Codehighlighter1_158_700_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_158_700_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img id="Codehighlighter1_184_531_Open_Image" onclick="this.style.display='none'; Codehighlighter1_184_531_Open_Text.style.display='none'; Codehighlighter1_184_531_Closed_Image.style.display='inline'; Codehighlighter1_184_531_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_184_531_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_184_531_Closed_Text.style.display='none'; Codehighlighter1_184_531_Open_Image.style.display='inline'; Codehighlighter1_184_531_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> getpsw_onclick()</span><span id="Codehighlighter1_184_531_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_184_531_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">var</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> url;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">var</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> o</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">document.getElementById(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">js_getpsw</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br /><img id="Codehighlighter1_262_529_Open_Image" onclick="this.style.display='none'; Codehighlighter1_262_529_Open_Text.style.display='none'; Codehighlighter1_262_529_Closed_Image.style.display='inline'; Codehighlighter1_262_529_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_262_529_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_262_529_Closed_Text.style.display='none'; Codehighlighter1_262_529_Open_Image.style.display='inline'; Codehighlighter1_262_529_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">with</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(document.form1)</span><span id="Codehighlighter1_262_529_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_262_529_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img id="Codehighlighter1_304_526_Open_Image" onclick="this.style.display='none'; Codehighlighter1_304_526_Open_Text.style.display='none'; Codehighlighter1_304_526_Closed_Image.style.display='inline'; Codehighlighter1_304_526_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_304_526_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_304_526_Closed_Text.style.display='none'; Codehighlighter1_304_526_Open_Image.style.display='inline'; Codehighlighter1_304_526_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(confirm('该操作要求您连接上Internet，您确定吗？'))</span><span id="Codehighlighter1_304_526_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_304_526_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   getpsw.value</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">请稍候<img src="http://www.blogjava.net/images/dot.gif" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   getpsw.disabled</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   reg.disabled</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   url</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;a href=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">http:</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">//</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">siteB.com/makepsw.asp?sn=" target="_blank"&gt;http://siteB.com/makepsw.asp?sn=&lt;/a&gt;"+sn.value;</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">   o.setAttribute(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">src</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">,url);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img id="Codehighlighter1_555_699_Open_Image" onclick="this.style.display='none'; Codehighlighter1_555_699_Open_Text.style.display='none'; Codehighlighter1_555_699_Closed_Image.style.display='inline'; Codehighlighter1_555_699_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_555_699_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_555_699_Closed_Text.style.display='none'; Codehighlighter1_555_699_Open_Image.style.display='inline'; Codehighlighter1_555_699_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> reg_onclick()</span><span id="Codehighlighter1_555_699_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_555_699_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img id="Codehighlighter1_578_697_Open_Image" onclick="this.style.display='none'; Codehighlighter1_578_697_Open_Text.style.display='none'; Codehighlighter1_578_697_Closed_Image.style.display='inline'; Codehighlighter1_578_697_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_578_697_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_578_697_Closed_Text.style.display='none'; Codehighlighter1_578_697_Open_Image.style.display='inline'; Codehighlighter1_578_697_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">with</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(document.form1)</span><span id="Codehighlighter1_578_697_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_578_697_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img id="Codehighlighter1_604_674_Open_Image" onclick="this.style.display='none'; Codehighlighter1_604_674_Open_Text.style.display='none'; Codehighlighter1_604_674_Closed_Image.style.display='inline'; Codehighlighter1_604_674_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_604_674_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_604_674_Closed_Text.style.display='none'; Codehighlighter1_604_674_Open_Image.style.display='inline'; Codehighlighter1_604_674_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(password.value</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">""</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)</span><span id="Codehighlighter1_604_674_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_604_674_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   alert(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">请输入注册码，如果您还未获得注册码，请点击“获取注册码”按钮。</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   password.focus();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   submit();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">script</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #ff0000"> action</span><span style="COLOR: #0000ff">="myself.asp"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">请输入软件序列号：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="sn"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="ipt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="sn"</span><span style="COLOR: #ff0000"> size</span><span style="COLOR: #0000ff">="30"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">请输入注册密码：</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="ipt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="password"</span><span style="COLOR: #ff0000"> size</span><span style="COLOR: #0000ff">="30"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="getpsw"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="button"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="bt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="getpsw"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="width:90px"</span><span style="COLOR: #ff0000"> onClick</span><span style="COLOR: #0000ff">="javascript:getpsw_onclick()"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="获取注册密码"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="reg"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="button"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">="bt1"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="reg"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="注 册"</span><span style="COLOR: #ff0000"> onClick</span><span style="COLOR: #0000ff">="javascript:reg_onclick()"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />注：用户点击“获取注册密码”按钮，把序列号发送到siteB.com的服务器并获取到注册密码以后，点击“注册”就提交到自己的服务器中。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">script </span><span style="COLOR: #ff0000">language</span><span style="COLOR: #0000ff">="JavaScript"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text/javascript"</span><span style="COLOR: #ff0000"> src</span><span style="COLOR: #0000ff">="about:blank"</span><span style="COLOR: #ff0000"> id</span><span style="COLOR: #0000ff">="js_getpsw"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">script</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div><br /><font color="#000000">这是B页面的代码：</font><br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_2_36_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_36_Open_Text.style.display='none'; Codehighlighter1_2_36_Closed_Image.style.display='inline'; Codehighlighter1_2_36_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_2_36_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2_36_Closed_Text.style.display='none'; Codehighlighter1_2_36_Open_Image.style.display='inline'; Codehighlighter1_2_36_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_2_36_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_2_36_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@LANGUAGE</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">VBSCRIPT</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> CODEPAGE</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">936</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_42_56_Open_Image" onclick="this.style.display='none'; Codehighlighter1_42_56_Open_Text.style.display='none'; Codehighlighter1_42_56_Closed_Image.style.display='inline'; Codehighlighter1_42_56_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_42_56_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_42_56_Closed_Text.style.display='none'; Codehighlighter1_42_56_Open_Image.style.display='inline'; Codehighlighter1_42_56_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_42_56_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_42_56_Open_Text"><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Option</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Explicit</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_62_552_Open_Image" onclick="this.style.display='none'; Codehighlighter1_62_552_Open_Text.style.display='none'; Codehighlighter1_62_552_Closed_Image.style.display='inline'; Codehighlighter1_62_552_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_62_552_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_62_552_Closed_Text.style.display='none'; Codehighlighter1_62_552_Open_Image.style.display='inline'; Codehighlighter1_62_552_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_62_552_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_62_552_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">说明：改页取得用户的序列号以后，计算注册码，然后用动态JavaScript的写入方式向输入表单填充数据。</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">忽略错误</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">On</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Error</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Resume</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Next</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">定义变量（sn序列号，psw注册码）</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">dim</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> sn,psw<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">取得查询字符串中的序列号</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">sn</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Trim</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(Request.QueryString(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">sn</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">))<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">变换<img src="http://www.blogjava.net/images/dot.gif" />（可以和数据库相连作复杂变幻）</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">psw</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">StrReverse</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(sn)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">'</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5">输出反馈</span><span style="COLOR: #008000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> err </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">then</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    response.write </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">alert('对不起，注册过程中发生错误，请与我们联系。\n\n电话：010-12345678');with(document.form1){getpsw.value='获取失败！';}</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    response.write </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">with(document.form1){password.value='</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&amp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> psw </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&amp;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">';reg.disabled=false;getpsw.value='获取成功！';}this.src='about:blank';</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">end</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span></div></span></div><br />from: <a href="http://www.ziyuehome.com/article.asp?id=89">http://www.ziyuehome.com/article.asp?id=89</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/82613.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-21 21:41 <a href="http://www.blogjava.net/weidagang2046/articles/82613.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iframe 的用法与注意事项 </title><link>http://www.blogjava.net/weidagang2046/articles/82468.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 21 Nov 2006 02:39:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82468.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82468.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82468.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82468.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82468.html</trackback:ping><description><![CDATA[
		<table cellspacing="6" cellpadding="2" width="100%" align="center">
				<tbody>
						<tr>
								<td class="showbg">
								</td>
						</tr>
						<tr>
								<td class="showbg" colspan="2">
								</td>
						</tr>
				</tbody>
		</table>
		<table cellspacing="6" cellpadding="2" width="100%" align="center">
				<tbody>
						<tr>
								<td valign="top">
										<p>好多同志对 iframe 是如何控制的,并不是十分了解,基本上还处于一个模糊的认识状态.</p>
										<p>
												<strong>注意两个事项</strong>,ifr 是一个以存在的 iframe 的 ID 和 NAME 值:<br />document.getElementById(“ifr”);<br />window.frames[“ifr”];</p>
										<p>要想使用iframe内的函数,变量就必须通过第二种方法.因为它取的是一个完整的DOM模型(不知道这样说对不对).第一种方法只是取出了一个OBJECT而已.</p>
										<p>如果只想改变iframe的 src 或者 border , scrolling 等 attributes(与property不是一个概念,property是不能写在标签内的,比如:scrollHeight,innerHTML等),就需要用到第一种方法.</p>
										<p>如果想取得iframe的页面(不是iframe本身),就需要使用第二种方法,因为它取得的是一个完整的DOM模型,比如想得到iframe的document.body的内容,就只能用第二种方法.</p>
										<p>还要注意的是,如果在iframe的页面未完全装入的时候,调用iframe的DOM模型,会发生很严重的错误,所以,你要准备一个容错模式.</p>
								</td>
						</tr>
				</tbody>
		</table>
		<br />from: <a href="http://www.pubcms.com/demo/tech/web/000555.asp">http://www.pubcms.com/demo/tech/web/000555.asp</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/82468.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-21 10:39 <a href="http://www.blogjava.net/weidagang2046/articles/82468.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>'parentWindow' Example </title><link>http://www.blogjava.net/weidagang2046/articles/82450.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 21 Nov 2006 01:59:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82450.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82450.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82450.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82450.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82450.html</trackback:ping><description><![CDATA[
		<font face="Courier New">
				<font size="2">&lt;<font color="#7f0055"><b>html</b></font><font color="#000000">&gt;</font><br /><font color="#000000">&lt;</font><font color="#7f0055"><b>body</b></font><font color="#000000">&gt;</font><br /><font color="#000000">&lt;script language=</font><font color="#2a00ff">"JavaScript"</font><font color="#000000">&gt;</font><br /><font color="#ffffff">    </font><font color="#7f0055"><b>function </b></font><font color="#000000">function1</font><font color="#000000">() {</font><br /><font color="#ffffff">        </font><font color="#000000">alert</font><font color="#000000">(</font><font color="#000000">document.parentWindow.frames.length</font><font color="#000000">)</font><font color="#000000">;</font><br /><font color="#ffffff">    </font><font color="#000000">}</font><br /><font color="#000000">&lt;/script&gt;</font><br /><font color="#000000">&lt;input type=</font><font color="#2a00ff">"button" </font><br /><font color="#ffffff">       </font><font color="#000000">value=</font><font color="#2a00ff">"How many frames in this window?" </font><br /><font color="#ffffff">       </font><font color="#000000">onclick=</font><font color="#2a00ff">"function1();"</font><font color="#000000">&gt;</font><br /><font color="#000000">&lt;/</font><font color="#7f0055"><b>body</b></font><font color="#000000">&gt;</font><br /><font color="#000000">&lt;/</font><font color="#7f0055"><b>html</b></font></font>
				<font color="#000000">
						<font size="2">&gt;<br /><br />from: </font>
						<a href="http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/parentWindowExample.htm">
								<font size="2">http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/parentWindowExample.htm</font>
						</a>
				</font>
		</font>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/82450.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-21 09:59 <a href="http://www.blogjava.net/weidagang2046/articles/82450.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Creating A Client-Side Web Service Broker</title><link>http://www.blogjava.net/weidagang2046/articles/82384.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Mon, 20 Nov 2006 13:38:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82384.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82384.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82384.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82384.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82384.html</trackback:ping><description><![CDATA[
		<h2>del.icio.us direc.tor: Creating A Client-Side Web Service Broker</h2>
		<p>
				<em>June 20, 2005</em>
		</p>
		<p>Initially, I had planned on using the XmlHTTPRequest object to create a client-side application that integrated various web services like <a href="http://www.google.com/webhp?complete=1&amp;hl=en">Google suggest</a>, <a href="http://del.icio.us/">del.icio.us</a>, <a href="http://flickr.com/">Flickr</a>, <a href="http://developer.yahoo.net/">Yahoo developer network</a>, etc. Unfortunately, the browser security restrictions severely limit the capabilities of a client-side application, essentially eliminating any cross-domain integration services. However, single-domain services can still be implemented by using the Javascript bootloading technique.</p>
		<h3>Same-Origin Policy</h3>
		<p>The most frustrating part of creating any client-side application is the security model that applies to just about all executable objects that can be accessed by the browser. Designed the prevent cross-site scripting attacks (XSS), the <a href="http://www.mozilla.org/projects/security/components/jssec.html">same-origin policy</a> effectively prohibits a page served from <code><font color="#000077" size="5">www.mydomain.org</font></code> to access any document served from a different domain, via XmlHTTPRequest, IFRAME's, or similar DOM methods. Therefore, a page with a URL of <code><font color="#000077" size="5">http://www.mydomain.org:80/</font></code> cannot access another page that <strong>does not share the same protocol, domain, and port</strong>.</p>
		<p>One exception to this rule is when the <code><font color="#000077" size="5">document.domain</font></code> property is set. This exception stipulates that in an FRAME/IFRAME situation, documents served from different subdomains of the same base domain may access each other's DOM tree if <strong>both</strong> pages set their respective <code><font color="#000077" size="5">document.domain</font></code> property to the base domain. For example, if a page <code><font color="#000077" size="5">blue.domainA.org/master.html</font></code> contains an IFRAME of the page <code><font color="#000077" size="5">red.domainA.org/slave.html</font></code>, then by default the two pages will <strong>not</strong> be allowed to access each other's DOM tree. However, if <strong>both</strong> pages contain an explicit Javascript command, <code><font color="#000077" size="5">document.domain = "domainA.org";</font></code>, then access to the DOMs will be granted. What is somewhat confusing is that all pages have a valid <code><font color="#000077" size="5">document.domain</font></code> property that is set, but is considered null by the security model until it is set explicitly. Unfortunately, XmlHTTPRequest objects are not affected by the <code><font color="#000077" size="5">document.domain</font></code> property. XmlHTTPRequest will <strong>only</strong> fetch documents from the originating server. In fact, you have to specify a relative URL, since it completely ignores any URL's with a fully-qualified domain name.</p>
		<p>None of these security policies apply when executing a web page served from <code><font color="#000077" size="5">localhost</font></code>. You can use IFRAME's and XmlHTTPRequest objects to access any valid URL to your heart's content.</p>
		<h3>Using the Javascript Bootloader</h3>
		<p>You can execute arbitrary Javascript code in the security context of any web page by simply typing a javascript command into the browser's address bar:</p>
		<pre class="code">javascript:void(document.body.style.backgroundColor='#c00')</pre>
		<p>That command can also be bookmarked by either editing a bookmark property directly or using the drag-and-drop method, thus creating a Javascript bookmarklet. As anyone who has had the displeasure of implementing third-party banner ads knows, a web page may contain a <code><font color="#000077" size="5">&lt;script&gt;</font></code> reference to any valid URL, i.e. <code><font color="#000077" size="5">&lt;script src="http://shoddy.advertiser.net"&gt;&lt;/script&gt;</font></code>. The Javascript bootloader uses this capability to inject foreign code — not by writing out a <code><font color="#000077" size="5">&lt;script&gt;</font></code> string, but by way of DOM node creation:</p>
		<pre class="code">
				<span class="comment">
						<font color="#008000">// Create a new script node</font>
				</span>
var element = document.createElement('script');

<span class="comment"><font color="#008000">// set the 'src' attribute of the element</font></span>
element.setAttribute('src', 'http://johnvey.com/features/deliciousdirector/dboot.js');

<span class="comment"><font color="#008000">// insert the new node into the current document</font></span>
document.body.appendChild(element);</pre>
		<p>Once the new script node is inserted, the browser will automatically process the attached code. The complete javascript bookmarklet is as follows:</p>
		<p class="code">
				<code>
						<font color="#000077">javascript:void((function() {var%20element=document.createElement('script'); element.setAttribute('src', 'http://johnvey.com/features/deliciousdirector/dboot.js'); document.body.appendChild(element)})())</font>
				</code>
		</p>
		<p>This method eliminates the need to include large blocks of Javascript code inside a bookmark (compare with the <a href="http://www.squarefree.com/bookmarklets/webdevel.html">Javascript shell</a>), and allows central control of the core Javascript code.</p>
		<h3>Resetting the Page</h3>
		<p>Once the foreign code is loaded, you may want to clear the content from the page in order to start from a clean slate:</p>
		<pre class="code">
				<span class="comment">
						<font color="#008000">// clear the body content</font>
				</span>
document.body.innerHTML = "";

<span class="comment"><font color="#008000">// remove all the existing stylesheets</font></span>
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	if(a.getAttribute("rel").indexOf("style") != -1) {
		a.disabled = true;
	}
}

<span class="comment"><font color="#008000">// fill in new body content</font></span>
document.body.innerHTML = "Hello, World!";

<span class="comment"><font color="#008000">// create a new stylesheet link</font></span>
var ns = document.createElement("link");
ns.rel = "stylesheet";
ns.type = "text/css";
ns.href = "http://johnvey.com/features/deliciousdirector/d.css";
document.body.appendChild(ns);

<span class="comment"><font color="#008000">// create a new script node for the main program logic</font></span>
var js = document.createElement("script");
js.language = "javascript";
js.src = "http://johnvey.com/features/deliciousdirector/d.js";
document.body.appendChild(js);

<span class="comment"><font color="#008000">// update the page title</font></span>
document.title += " (Direc.tor)";<br /><br /><br /><br />from: <a href="http://johnvey.com/features/deliciousdirector/web-service-broker.html">http://johnvey.com/features/deliciousdirector/web-service-broker.html</a></pre>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/82384.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-20 21:38 <a href="http://www.blogjava.net/weidagang2046/articles/82384.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>成功实现ajax,xmlhttp跨域访问</title><link>http://www.blogjava.net/weidagang2046/articles/82369.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Mon, 20 Nov 2006 12:48:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82369.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82369.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82369.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82369.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82369.html</trackback:ping><description><![CDATA[
		<div>这几天脑细胞剩下的不多了，不过问题都一个个解决了，自我鼓励一下+7+u。^7^</div>
		<div>我希望搜索引擎能够搜索到这篇文章，给正在需要解决此类问题的朋友分享我的解决方案。</div>
		<div> </div>
		<div>例如</div>
		<div>a.com站点通过ajax访问聚合b.com站点内的RSS(xml)资源，这是跨域访问不能实现，网上我也查阅了大量的资料，没有找到有效的办法，有些变通的方法都必须具有b.com站点的权限对b.com站点进行设置才行。</div>
		<div> </div>
		<div>a.com站点聚合b.com站点内RSS资源方法如下：</div>
		<div>ajax部分不作详细说明。</div>
		<div>在a.com内使用动态网页（ASP、PHP、JSP或者其他l）作为代理读取b.com中rss内容，再在a.com中使用ajax读取分析该动态网页。</div>
		<div>
				<strong>PHP代码：</strong>
		</div>
		<div>
				<span class="Code">&lt;?<br />echo file_get_contents("http://b.com/rss.xml");<br />?&gt;</span>
		</div>
		<div> </div>
		<div>
				<strong>ASP代码：</strong>
		</div>
		<div>
				<span class="Code">&lt;%<br />p = "http://b.com/rss.xml"<br />Response.BinaryWrite ZQcnGet(p)<br />Response.Flush <br />Function ZQcnGet(url) <br />Set Retrieval = CreateObject("Microsoft.XMLHTTP") <br />With Retrieval <br />.Open "Get", url, False, "", "" <br />.Send <br />ZQcnGet = .ResponseBody<br />End With <br />Set Retrieval = Nothing <br />End Function <br />%&gt; </span>
				<p> </p>
				<p> </p>
				<p> </p>
				<p>
						<strong> JSP代码：</strong>
				</p>
				<p>
						<span class="Code">&lt;%<br />URLUtil util = new URLUtil("http://b.com/rss.xml");<br /> String news = util.getContent();<br /> System.out.println(news);<br />%&gt;</span>
				</p>
				<p> </p>
				<div>接下来在a.com中使用ajax读取分析该动态网页就ok了.<br /><br />from: <a href="http://www.zqcn.com/v/?127.html">http://www.zqcn.com/v/?127.html</a></div>
		</div>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/82369.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-20 20:48 <a href="http://www.blogjava.net/weidagang2046/articles/82369.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>弹出一个对话框来确定是否提交表单</title><link>http://www.blogjava.net/weidagang2046/articles/82035.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sun, 19 Nov 2006 07:00:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82035.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82035.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82035.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82035.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82035.html</trackback:ping><description><![CDATA[
		<font face="宋体">1.<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_53_211_Open_Image" onclick="this.style.display='none'; Codehighlighter1_53_211_Open_Text.style.display='none'; Codehighlighter1_53_211_Closed_Image.style.display='inline'; Codehighlighter1_53_211_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_53_211_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_53_211_Closed_Text.style.display='none'; Codehighlighter1_53_211_Open_Image.style.display='inline'; Codehighlighter1_53_211_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">script </span><span style="COLOR: #ff0000">language</span><span style="COLOR: #0000ff">="JavaScript"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="text/JavaScript"</span><span style="COLOR: #0000ff">&gt;</span><span id="Codehighlighter1_53_211_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_53_211_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> check(form)<br /><img id="Codehighlighter1_77_210_Open_Image" onclick="this.style.display='none'; Codehighlighter1_77_210_Open_Text.style.display='none'; Codehighlighter1_77_210_Closed_Image.style.display='inline'; Codehighlighter1_77_210_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_77_210_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_77_210_Closed_Text.style.display='none'; Codehighlighter1_77_210_Open_Image.style.display='inline'; Codehighlighter1_77_210_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_77_210_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_77_210_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">var</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> temp;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        temp</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(window.confirm(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">确定删除选中的数据？</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">))<br /><img id="Codehighlighter1_142_160_Open_Image" onclick="this.style.display='none'; Codehighlighter1_142_160_Open_Text.style.display='none'; Codehighlighter1_142_160_Closed_Image.style.display='inline'; Codehighlighter1_142_160_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_142_160_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_142_160_Closed_Text.style.display='none'; Codehighlighter1_142_160_Open_Image.style.display='inline'; Codehighlighter1_142_160_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_142_160_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_142_160_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            temp</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img id="Codehighlighter1_171_192_Open_Image" onclick="this.style.display='none'; Codehighlighter1_171_192_Open_Text.style.display='none'; Codehighlighter1_171_192_Closed_Image.style.display='inline'; Codehighlighter1_171_192_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_171_192_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_171_192_Closed_Text.style.display='none'; Codehighlighter1_171_192_Open_Image.style.display='inline'; Codehighlighter1_171_192_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_171_192_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_171_192_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">return</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">return</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> temp;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">script</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">method</span><span style="COLOR: #0000ff">="POST"</span><span style="COLOR: #ff0000"> action</span><span style="COLOR: #0000ff">=""</span><span style="COLOR: #ff0000"> onsubmit</span><span style="COLOR: #0000ff">="return check(this)"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="删除"</span><span style="COLOR: #ff0000"> name</span><span style="COLOR: #0000ff">="datadel"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span></div><br />2.<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000"> onclick</span><span style="COLOR: #0000ff">="return confirm('真的要删除吗?')"</span><span style="COLOR: #ff0000"> name</span><span style="COLOR: #0000ff">="submit1"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="删除"</span><span style="COLOR: #0000ff">&gt;</span></div><br />3.<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000"> onclick</span><span style="COLOR: #0000ff">="javascript: return confirm('确定提交吗?')"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="提交"</span><span style="COLOR: #0000ff">&gt;</span></div></font>
		<br />from: <a href="http://www.zychina.com.cn/article/159/181/20060619007.htm">http://www.zychina.com.cn/article/159/181/20060619007.htm</a><img src ="http://www.blogjava.net/weidagang2046/aggbug/82035.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-19 15:00 <a href="http://www.blogjava.net/weidagang2046/articles/82035.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态加载javascript</title><link>http://www.blogjava.net/weidagang2046/articles/82030.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sun, 19 Nov 2006 05:55:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82030.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82030.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82030.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82030.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82030.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">oHead </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> document.getElementsByTagName('head')[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />oScript </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> document.createElement(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">script</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />oScript.type </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">text/javascript</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />oScript.src </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">http://localhost:8080/Deeryard/scripts/deeryard.js</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />oHead.appendChild(oScript);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
		</div>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/82030.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-19 13:55 <a href="http://www.blogjava.net/weidagang2046/articles/82030.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>收藏本页功能的Javascript代码</title><link>http://www.blogjava.net/weidagang2046/articles/82026.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sun, 19 Nov 2006 05:19:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82026.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82026.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82026.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82026.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82026.html</trackback:ping><description><![CDATA[
		<font face="Verdana">
				<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #0000ff">&lt;</span>
						<span style="COLOR: #800000">a </span>
						<span style="COLOR: #ff0000">href</span>
						<span style="COLOR: #0000ff">=# </span>
						<span style="COLOR: #ff0000">class</span>
						<span style="COLOR: #0000ff">=black </span>
						<span style="COLOR: #ff0000">onClick</span>
						<span style="COLOR: #0000ff">="javascript:window.external.AddFavorite(document.URL,document.title);return false"</span>
						<span style="COLOR: #0000ff">&gt;</span>
						<span style="COLOR: #000000">收藏本页</span>
						<span style="COLOR: #0000ff">&lt;/</span>
						<span style="COLOR: #800000">a</span>
						<span style="COLOR: #0000ff">&gt;</span>
				</div>
		</font>
		<br />取得当前页的URL: document.URL<img src ="http://www.blogjava.net/weidagang2046/aggbug/82026.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-19 13:19 <a href="http://www.blogjava.net/weidagang2046/articles/82026.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javaScript处理页面</title><link>http://www.blogjava.net/weidagang2046/articles/82008.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sun, 19 Nov 2006 02:46:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82008.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82008.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82008.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82008.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82008.html</trackback:ping><description><![CDATA[　1.javascript等脚本语言是不能访问本地文件的，虽然在本机上的一些基于file:///路径或文件路径的html页面中是可以访问本地文件，但这是因为同是本地文件，他们之间是可以访问的！ 
<p>  在XMLHTTP技术中，对于先前的msxml版本的是可以访问本地文件，由于它同时也是一个安全漏洞，已经有相关的包或新版的msxml，已经禁止这么操作了！</p><p>  唯一的解决方案是把需要处理的文件上传到服务器，然后返回到客户端，然后由脚本语言处理。</p><p>　　2.对于innerHTML而言，它不是字符串，用字符串的加法是没有办法使之成为xml字符流。</p><p>　　处理的办法：1）可以把innerText=innerHTML,然后用innerText来得到该字符流，但要把innerHTML中的“（在提取innerHTML,他也会把‘变成“）改为‘才可以！</p><p class="code"> 例： var XMLStr=new String(XMLFileInfo.innerHTML);<br />   XMLStr=XMLFileInfo.innerText;<br />   XMLFileInfo.innerText="";<br />   alert(XMLStr);<br />   XMLStr=""+XMLStr+"";<br />   XMLStr = XMLStr.replace(/\"/g, "'");</p><p>   用var str=new String(div.innerHTML)也可以得到。</p><p>　　3.对于一般的标记，像&lt;span&gt;&lt;input&gt;等，通常可以直接用id来标示，然后用idName.attribute来获取和操作它的属性。如果用name来标示，则要从document向下追溯来获取和操作他的属性。 而id是不可以重名，否则无法获取</p><p>　　相关的属性！而name是可以重名的，通常操作第一个。</p><p>   注意：对于id而言，如果在form中，则要加一层formName.idName.attribute才能行得通！</p><p>　　4.在通过javascript来实现对某些表单的验证。（不要用onclick,它没有起到检验作用）</p><p>  例：</p><p class="code">  在页面中：&lt;form method="post" action="http://entry.126.com/cgi/login" name="form" onSubmit="return fCheck()"&gt;<br />    &lt;input name="domain" type="hidden" value="126.com" /&gt;<br />    &lt;input name="code" type="hidden" value="0" /&gt;<br />      &lt;/form&gt;</p><p>  在.js文件中：</p><p class="code">  function fCheck(){<br /> if( fm.user.value ==""|| fm.code.value=="") {<br />  window.alert("\请输入您的用户名 ?");<br />  fm.user.focus();<br />  return false;<br /> }<br /> else<br />          return true;<br />}</p><p>　　5.对于利用javascript用到参数传递时，要注意：</p><p>　　1）对于在html文档中对函数的调用，用"fanctionname('canshu')"这样的格式。不同于一般的语言传参数。</p><p>　　2）对于函数的声明，是不能代参数类型，直接声明变量：function functionname(canshu)即可。</p><p>　　这些就是因为它是弱语言，不同于通常的编程语言。</p><p>　　6.对于&lt;a&gt; &lt;div&gt; &lt;span&gt;等都支持事件和它们样式参数的应用。</p><p class="code">例：&lt;script language="javascript"&gt;<br />function selected(i){<br />Research.ResearchClass.value=i;<br />if(i==1){<br />book.style.color="red";<br />book.style.background="blue";<br />}<br />else<br />{<br />  book.style.color="black";<br />  book.style.background="#CCFFFF";<br />}<br />if(i==2){<br />magazine.style.color="red";<br />magazine.style.background="blue";<br />}<br />else<br />{<br />  magazine.style.color="black";<br />  magazine.style.background="#CCFFFF";<br />}<br /> if(i==3){<br />  others.style.color="red"<br />  others.style.background="blue";<br />  }<br />  else<br />{<br />  others.style.color="black";<br />  others.style.background="#CCFFFF";<br />}<br />}<br />&lt;/script&gt;<br />。。。。。</p><p>            &lt;td width="75" valign="top" bgcolor="#CCFFFF"&gt; &lt;div align="center" id="book"&gt;&lt;strong&gt;&lt;font size="4"&gt;&lt;a  onclick="selected('1')"&gt;&lt;u&gt;图书&lt;/u&gt;&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;<br />            &lt;td width="5" valign="top" bgcolor="#FF0000"&gt;&lt;!--DWLayoutEmptyCell--&gt;&amp;nbsp;&lt;/td&gt;<br />            &lt;td width="69" valign="top" bgcolor="blue" color="red"&gt; &lt;div align="center" id="magazine"   &gt;&lt;strong&gt;&lt;font size="4"&gt;&lt;a  onclick="selected('2')"&gt;&lt;u&gt;期刊&lt;/u&gt;&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;<br />            &lt;td width="5" valign="top" bgcolor="#FF0000"&gt;&lt;!--DWLayoutEmptyCell--&gt;&amp;nbsp;&lt;/td&gt;<br />            &lt;td width="71" valign="top" bgcolor="#CCFFFF"&gt; &lt;div align="center" id="others"&gt;&lt;font size="4"&gt;&lt;strong&gt;&lt;a  onclick="selected('3')"&gt;&lt;u&gt;其他&lt;/u&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;<br /><br />from: <a href="http://www.5217.cn/Article/jzjc/wzjss/htmljs/200603/1403.html">http://www.5217.cn/Article/jzjc/wzjss/htmljs/200603/1403.html</a></p><img src ="http://www.blogjava.net/weidagang2046/aggbug/82008.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-19 10:46 <a href="http://www.blogjava.net/weidagang2046/articles/82008.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用JavaScript和DOM动态创建表格</title><link>http://www.blogjava.net/weidagang2046/articles/82006.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Sun, 19 Nov 2006 02:37:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/82006.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/82006.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/82006.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/82006.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/82006.html</trackback:ping><description><![CDATA[
		<p>　　第一次翻译技术文章，本身英语水平很烂，翻译的也是自己刚开始学习的技术，所以能勉强看懂英文的话都要尽量读 <a class="" href="http://developer.mozilla.org/en/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces">原文</a> 而不要看我的翻译，免得被误导。<a class="" href="http://developer.mozilla.org/en/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces">阅读原文</a><br /></p>
		<ins datetime="2006-07-02T22:43:47+00:00">
				<strong>简介</strong>
		</ins>
		<br />　　这篇文章简单介绍了DOM 1.0一些基本而强大的方法以及如何在JavaScript中使用它们。你可以学到如何动态地创建、获取、控制和删除HTML元素。这些DOM方法同样适用于XML。所有全面支持DOM 1.0的浏览器都能很好地运行本篇的实例，比如IE5，Firefox等。<br /><ins datetime="2006-07-02T22:43:47+00:00"><strong>概况 － Sample1.html</strong></ins><br />　　这篇文章通过实例代码介绍DOM。请从尝试下面的HTML例子开始。它使用DOM 1的方法由JavaScript动态创建一个HTML表格。它创建一个由四个包含文本内容的单元格组成的小表格。单元格的文字内容是：“单元格是第y行第x列”，表示单元格在表格中的行数和列数。<a id="more-256"></a><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">实例代码 - 使用JavaScript和DOM创建HTML表格</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: green">function</span><span style="COLOR: gray"></span><span style="COLOR: blue">start</span><span style="COLOR: olive">()</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br /></span><span style="COLOR: #ffa500">//获取body标签</span><span style="COLOR: gray"><br /></span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">// 创建一个&lt;table&gt;元素和一个&lt;tbody&gt;元素</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">     = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">table</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tbody</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">//创建所有的单元格</span><span style="COLOR: gray"><br /></span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">j</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 创建一个&lt;tr&gt;元素</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tr</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">i</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 创建一个&lt;td&gt;元素</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">td</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">//创建一个文本节点</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">currenttext</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createTextNode</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">单元格是第</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">+</span><span style="COLOR: blue">j</span><span style="COLOR: gray">+</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">行，第</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">+</span><span style="COLOR: blue">i</span><span style="COLOR: gray">+</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">列</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">// 将创建的文本节点添加到&lt;td&gt;里</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">currenttext</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">// 将列&lt;td&gt;添加到行&lt;tr&gt;</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 将行&lt;tr&gt;添加到&lt;tbody&gt;</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br /></span><span style="COLOR: #ffa500">// 将&lt;tbody&gt;添加到&lt;table&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytablebody</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: #ffa500">//将&lt;table&gt;添加到&lt;body&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytable</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: #ffa500">// 将表格mytable的border属性设置为2</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">setAttribute</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">border</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">, </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">2</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">body</span><span style="COLOR: gray"></span><span style="COLOR: #00008b">onload</span><span style="COLOR: gray">=</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">start()</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">body</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span></div></div><p>注意我们创建各元素和文字节点的顺序：</p><blockquote><p>1.创建&lt; table &gt;元素<br />2.创建&lt; table &gt;的子元素&lt; tbody &gt;<br />3.使用一个循环来创建&lt; tbody &gt;的子元素&lt; tr &gt;<br />4.分别使用循环为每一个&lt; tr &gt;创建子元素&lt; tb &gt;<br />5.为每一个&lt; tb &gt;创建文本节点</p></blockquote><p>　　创建完&lt; table &gt;,&lt; tbody &gt;,&lt; tr &gt;,&lt; td &gt;元素和文本节点，我们使用相反的顺序把它们分别添加到自己的父节点。<br />1.将创建的文本节点添加到&lt; td &gt;里</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">currenttext</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>2.将列&lt; td &gt;添加到行&lt; tr &gt;</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>3.将行&lt; tr &gt;添加到&lt; tbody &gt;</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>4.将&lt; tbody &gt;添加到&lt; table &gt;</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytablebody</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>5.将&lt; table &gt;添加到&lt; body &gt;</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytable</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>记住这个方法。当你使用W3C DOM时会经常用到它。首先，你从上向下建立元素；然后从下向上把它们添加到父节点。<br />这是JavaScript代码生成的HTML：</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: gray">...<br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">table</span><span style="COLOR: gray"></span><span style="COLOR: #00008b">border</span><span style="COLOR: gray">=</span><span style="COLOR: #00008b">5</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">tr</span><span style="COLOR: olive">&gt;&lt;</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">单元格是第0行，第0列</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;&lt;</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">单元格是第0行，第1列</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;&lt;/</span><span style="COLOR: green">tr</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">tr</span><span style="COLOR: olive">&gt;&lt;</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">单元格是第1行，第0列</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;&lt;</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">单元格是第1行，第1列</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">td</span><span style="COLOR: olive">&gt;&lt;/</span><span style="COLOR: green">tr</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">table</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />...</span></div></div><p>这是代码生成的表格元素和它的子元素的DOM对象树：<br /><img id="image257" alt="sample1-tabledom.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample1-tabledom.jpg" /><br />　　你只需使用少量的DOM方法就可以构造这样一个表格和他的子元素。记住要时刻谨记你将创建的构造的模型树；这样会使编写代码更加简单。在图中的&lt; table &gt;树里，&lt; table &gt;有一个子元素&lt; tbody &gt;。&lt; tbody &gt;有两个子元素。&lt; tbody &gt;的每个子元素（&lt; tr &gt;）都有两个子元素&lt; td &gt;。最后，每个&lt; td &gt;有一个子元素：一个文本节点。　　<br /></p><ins datetime="2006-07-02T22:43:47+00:00"><strong>基本的DOM方法 － Sample2.html</strong></ins><br />　　getElementByTagName方法适用于文档和元素，所以文档根对象和所有的元素对象一样有 getElementByTagName 方法。你可以使用 element.getElementsByTagName(tagname) 来获取某个元素所有子元素的列表，使用标签名选择它们。<br />　　element.getElementsByTagName 返回一个有特定标签名的子元素的列表。你可以通过调用一个item方法（传递一个index参数给它）来从这个子元素列表中获取一个元素。请注意列表第一个子元素的index为0。下一个主题继续前面的Table例子。下面这个实例更加简单，显示了一些基本的方法：<div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">实例代码 - 使用JavaScript和DOM创建HTML表格</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: green">function</span><span style="COLOR: gray"></span><span style="COLOR: blue">start</span><span style="COLOR: olive">()</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />  </span><span style="COLOR: #ffa500">// 获取一个包含所有body元素的列表（将只有一个）</span><span style="COLOR: gray"><br />  </span><span style="COLOR: #ffa500">// 然后选择列表里的第一个元素</span><span style="COLOR: gray"><br />  </span><span style="COLOR: blue">myBody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /> <br />  </span><span style="COLOR: #ffa500">// 获取body字元素中所有的p元素</span><span style="COLOR: gray"><br />  </span><span style="COLOR: blue">myBodyElements</span><span style="COLOR: gray"> = </span><span style="COLOR: blue">myBody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">p</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /> <br />  </span><span style="COLOR: #ffa500">//获取p元素列表的第二个元素（索引从0开始）</span><span style="COLOR: gray"><br />  </span><span style="COLOR: blue">myP</span><span style="COLOR: gray"> = </span><span style="COLOR: blue">myBodyElements</span><span style="COLOR: olive">[</span><span style="COLOR: maroon">1</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">body</span><span style="COLOR: gray"></span><span style="COLOR: #00008b">onload</span><span style="COLOR: gray">=</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">start()</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">p</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">hi</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">p</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">p</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">hello</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">p</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br />  </span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">body</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span></div></div><p>在这个例子里，我们设置myP变量为表示body里第二个p元素的DOM对象。<br />1.获取一个包含所有body元素的列表</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myBody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;</span></div></div><p>因为一个有效的html文档只有一个body元素，这个列表讲只有一项。我们通过使用 [0] 选取列表的第一个元素来得到它。<br />2.获取blog子元素里所有的p元素</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myBodyElements</span><span style="COLOR: gray"> = </span><span style="COLOR: blue">myBody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">p</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>3.选取p元素列表的第二项</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myP</span><span style="COLOR: gray"> = </span><span style="COLOR: blue">myBodyElements</span><span style="COLOR: olive">[</span><span style="COLOR: maroon">1</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;</span></div></div><p><img id="image258" alt="sample2a2.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample2a2.jpg" /><br />一旦获得一个html元素的DOM对象，你就可以设置它的属性。比如，你想设置style background color属性，只需要添加：</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myP</span><span style="COLOR: gray">.</span><span style="COLOR: blue">style</span><span style="COLOR: gray">.</span><span style="COLOR: blue">background</span><span style="COLOR: gray"> = </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">rgb(255,0,0)</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">;</span></div></div><p><strong>使用document.createTextNode(”..”)创建文本节点</strong><br />使用文档对象调用createTextNode方法建立你的文本节点。你只需要输入文本内容。返回值是一个表示这个文本节点的对象。</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myTextNode</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createTextNode</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">world</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>以上代码创建一个文本数据是“word”的TEXT_NODE类型（文字块）节点，变量myTextNode指向这个节点对象。你需要设置这个文本节点为其他节点元素的字节点来插入这个文本到你的html页面里。<br /><strong>使用appendChild(..)插入元素</strong><br />所以，通过调用myP.appendChild([node_element])，你设置这个文本节点为第二个p元素的字节点。</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myP</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">myTextNode</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>测试这个例子，注意“hello”和“world”两个词是连在一起的：“helloworld”。所以在当你看到html页面时两个文本节点hello和world看起来好像是一个节点，而实际上在这个文档模型里有两个节点。第二个节点是一个新的TEXT_NODE类型节点，并且是第二个p标签的第二个字节点。下图在文档树里显示了刚创建的文本节点。<br /><img id="image259" alt="sample2b2.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample2b2.jpg" /></p><blockquote><p>createTextNode和appendChild是在hello和world之间添加空格的一种简单的方法。需要特别注意的是appendChild方法将添加在最后一个子节点后面，就像world被添加到hello后面。所以如果你想在hello和world之间添加一个文本节点需要使用insertBefore方法而不是appendChild。</p></blockquote><p><strong>使用文档对象和createElement(..)方法创建新元素</strong><br />　　你可以使用createElement方法创建新的HTML元素或者其他任何你想要的其他元素。例如，如果你想为&lt; body &gt;元素添加一个字节点&lt; p &gt;元素，可以使用前例中的myBody添加一个新的元素节点。创建一个节点只需要调用document.createElement(”tagname”)。例如：</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myNewPTAGnode</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">p</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">myBody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">myNewPTAGnode</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p><img id="image260" alt="sample2c.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample2c.jpg" /><br /><strong>使用removeChild(..)方法删除节点</strong><br />　　每个节点都可以删除。下面这行代码删除myP（第二个&lt; p &gt;元素）里包含单词world的文本节点。</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myP</span><span style="COLOR: gray">.</span><span style="COLOR: blue">removeChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">myTextNode</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>　　最后你可以把包含单词world的文本节点myTextNode添加到新创建的&lt; p &gt;元素里：</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">myNewPTAGnode</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">myTextNode</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p>　　修正的对象树最后像这样：<br /><img id="image261" alt="sample2d.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample2d.jpg" /><br /></p><ins datetime="2006-07-02T22:50:58+00:00"><strong>动态创建一个表格（回到Sample1.html）</strong></ins><br />　　文章的剩余部分将回到Sample1.html。下图显示了例子中创建的表格的对象树结构。<br /><strong>回顾HTML表格结构</strong><br /><img id="image257" alt="sample1-tabledom.jpg" src="http://eidiot.net/wp-content/uploads/2006/07/sample1-tabledom.jpg" /><br /><strong>创建元素节点并把它们添加到文档树</strong><br />创建sample1.html里的表格的基本步骤：<ul><li>获取body对象（文档对象的第一项） 
</li><li>创建所有的元素 
</li><li>最后，按照上图的表格结构添加每一个字节点下面的源代码是sample1.html的注释 </li></ul><blockquote><p>start函数的最后有一行新代码，使用另一个DOM方法setAttribute设置了表格的border属性。setAttribute方法有两个参数：属性名和属性值。你可以使用setAttribute方法设置任何元素的任何属性。</p></blockquote><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray">实例代码 - 使用JavaScript和DOM创建HTML表格</span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">title</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: green">function</span><span style="COLOR: gray"></span><span style="COLOR: blue">start</span><span style="COLOR: olive">()</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br /></span><span style="COLOR: #ffa500">// 获取body</span><span style="COLOR: gray"><br /></span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">// 创建&lt;table&gt;和&lt;tbody&gt;元素</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">     = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">table</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tbody</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">//创建所有的单元格</span><span style="COLOR: gray"><br /></span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">j</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 创建一个 &lt;tr&gt; 元素</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tr</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /> <br />    </span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">i</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 创建一个&lt;td&gt; 元素</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">td</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">// 创建一个文本节点</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">currenttext</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createTextNode</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">单元格是第</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray"> + </span><span style="COLOR: blue">j</span><span style="COLOR: gray"> + </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">行，第</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray"> + </span><span style="COLOR: blue">i</span><span style="COLOR: gray"> + </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">列</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">// 把创建的文本节点添加到&lt;td&gt;元素</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">currenttext</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: #ffa500">// 把&lt;td&gt;添加到&lt;tr&gt;行</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />    </span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br />    </span><span style="COLOR: #ffa500">// 把&lt;tr&gt;行添加到&lt;tbody&gt;</span><span style="COLOR: gray"><br />    </span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br /> <br /></span><span style="COLOR: #ffa500">// 把 &lt;tbody&gt; 添加到 &lt;table&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytablebody</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: #ffa500">// 把 &lt;table&gt; 添加到 &lt;body&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytable</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: #ffa500">// 把mytable的border属性设置为2;</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">setAttribute</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">border</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">,</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">2</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">head</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">body</span><span style="COLOR: gray"></span><span style="COLOR: #00008b">onload</span><span style="COLOR: gray">=</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">start()</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">body</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span></div></div><p></p><ins datetime="2006-07-02T22:50:58+00:00"><strong>使用DOM和CSS处理表格</strong></ins><br /><strong>从表格中获取一个文本节点</strong><br />　　这个例子介绍两个新的DOM属性。首先使用childNodes属性获取mycel的字节点列表。这个childNodes列表包含所有的字节点，不管它们的名称和类型是什么。像getElementsByTagName方法一样，它返回一个字节点列表，使用 [ x ] 来获取想要的字节点项。这个例子将myceltext存储为表格第二行第二个单元格的文本节点。最后，它创建一个新的包含myceltext 的data 属性 的文本节点，并使它成为&lt; body &gt;元素的子节点，来显示这个例子的最后结果。<blockquote><p>如果你的对象是文本节点，你可以使用data属性来获取它的内容</p></blockquote><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mybody</span><span style="COLOR: gray">      = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">     = </span><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">table</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray"> = </span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tbody</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">myrow</span><span style="COLOR: gray">       = </span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tr</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">1</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mycel</span><span style="COLOR: gray">       = </span><span style="COLOR: blue">myrow</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">td</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">1</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">// mycel的字节点列表的第一项</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">myceltext</span><span style="COLOR: gray">=</span><span style="COLOR: blue">mycel</span><span style="COLOR: gray">.</span><span style="COLOR: blue">childNodes</span><span style="COLOR: olive">[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: #ffa500">// currenttext的内容是myceltext的data</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">currenttext</span><span style="COLOR: gray">=</span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createTextNode</span><span style="COLOR: olive">(</span><span style="COLOR: blue">myceltext</span><span style="COLOR: gray">.</span><span style="COLOR: blue">data</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">currenttext</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p><strong>获取一个属性值</strong><br />　　在sample1的最后有一个单元格使用了mytable对象的setAttribute方法。这个单元格用来设置这个表格的border属性。使用getAttribute方法来获取这个属性：</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getAttribute</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">border</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;</span></div></div><p><strong>通过改变style属性隐藏列</strong><br />　　当你使用一个JavaScript变量指向对象，你可以立即设置它的style属性。下面的代码是sample1.html的修改，第二列的单元格都被隐藏，第一列的单元格背景改为红色。注意style属性是直接设置的。</p><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">body</span><span style="COLOR: gray"></span><span style="COLOR: #00008b">onload</span><span style="COLOR: gray">=</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">start()</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">body</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: green">function</span><span style="COLOR: gray"></span><span style="COLOR: blue">start</span><span style="COLOR: olive">()</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br /></span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray"> =</span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">getElementsByTagName</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">body</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)[</span><span style="COLOR: maroon">0</span><span style="COLOR: olive">]</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">     = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">table</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tbody</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /> <br /></span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">j</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">j</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />   </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray">=</span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">tr</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />   </span><span style="COLOR: green">for</span><span style="COLOR: olive">(</span><span style="COLOR: green">var</span><span style="COLOR: gray"></span><span style="COLOR: blue">i</span><span style="COLOR: gray"> = </span><span style="COLOR: maroon">0</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray"> &lt; </span><span style="COLOR: maroon">2</span><span style="COLOR: gray">; </span><span style="COLOR: blue">i</span><span style="COLOR: gray">++</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />       </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createElement</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">td</span><span style="COLOR: #8b0000">"</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: blue">currenttext</span><span style="COLOR: gray"> = </span><span style="COLOR: teal">document</span><span style="COLOR: gray">.</span><span style="COLOR: blue">createTextNode</span><span style="COLOR: olive">(</span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">单元格是:</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray"> + </span><span style="COLOR: blue">i</span><span style="COLOR: gray"> + </span><span style="COLOR: blue">j</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">currenttext</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: #ffa500">// 如果在第0列设置单元格背景色</span><span style="COLOR: gray"><br />       </span><span style="COLOR: #ffa500">// 如果在第1列隐藏单元格</span><span style="COLOR: gray"><br />       </span><span style="COLOR: green">if</span><span style="COLOR: gray"></span><span style="COLOR: olive">(</span><span style="COLOR: blue">i</span><span style="COLOR: gray"> == </span><span style="COLOR: maroon">0</span><span style="COLOR: olive">)</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />       </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">style</span><span style="COLOR: gray">.</span><span style="COLOR: blue">background</span><span style="COLOR: gray"> = </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">rgb(255,0,0)</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: olive">}</span><span style="COLOR: gray"></span><span style="COLOR: green">else</span><span style="COLOR: gray"></span><span style="COLOR: olive">{</span><span style="COLOR: gray"><br />       </span><span style="COLOR: blue">mycurrent_cell</span><span style="COLOR: gray">.</span><span style="COLOR: blue">style</span><span style="COLOR: gray">.</span><span style="COLOR: blue">display</span><span style="COLOR: gray"> = </span><span style="COLOR: #8b0000">"</span><span style="COLOR: red">none</span><span style="COLOR: #8b0000">"</span><span style="COLOR: gray">;<br />       </span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br />   </span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br />   </span><span style="COLOR: blue">mytablebody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mycurrent_row</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span><span style="COLOR: gray"><br /></span><span style="COLOR: blue">mytable</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytablebody</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: blue">mybody</span><span style="COLOR: gray">.</span><span style="COLOR: blue">appendChild</span><span style="COLOR: olive">(</span><span style="COLOR: blue">mytable</span><span style="COLOR: olive">)</span><span style="COLOR: gray">;<br /></span><span style="COLOR: olive">}</span></div></div><div class="hl-surround"><div class="hl-main"><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">script</span><span style="COLOR: olive">&gt;</span><span style="COLOR: gray"><br /></span><span style="COLOR: olive">&lt;/</span><span style="COLOR: green">html</span><span style="COLOR: olive">&gt;<br /><br />from: <a href="http://eidiot.net/?p=256">http://eidiot.net/?p=256</a></span></div></div><img src ="http://www.blogjava.net/weidagang2046/aggbug/82006.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-19 10:37 <a href="http://www.blogjava.net/weidagang2046/articles/82006.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>网页不会被缓存</title><link>http://www.blogjava.net/weidagang2046/articles/81167.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Wed, 15 Nov 2006 01:34:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/81167.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/81167.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/81167.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/81167.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/81167.html</trackback:ping><description><![CDATA[
		<p>
				<span class="pg" id="xydwtext">
						<font size="1">
								<font size="2">&lt;META HTTP-EQUIV="pragma" CONTENT="no-cache"&gt;<br />&lt;META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"&gt;<br />&lt;META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"&gt;<br />或者&lt;META HTTP-EQUIV="expires" CONTENT="0"&gt; <br /><br />from:</font>
								<a href="http://www.cnwebshow.com/23/25/0512/2165.htm">http://www.cnwebshow.com/23/25/0512/2165.htm</a>
						</font>
				</span>
		</p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/81167.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-15 09:34 <a href="http://www.blogjava.net/weidagang2046/articles/81167.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于div的隐藏</title><link>http://www.blogjava.net/weidagang2046/articles/81102.html</link><dc:creator>weidagang2046</dc:creator><author>weidagang2046</author><pubDate>Tue, 14 Nov 2006 05:09:00 GMT</pubDate><guid>http://www.blogjava.net/weidagang2046/articles/81102.html</guid><wfw:comment>http://www.blogjava.net/weidagang2046/comments/81102.html</wfw:comment><comments>http://www.blogjava.net/weidagang2046/articles/81102.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/weidagang2046/comments/commentRss/81102.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/weidagang2046/services/trackbacks/81102.html</trackback:ping><description><![CDATA[
		<p>
				<span class="info_title">div的visibility可以控制div的显示和隐藏，但是隐藏后页面显示空白<br /><br />style="visibility: none;"<br /><br />document.getElementById("typediv1").style.visibility="hidden";//隐藏<br /><br />document.getElementById("typediv1").style.visibility="visible";//显示<br /><br /><br />通过设置display属性可以使div隐藏后释放占用的页面空间，如下<br /><br />style="display: none;"<br /><br />document.getElementById("typediv1").style.display="none";//隐藏<br /><br />document.getElementById("typediv1").style.display="";//显示 <br /><br />from: <a href="http://www.webmake.com.cn/Content.php?635.html">http://www.webmake.com.cn/Content.php?635.html</a></span>
		</p>
<img src ="http://www.blogjava.net/weidagang2046/aggbug/81102.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/weidagang2046/" target="_blank">weidagang2046</a> 2006-11-14 13:09 <a href="http://www.blogjava.net/weidagang2046/articles/81102.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>