OnSubmit Waiting Image for Page Submit / Partial Refresh

Mindwatering Incorporated

Author: Tripp W Black

Created: 01/26/2016 at 05:45 PM


Notes Developer Tips

Use this function to put up an image at the beginning of an onSubmit event. This should help prevent double submits while users wait on a slow connection.

function onSubmitWait() {
imgwidth = document.body.clientWidth;
imgheight = document.body.clientHeight;
Hoffset = submitWaitImg.offsetHeight;
Woffset = submitWaitImg.offsetWidth;
submitWaitImg.style.left = (imgwidth-Woffset)/2;
submitWaitImg.style.top = (imgheight - Hoffset)/2;
submitWaitImg.visibility = 'visible';
submitWaitImg.display = 'block';
// change cursor
document.body.style.cursor = 'wait';
submitWaitImg.zIndex = '999';

previous page