为什么在IE下弹出窗口正常, 在FIREFOX下的弹出窗口什么也没有function createComments(postTitle)
{
//read the online tutorial http://www.idocs.com/tags/linking/linking_famsupp_120.html
//and complete the following code to create an empty popup window with name 'subpages'
//no toolbar and menubar, with scrollbar, resizable, width=400 and height=450)
var commentsWindow = window.open('','subpages', 'width=400,height=450,resizable=yes, scrollbars=yes');
commentsWindow.focus();
//The following lines shows that how IE built-in DOM parser applies to an XML file
//var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
var xml_doc = _loadXmlDocument("book.xml"); //xml_doc.async = false;
//xml_doc.load("book.xml");//var xml_doc=document.implementation.createDocument("","",null);
//xml_doc.async="false";
//xml_doc.loadXMLDoc("book.xml");
//Read the online tutorial, especially the W3C ones
//Now you need to get the list of elements 'subpages' from the xml file using the getElementsByTagName method
var subpages = xml_doc.getElementsByTagName("subpages");
//commentsWindow.document.write(postTitle);
//The following lines will go through each subpages element and write the text to the popup window in a table like format
//Read the online tutorial http://www.quirksmode.org/dom/intro.html to complete the required changes
for(i=0;i<subpages.length;i++)
{
var x=subpages[i].parentNode.childNodes[1].childNodes[0].nodeValue;
if(postTitle == x) // Only choose the subpages from the selected link
{
// Write the heading
commentsWindow.document.write("<head>");
commentsWindow.document.write("<title>");
commentsWindow.document.write(x);
commentsWindow.document.write("-subpages");
commentsWindow.document.write("</title>");
commentsWindow.document.write("</head>");
commentsWindow.document.write("<h1 align=center>Subpages</h1>"); for(j=0;j<subpages[i].childNodes.length;j++)
{
//commentsWindow.document.write(subpages[i].childNodes[j].childNodes[0].childNodes[0].nodeValue);
//var y=subtitle[i].childNodes[j].nodeValue;
commentsWindow.document.write("Title: ");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[0].childNodes[0].nodeValue);
commentsWindow.document.write("<br />");
commentsWindow.document.write("URL: ");
commentsWindow.document.write("<a href=");
//commentsWindow.document.write("'");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[1].childNodes[0].nodeValue);
//commentsWindow.document.write("'");
commentsWindow.document.write(">");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[1].childNodes[0].nodeValue);
commentsWindow.document.write("</a>");
commentsWindow.document.write("<br />");
commentsWindow.document.write("<br />");
//Display the content }
} }
commentsWindow.document.close();}
function _loadXmlDocument(xmlFilePath)
{
var _xmlDoc = null;
if (!window.DOMParser && window.ActiveXObject)
{
var xmlDomVersions = ['MSXML2.DOMDocument.6.0','MSXML2.DOMDocument.3.0','Microsoft.XMLDOM'];
for (var i = 0; i < xmlDomVersions.length; i++)
{
try
{
_xmlDoc = new ActiveXObject(xmlDomVersions[i]);
break;
}
catch(e){}
}
}
else if (document.implementation && document.implementation.createDocument)
{
try
{
_xmlDoc = document.implementation.createDocument('','',null);
}
catch(e){}
} if (_xmlDoc != null)
{
_xmlDoc.async = false;
_xmlDoc.load(xmlFilePath);
} return _xmlDoc;
}
{
//read the online tutorial http://www.idocs.com/tags/linking/linking_famsupp_120.html
//and complete the following code to create an empty popup window with name 'subpages'
//no toolbar and menubar, with scrollbar, resizable, width=400 and height=450)
var commentsWindow = window.open('','subpages', 'width=400,height=450,resizable=yes, scrollbars=yes');
commentsWindow.focus();
//The following lines shows that how IE built-in DOM parser applies to an XML file
//var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
var xml_doc = _loadXmlDocument("book.xml"); //xml_doc.async = false;
//xml_doc.load("book.xml");//var xml_doc=document.implementation.createDocument("","",null);
//xml_doc.async="false";
//xml_doc.loadXMLDoc("book.xml");
//Read the online tutorial, especially the W3C ones
//Now you need to get the list of elements 'subpages' from the xml file using the getElementsByTagName method
var subpages = xml_doc.getElementsByTagName("subpages");
//commentsWindow.document.write(postTitle);
//The following lines will go through each subpages element and write the text to the popup window in a table like format
//Read the online tutorial http://www.quirksmode.org/dom/intro.html to complete the required changes
for(i=0;i<subpages.length;i++)
{
var x=subpages[i].parentNode.childNodes[1].childNodes[0].nodeValue;
if(postTitle == x) // Only choose the subpages from the selected link
{
// Write the heading
commentsWindow.document.write("<head>");
commentsWindow.document.write("<title>");
commentsWindow.document.write(x);
commentsWindow.document.write("-subpages");
commentsWindow.document.write("</title>");
commentsWindow.document.write("</head>");
commentsWindow.document.write("<h1 align=center>Subpages</h1>"); for(j=0;j<subpages[i].childNodes.length;j++)
{
//commentsWindow.document.write(subpages[i].childNodes[j].childNodes[0].childNodes[0].nodeValue);
//var y=subtitle[i].childNodes[j].nodeValue;
commentsWindow.document.write("Title: ");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[0].childNodes[0].nodeValue);
commentsWindow.document.write("<br />");
commentsWindow.document.write("URL: ");
commentsWindow.document.write("<a href=");
//commentsWindow.document.write("'");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[1].childNodes[0].nodeValue);
//commentsWindow.document.write("'");
commentsWindow.document.write(">");
commentsWindow.document.write(subpages[i].childNodes[j].childNodes[1].childNodes[0].nodeValue);
commentsWindow.document.write("</a>");
commentsWindow.document.write("<br />");
commentsWindow.document.write("<br />");
//Display the content }
} }
commentsWindow.document.close();}
function _loadXmlDocument(xmlFilePath)
{
var _xmlDoc = null;
if (!window.DOMParser && window.ActiveXObject)
{
var xmlDomVersions = ['MSXML2.DOMDocument.6.0','MSXML2.DOMDocument.3.0','Microsoft.XMLDOM'];
for (var i = 0; i < xmlDomVersions.length; i++)
{
try
{
_xmlDoc = new ActiveXObject(xmlDomVersions[i]);
break;
}
catch(e){}
}
}
else if (document.implementation && document.implementation.createDocument)
{
try
{
_xmlDoc = document.implementation.createDocument('','',null);
}
catch(e){}
} if (_xmlDoc != null)
{
_xmlDoc.async = false;
_xmlDoc.load(xmlFilePath);
} return _xmlDoc;
}
http://templarkkziball.googlepages.com/display.xsl
http://templarkkziball.googlepages.com/book.xml
http://templarkkziball.googlepages.com/book.xsd