Dom编程艺术2-充实文档内容

1.充实文档内容

(1)显示缩略语列表
获取文档中的abbr属性,然后用dl ,dt展示

function displayAbbreviations() {
  if (!document.getElementsByTagName || !document.createElement || !document.createTextNode) return false;
// get all the abbreviations
  var abbreviations = document.getElementsByTagName("abbr");
  if (abbreviations.length < 1) return false;
  var defs = new Array();
// loop through the abbreviations
  for (var i=0; i


  
    
    Explaining the Document Object Model
    
    
    
  
  
    

What is the Document Object Model?

The W3C defines the DOM as:

A platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents.

It is an API that can be used to navigate HTML and XML documents.

Dom编程艺术2-充实文档内容_第1张图片
Paste_Image.png

(2).获取文章中的快捷键然后展示accesskey

function displayAccesskeys() {
  if (!document.getElementsByTagName || !document.createElement || !document.createTextNode) return false;
// get all the links in the document
  var links = document.getElementsByTagName("a");
// create an array to store the accesskeys
  var akeys = new Array();
// loop through the links
  for (var i=0; i

    
    

What is the Document Object Model?

The W3C defines the DOM as:

A platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents.

It is an API that can be used to navigate HTML and XML documents.

Dom编程艺术2-充实文档内容_第2张图片
Paste_Image.png

(3).显示文献来源列表

function displayCitations() {
  if (!document.getElementsByTagName || !document.createElement || !document.createTextNode) return false;
// get all the blockquotes
  var quotes = document.getElementsByTagName("blockquote");
// loop through all the blockquotes
  for (var i=0; i

    

What is the Document Object Model?

The W3C defines the DOM as:

A platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents.

It is an API that can be used to navigate HTML and XML documents.

Dom编程艺术2-充实文档内容_第3张图片
Paste_Image.png

你可能感兴趣的:(Dom编程艺术2-充实文档内容)