javaScript.DOM. 编程艺术第二版
Posted 六楼外的风景
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javaScript.DOM. 编程艺术第二版相关的知识,希望对你有一定的参考价值。
<BODY>
<h1> what is the Document Object Model?</h1>
<p>
The <abbr title="...ConSortium">W3C</abbr> define<abbr title="doment object">
DOM</abbr> as:
</p>
<blockquote cite="http://www.w3c.org/DOM/">
<p>
Afds fd fds
and .... of document.
</p>
<p>
It is
The <abbr title="...YF is">YF</abbr>
</p>
<script type="text/javascript">
displayAbbreviations();
function displayAbbreviations()
var abbreviations = document.getElementsByTagName("abbr");
var abblength=abbreviations.length;
if(abblength>0)
var defs = new Array();
for(var i=0;i<abblength;i++)
var key = abbreviations[i].lastChild.nodeValue//W3C DOM YF
var attTitle = abbreviations[i].getAttribute("title");
defs[key]=attTitle;
var dlist = document.createElement("dl");
for(key in defs)
//dt
// alert(key);
// alert(defs[key]);
var definition = defs[key];
var dtitle = document.createElement("dt");
var dtitle_text = document.createTextNode(key);
dtitle.appendChild(dtitle_text);
dlist.appendChild(dtitle);
//dd
var ddesc = document.createElement("dd");
var ddesc_text = document.createTextNode(definition);
ddesc.appendChild(ddesc_text);
dlist.appendChild(ddesc);
//h2
var header = document.createElement("h2");
var header_text=document.createTextNode("Abbreviations");
header.appendChild(header_text);
//body
//document.getElementsByTagName("body")[0];
//document.body.appendChild(header);
//document.body.appendChild(dlist);
document.getElementsByTagName("body")[0].appendChild(dlist);
document.getElementsByTagName("body")[0].appendChild(header);
</script>
</BODY>
</html>
以上是关于javaScript.DOM. 编程艺术第二版的主要内容,如果未能解决你的问题,请参考以下文章