I have two divs,


<input id="dragTest" name="dragTest" type="text" />

<div id="div1" class="div1" onclick="ObjectClick(this);">
</div>

<div id="div2" class="div2" onclick="ObjectClick(this);">
</div>

And a function:



<script type="text/javascript">

function ObjectClick(object)
{
//object.onmousedown = testFunction(object);
object.onmousedown = function()
{
var textBox = document.getElementById("dragTest");
textBox.value = object.id;
};
}

</script>

What it does is,it puts in a textbox the name of the div wihch has been clicked
The thing is, that it doesn&#180;t work first time I click. Only the second I click on the div. That goes for both div1, and div2,.. then after that it works fine,..

Why could it be?
Thanks