Hi there,
I have a problem in FireFox, whereby a Javascript function only works if I make the first line of code an alert() statement.
If I take out the alert() statement, the following code doesn't work. Any ideas ?
The alert() statement I am talking about, is the first line of the setupPage() function
Many thanks in advance,
James
<script type="text/javascript">
var xmlDoc;
function loadXML()
{
//load xml file
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("master.xml");
setupPage();
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
alert('start Firefox code');
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("master.xml");
xmlDoc.onload=setupPage();
// alert('end Firefox code');
}
else
{
alert('Your browser cannot handle this script');
}
}
function setupPage()
{
alert('setuppage code'); <----- this is the alert statement that makes the code work
var x;
var y;
var z;
x = xmlDoc.getElementsByTagName("lead_recipient")[0].childNodes[0].nodeValue;
y = replaceChars(x);
document.myForm.recipient.value = y;
document.myForm.courtesy_our_email.value = y;
etc etc