I am using the following code to execute some statements after page load.
<script type="text/javascript">
window.onload = function () {
newInvite();
document.ag.src="b.jpg";
}
</script>
But this code is not working properly. The function is called even if some elements or images are loading. What I want is to call the function the page is loaded completely.