My goal is to disable "Login" button in my form, and also to show an animated GIF spinner
when a user begins submitting it either after a click on the "Login" button or after hitting the Enter key on the keyboard.
My HTML looks as such:
<form method="POST" action="login.php" autocomplete="off" id="frmLogin">
<!-- other content -->
<input type="submit" value="Login" id="btnLogin" onClick="onLoginClkd();">
<img src="images/spnr.gif" id="imgSpnr"
style="width: 16px; height: 16px; visibility: hidden;">
</form>
<script language="javascript">
function onLoginClkd()
{
var img_obj = document.getElementById("imgSpnr");
var btn_obj = document.getElementById("btnLogin");
if(img_obj != undefined)
img_obj.style.visibility = "visible";
if(btn_obj != undefined)
btn_obj.disabled = true;
var frm_obj = document.getElementById("frmLogin");
if(frm_obj != undefined)
frm_obj.submit();
}
</script>
This works just fine in Chrome and Firefox browsers, but in IE the spinner is displayed but it does not animate, or spin.
Any idea how to adjust it to make it work under IE?
PS. I'm testing it in the latest version of IE, whatever is available in Windows 8.1
PS2. I can't create a fiddle to illustrate this because I won't be able to imitate "stalling" php page that refuses to load immediately. And doing it via JavaScript in HTML does not reproduce the issue. I'm just hoping that someone else witnessed the same behavior.