×Ô¼ºÐ´µÄjavascriptÎå×ÓÆå
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>five-in-a-raw</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
<!--
table{text-align: center;font-size: 20px;cursor: hand;empty-cells: show;table-layout: fixed;}
-->
</style>
</head>
<script type="text/javascript">
<!--
function FiveRawGame(){
this.redChess="<font color=\"red\">X</font>";
this.blackChess="<font color='black'>O</font>";
//³õʼ»¯ÆåÅ̺ÍÊý¾Ý
this.init=function(){
var str="<table width=\"600\" height=\"600;\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" >";
for(var i=0;i<25;i++){
str+="<tr height='7'>";
for(var j=0;j<25;j++){
str+="<td id='r"+i+"c"+j+"' onclick=\"FiveRawGame.chess("+i+","+j+")\" onmouseover=\"FiveRawGame.showMsg("+i+","+j+")\"> </td>";
}
str+="</tr>";
}
str+="</table>";
document.getElementById("main").innerHTML=str;
this.allGrids=new Array();
for(var a=0;a<25;a++){
this.allGrids[a]=new Array();
}
for(var i=0;i<25;i++){
for(var j=0;j<25;j++){
this.allGrids[i][j]=new grid(i,j,"O");
}
}
this.isChess=true;
this.redArr=new Array();
this.blackArr=new Array();
this.allArr=new Array();
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
// µ÷ÓÃÒ³ÃæµÄˢз½·¨
IHTMLWindow2* pWindow;
IHTMLDocument2* pDocument;
HRESULT hr = GetDHtmlDocument(&pDocument);
hr = pDocument->get_pa ......
Identifier Resolution Performance ±êʶ·ûʶ±ðÐÔÄÜ
Identifier resolution isn't free, as in fact no computer operation really is without some sort of performance overhead. The deeper into the execution context's scope chain an identifier exists, the slower it is to access for ......
Cloning Nodes ½Úµã¿Ë¡
Another way of updating page contents using DOM methods is to clone existing DOM elements instead of creating new ones—in other words, using element.cloneNode() (where element is an existing node) instead of document.createElement().
&nbs ......