Load javascript code after loading code behind
<p>I have a web site released at facebook platform, i am using C# .Net 2008, the problem is that i am loading an array elements from code behind in javascript arary and i am loading elelment element using the following javascript code :</p>

<pre><code>ArList = new Array('&lt;%=ListOfWords[0]%&gt;','&lt;%=ListOfWords[1]%&gt;','&lt;%=ListOfWords[2]%&gt;','&lt;%=ListOfWords[2]%&gt;');
</code></pre>

<p>the problem that when i call an element from the array as follows :</p>

<pre><code>document.getElementById("WordDiv").innerHTML = ArList [0];
</code></pre>

<p>The element is not set with the value inspite the array in the code behind has values and i don't know why the value of the array element is not set ? and in some cases i found it loaded with value and everything go right so may be it's a problem in rendering so the value of code behind is not seen in client side ? or where is the problem come ?
and when i traced the application in IE i found the status bar report a javascript error then disappered and say done and when the yellow allert appears in the status bar i have clicked it and noticed the message says : object expected.</p>

<p>The problem now is that in onload event of the body tag i call a function in the javascript that intialize the javascript array with values from code behind array and the problem is that in some cases the function is not entered as i traced it by putting an alert in the begining of the function and i found that when the javascript array is not filled the code of the function is not entered as the alert is not showed so i don't know how to force the DOM to enter this function which i call it in the  tag here sample of the code:
javascript code:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
     &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
     &lt;head runat="server"&gt;         
     &lt;/head&gt;
     &lt;body onload="IntializeArr(); return false;"&gt;
     &lt;form id="form1" runat="server" &gt;
     ..........Some Controls...............
    &lt;/form&gt;
    &lt;script type="text/javascript" language="javascript"&gt; 
    var TList;
    var BList;
       function IntializeArr()
     {       
        TList = new Array('&lt;%=ListofT[0]%&gt;','&lt;%=ListofT[1]%&gt;','&lt;%=ListofT[2]%&gt;','&lt;%=ListofT[3]%&gt;','&lt;%=ListofT[4]%&gt;','&lt;%=ListofT[5]%&gt;','&lt;%=ListofT[6]%&gt;','&lt;%=ListofT[7]%&gt;','&lt;%=ListofT[8]%&gt;','&lt;%=ListofT[9]%&gt;');
        BList = new Array('&lt;%=ListOfB[0]%&gt;','&lt;%=ListOfB[1]%&gt;','&lt;%=ListOfB[2]%&gt;','&lt;%=ListOfB[3]%&gt;','&lt;%=ListOfB[4]%&gt;','&lt;%=ListOfB[5]%&gt;','&lt;%=ListOfB[6]%&gt;','&lt;%=ListOfB[7]%&gt;','&lt;%=ListOfB[8]%&gt;','&lt;%=ListOfB[9]%&gt;');        
     }
    &lt;/script&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>C# Code :</p>

<pre><code>public string[] ListOfB = new string[15];
public string[] ListofT = new string[15];
</code></pre>

<p>And the code behind array is filled from data returned from database and they are filled i have traced them and each time and they are filled and i found that the problem from javascript i don't know if it is from facebook platform or from my code but i think that it is not from my code as the problem that i call a function in the onload of the tag  and the function is not entered and this is the problem so can any one help me please</p>

<p>Hope that i will find a solution as i got depressed </p>
