delay the execution of a js function
<p>I wrote a function to display an image in the center of the box. However, when the image is loaded, it comes with some default style including position information. Calling the center image function is essentially happening at the same time as image loading, but it finishes before image is fully loaded. This cause the side effect of center image function to be overritten by the default style of the image, and as a result the image is not placed in the center of the box. </p>

<p>I am wondering if I could delay the execution of center image function to solve this. Any one tell me how to delay the execution of a js function? thanks a lot.</p>
