My example above is a button type input, but it should just submit normally if you use the onclick code in a submit type input. So, in other words, <input type="submit" /> instead of <input type="button" />.
Another way is to put it in the <form> tag's onsubmit attribute: <form onsubmit="form.button_that_needs_to_be_disabled.disabled=1;">.
Hey, what I want is after you click a submit (form) button, that submit button gets disabled, so you can't click it again. This is extremely helpful with browser games for example.
I know it's possible, I've seen it on another site. On that site, the button turns grey after clicking it once.
I've looked around, but didn't really find something. I've also looked at the source of that site, but couldn't really find something, except this: <script language=JavaScript> function disable() { document.replier.submit.disabled = true; return true; } </script>
Then is a part of my form: <form action=test.php name=replier method=post onsubmit=\"return disable()\">