Link to home
Create AccountLog in
JavaScript

JavaScript

--

Questions

--

Followers

Top Experts

Avatar of John Gates, CISSP, CISM, CDPSE
John Gates, CISSP, CISM, CDPSE🇺🇸

Disable submit button script not resetting on page back in Mozilla Firefox
Why is the following script working ok in AOL browser IE and Netscape but not firefox?  The following code:

<SCRIPT language=JAVASCRIPT type=TEXT/JAVASCRIPT>
function submitonce()
{
var myform = document.form1;
if (document.all||document.getElementById) {
for (i=0;i<myform.length;i++) {
var tempobj=myform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true
}
}
else
return false
}
//-->
</SCRIPT>

Causes the submit button on a form to be greyed out.  If the user clicks back in IE, etc the buttton is clickable again but in Mozilla the button is still grey after the back operation.  Your thoughts?
-D-

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of RoonaanRoonaan🇳🇱

you can write a similar script to enable them and trigger that from body onload.

That should work for firefox certainly.

-r-

<html>
<script language="JavaScript1.2">
function mSubmit()
{
      var elmObj=document.getElementById("mSubit");
      elmObj.disabled=true;
}
</script>
<body>
<input type="Submit" id="mSubit" name="Submit" onclick="javascript:mSubmit()">
</body>
</html>


Try the above...

Avatar of John Gates, CISSP, CISM, CDPSEJohn Gates, CISSP, CISM, CDPSE🇺🇸

ASKER

It seems that this still is not reenabling the button if you javascript:back() 8(

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


ASKER CERTIFIED SOLUTION
Avatar of msunderpmsunderp

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account
JavaScript

JavaScript

--

Questions

--

Followers

Top Experts

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.