1、 " /> 伊人久久五月天,欧洲视频一区二区,亚洲精品国产精品久久清纯直播

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

總結AJAX相關JS代碼片段和瀏覽器模型

在.NET開發中,充分利用免費控件是好事情,但是如果不能修改控件達到自己的需求,就要動用JS大法了,前提是研究好瀏覽器模型 的各種對象的方法屬性。尤其是熟悉CSS+HTML就會做的很酷。就JS語言本身來說要求不高。

  1、動態刪除Table 里面內容技巧,不需要寫太多代碼,一行:

tb.removeNode(true) 

  2、動態增加行,除了CreateElement方法,還可以這樣比較短小:

<table id=tb1></table>
<SCRIPT>
function addTable(){
 var row1 = tb1.insertRow(); 
 var cell1=row1.insertCell();
 var cell2=row1.insertCell();
 cell1.innerText="灰豆寶寶";
 cell2.innerText="超級大笨狼"
}
</SCRIPT> 
<INPUT TYPE = "button" VALUE = "AddTable" onclick = "addTable()"> 

  3、在DIV中動態增加Table

<SCRIPT>
function addTable(){
 var tb1 = document.createElement("table";
 tb1.border="1px";
 var row1 = tb1.insertRow(); 
 var cell1=row1.insertCell();
 var cell2=row1.insertCell();
 mydiv.appendChild(tb1);
 cell1.innerText="wanghr100";
 cell2.innerText="panyuguang962"
}
</SCRIPT>
<BODY>
<div id=mydiv style="width:400;height:300;"></div>
<INPUT TYPE = "button" VALUE = "AddTable" onclick = "addTable()"> 

  4、在DIV中刪除Table,簡單只要Div.innerHTML=""就可以。

  以上是部分實用相對短小的代碼,當然有其他各種辦法實現,不過一般都比上面的長,比如組合使用DIV對象的insertAdjacentHTML 方法等,在不同需要下使用不同方法,前提是研究好瀏覽器模型 的各種對象的方法屬性。尤其是熟悉CSS+HTML就會做的很酷。就JS語言本身來說要求不高。

  以下是以Document對象為例,相關方法有:

Method Description 
attachEvent 
createAttribute 
createComment 
createDocumentFragment 
createElement 
createEventObject 
createStyleSheet 
createTextNode 
detachEvent 
getElementById 
getElementsByName 
getElementsByTagName 
mergeAttributes
recalc 
write 
writeln 

  以DIV對象為例相關方法有:

addBehavior 
appendChild 
applyElement 
attachEvent 
clearAttributes
cloneNode 
contains 
detachEvent
getAdjacentText 
getAttribute 
getAttributeNode 
getElementsByTagName 
hasChildNodes 
insertAdjacentElement 
insertAdjacentHTML 
insertAdjacentText 
insertBefore
mergeAttributes 
normalize
removeAttribute 
removeAttributeNode 
removeBehavior 
removeChild 
removeExpression 
removeNode 
replaceAdjacentText 
replaceChild 
replaceNode 
setActive 
setAttribute 
setAttributeNode 
setExpression 

JavaScript技術總結AJAX相關JS代碼片段和瀏覽器模型,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 山东省| 高碑店市| 正阳县| 锡林浩特市| 红桥区| 宜兰县| 颍上县| 芷江| 建昌县| 万州区| 基隆市| 大宁县| 苏尼特右旗| 绩溪县| 阜宁县| 横峰县| 疏勒县| 台安县| 申扎县| 韩城市| 桑植县| 舒兰市| 磴口县| 新和县| 宁都县| 赫章县| 陇西县| 高唐县| 长宁县| 昌图县| 嘉鱼县| 潼南县| 贺兰县| 昌宁县| 宾川县| 新宁县| 吉水县| 临武县| 屏东县| 香格里拉县| 宣武区|