•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 422,602 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,644 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1282 | Replies: 1
![]() |
•
•
Join Date: Oct 2007
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
Hi everyone, I'm having problem with the sequence of execution for xml.onload. It works fine if your not passing parameters to onload event but my code needs to pass parameter to its function. I'm able to research ablut passing parameters for onload event.
However my problem is it only executes on the last instance of loading the XML.
I'm sure ur all pretty confused. I'll show some of the javascript code:
<script type="text/javascript">
var xmlDoc;
Load_XML("Organizations.xml", "organization_");
Load_XML("Restrictions.xml", "restrictions_");
Load_XML("Country.xml", "country_");
function Load_XML(XMLfilePath, Prop)
{ //IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.onreadystatechange = function ()
{
if (xmlDoc.readyState == 4)
{
displayDecoded_Value(Prop);
}
}
}
else if (document.implementation && document.implementation.createDocument)
{ //Firefox
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.onload = function (evt) { displayDecoded_Value(Prop); }
}
xmlDoc.load(XMLfilePath)
}
function displayDecoded_Value(prop)
{
//code here to decode the values, includes looping to the child nodes of the XML documents and assigning the matched value to a variable
}
I have here 3 instances to load the XML. Each XML is loaded, the DecodeValues function is used to decode the values based on the parameter passed.
In IE, the sequence of execution is that, First LoadXML is executed and calls on to the function LoadXML, then checks the browser used. If IE is used, the onreadystatechanged is executed and checks if it is equal to 4 and calls the DecodeValues function and loads the XML document. After executing the DecodeValues function, it goes back to execute the Second LoadXML. and so on. There's no problem here.
In Firefox, the sequence of execution is that, First LoadXML is executed and calls on to the function LoadXML, then checks the browser used. If Firefox is used, the onload event is called. In here I passed a parameter to the DecodeValues function. But the problem here is the DecodeValues function is only called at the last instance of LoadXML which is the Third LoadXML. So the only property that is decoded is the Third LoadXML, the country property.
Is my onload event syntax correct for Firefox???
Can anyone help me???
However my problem is it only executes on the last instance of loading the XML.
I'm sure ur all pretty confused. I'll show some of the javascript code:
<script type="text/javascript">
var xmlDoc;
Load_XML("Organizations.xml", "organization_");
Load_XML("Restrictions.xml", "restrictions_");
Load_XML("Country.xml", "country_");
function Load_XML(XMLfilePath, Prop)
{ //IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.onreadystatechange = function ()
{
if (xmlDoc.readyState == 4)
{
displayDecoded_Value(Prop);
}
}
}
else if (document.implementation && document.implementation.createDocument)
{ //Firefox
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.onload = function (evt) { displayDecoded_Value(Prop); }
}
xmlDoc.load(XMLfilePath)
}
function displayDecoded_Value(prop)
{
//code here to decode the values, includes looping to the child nodes of the XML documents and assigning the matched value to a variable
}
I have here 3 instances to load the XML. Each XML is loaded, the DecodeValues function is used to decode the values based on the parameter passed.
In IE, the sequence of execution is that, First LoadXML is executed and calls on to the function LoadXML, then checks the browser used. If IE is used, the onreadystatechanged is executed and checks if it is equal to 4 and calls the DecodeValues function and loads the XML document. After executing the DecodeValues function, it goes back to execute the Second LoadXML. and so on. There's no problem here.
In Firefox, the sequence of execution is that, First LoadXML is executed and calls on to the function LoadXML, then checks the browser used. If Firefox is used, the onload event is called. In here I passed a parameter to the DecodeValues function. But the problem here is the DecodeValues function is only called at the last instance of LoadXML which is the Third LoadXML. So the only property that is decoded is the Third LoadXML, the country property.
Is my onload event syntax correct for Firefox???
Can anyone help me???
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax asp beta bon browser browsers browsing cross-browser javascript menu with few lines of code developer development echo email encryption eu europe firefox gecko home html internet javascript javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator leak linux memory microsoft mozilla msdn networking news office open source open-source opera patch phishing prevent javascript menu from getting hidden under flash movies scams security site social software sql super testing users vista web webmail
- Previous Thread: DOM Node Manipulation
- Next Thread: Toggle between a Single Window with Options..



Linear Mode