Javascript function does not get passed paramrter
<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&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;



&lt;script language="javascript" type="text/javascript"&gt;

(function setFont() {
var i;
for ( i = 0; i &lt; document.all.length; i++) {
document.all[i].style.fontFamily = "Verdana";
document.all[i].style.fontSize = "16";
document.all[i].style.color="black";
}
})();

(function abc(a)
{
alert(a);
ansArray = ['a'];  
for(i=1;i&lt;=a;i++)
{ 
document.write('&lt;input type = "button" value = "a"&gt;');
document.write('&lt;input type = "button" value = "b"&gt;');
}
var myButton = document.getElementsByTagName("input");
//alert(myButton.length);
myButton[0].onclick = function() {
    if(ansArray[0] == 'a')
        myButton[0].style.backgroundColor = "green";
    else
        myButton[0].style.backgroundColor = "red";
};

myButton[1].onclick = function() {
    if(ansArray[0] == 'b')
        myButton[1].style.backgroundColor = "green";
    else
        myButton[1].style.backgroundColor = "red";
};
})();
setFont();
&lt;/script&gt;
&lt;/head&gt;

&lt;body onload="abc(2)"&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>A javascript function abc(a) does not get the value 2 passed from <code>&lt;body onload = "abc(5)"&gt;</code>. It says undefined. How to pass the parameters in a javascript function. I have posted it earlier as well but the parameter was not there, on giveing the parameter i found the problem.Please help me. Thanks in advance</p>
