javascript pass element from one function to another
<p>this is a partial code:</p>

<pre><code>function readXmlUsingXPath(i,guid, xpath) {
    var xmlDoc = loadXML("gameFeed.aspx?guid=" + guid);
    if (xmlDoc == null) { document.getElementById(guid).innerHTML = "UPDATING"; return }
    else { };
    i.innerHTML = xmlDoc.selectNodes(xpath)[0].text;
}

window.onload = function () {
    for (var i = 0; i &lt; document.getElementsByTagName('jackpot').length; i++) {
        var guid = document.getElementsByTagName('jackpot')[i].getAttribute('data-g').split('|')[0];
        var xpath = document.getElementsByTagName('jackpot')[i].getAttribute('data-g').split('|')[1];
        readXmlUsingXPath(document.getElementsByTagName('jackpot')[i],guid, xpath);
    }
}
</code></pre>

<p>basicly, what i want to do is pass the element from the onload function, to the readXmlUsingXpath function, so i could change it.
but i get an unknown runtime error...</p>

<p>as asked, some sample html:</p>

<pre><code>&lt;li&gt;
&lt;a href="/gamepath/"&gt;&lt;span&gt;gameTitle&lt;/span&gt;
&lt;span&gt;&lt;jackpot data-g="&lt;%=game.Guid %&gt;|&lt;%=game.GamingProperties.JackpotFeedXpath %&gt;"&gt;UPDATING . . .&lt;/jackpot&gt;&lt;/span&gt;
&lt;/a&gt;
&lt;/li&gt;
</code></pre>
