猿问

我有两个用途:1显示”文献来源链接表”2,显示“缩略语列表”。但是在web浏览器上就是不显示

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<link rel="stylesheet" media="screen" href="explanation.css">

</head>


<body>

<h1>What is the Document Object Model</h1>

<p>The<abbr title="World Wide Web Consortium" > W3C</abbr> defines the <abbr title="Document Object Model" >DOM </abbr> as:</p>

<blockquote cite="http://www.w3.org/DOM">

<p>

a platform-and language-netuaral interface that will allow programs and scripts.

</p>

</blockquote>

<p>

It is an<abbr title="Application Program Interface" > API </abbr>that can be used to nagitve <abbr title="HeyperText Markup Language" >HTML</abbr>

and<abbr title="eXtensible Markup Language"> XML</abbr>documentts.</p>


<script >

 function displayAbbreviations(){

if(!document.getElementsByTagName)return false;

if(!document.createElement) return false;

if(!document.createTextNode) return false;

var abbreviations=document.getElementsByTagName("abbr");

if(abbreviations.length<1) return false;

var defs=new Array();

for(i=0;i<abbreviations.length;i++){

var current_abbr=abbreviations[i];

if(current_abbr.childNodes.length<1) continue;

var definition=current_abbr.getAttribute("title");

var key=current_abbr.lastChild.nodeValue;

defs[key]=definition;

}

var dlist=document.createElement("dl");

for(key in defs){

var definition=defs[key];

var dtitle=document.createElement("dt");

var dtitle_txt=document.createTextNode(key);

dtitle.appendChild(dtitle_txt);

var ddesc=document.createElement("dd");

var ddesc_txt=document.createTextNode(definition);

ddesc.appendChild(ddesc_txt);

dlist.appengChild(dtitle);

dlist.appendChild(ddesc);

}

if(dlist.childNodes.length<1)return false;

var header=document.createElement("h2");

var header_txt=document.createTextNode("Abbreviations");

header.appendChild(header_txt);

document.body.appendChild(header);

document.body.appendChild(dlist);

}

     function displayCitations(){

if(!document.getElementsByTagName) return false;

if(!document.createElement) return false;

if(!document.createTextNode) return false;

var qo=document.getElementsByTagName("blockquote");

for(i=0;i<qo.length;i++){

if(!qo[i].getAttribute("cite")) continue;

var url=qo[i].getAttribute("cite");

var qoElements=qo[i].getElementsByTagName("*");

if(qoElements.length<1) continue;

var ele=qoElements[qoElements.length-1];

var lik=document.createElement("a");

var lik_txt=document.createTextNode("source");

lik.appendChild(lik_txt);

lik.setAttribute("href",url);

var supscript=document.createElement("sup");

supscript.appendChild(lik);

ele.appendChild(supscript);

}

}

function addLoadEvent(func){

var onload=window.onload;

if(typeof (window.onload) !='function'){

window.onload=func;

}else{

window.onload=function(){

onload();

func();

}

}

}// JavaScript Document

addLoadEvent(displayAbbreviations);

addLoadEvent(displayCitations)

// JavaScript Document

</script>

</body>

</html>

求各路大神指点一二!!!!

闯货的红灯3128172
浏览 1288回答 1
1回答

一瞬儿光

看这乱七八糟的格式就烦
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答