I need help getting the file to run in Firefox: I have tried adapting scripts so that my file runs in both IE and Firefox but so far it still only works in IE. (The file can be tested at http://www.eyle.org/crosstest.html - simply type the word Mike in the text box using IE (doesn't work in Firefox).The HTML document is:
<!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>Untitled Document</title>
<script type="text/javascript">
var xmlDoc;
//loads xml using either IE or firefox
function loadXmlDoc()
{
//test for IE
if(window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load("books2.xml");
}
//test for Firefox
else if(document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("","",null);
xmlDoc.load("books2.xml");
}
//if neither
else
{
document.write("xml file did not load");
}
}
//window.onload = loadXmlDoc();
var subject;
//getDetails adds value of txtField to var subject in outputgroup(subject)
function getDetails()
{
//either this or window.onload = loadXmlDoc is needed
loadXmlDoc();
var subject = document.getElementById("txtField1").value;
function outputgroup(subject)
{
var xslt = new ActiveXObject("Msxml2.XSLTemplate");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var xslProc;
xslDoc.async = false;
xslDoc.resolveExternals = false;
xslDoc.load("contains3books.xsl");
xslt.stylesheet = xslDoc;
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.addParameter("subj", subject);
xslProc.transform();
document.write(xslProc.output);
}
outputgroup(subject);
}
</script>
</head>
<body>
<input type="text" id="txtField1">
<input type="submit" onClick="getDetails(); return false">
</body>
</html>
The file includes books2.xml and contains3books.xsl (I have put the code for these files at ...ww.eyle.org/books2.xml ...ww.eyle.org/contains3books.xsl) (NB: replace ...ww. with http: // www)