Preventing users 'Pressing Buttons' before the page has loaded
ok heres a real quick one - I got asked this question just last week so whilst its real simple I felt it worthwhile to share with you.
The problem: You have a complex page that can take a little loading and you have an impatient user who wants to click what they can asap.
On your page/form - whatever - place the following as near to the top as possible:
<script>
var pageloaded=false
</script>
At the top of your onload script insert the following:
pageloaded=true
Then whereever you have a function call from a button/link etc surround your code like so:
function buttonclick(){
if(pageloaded){
alert('Button has been clicked')
}
Thats all there is to it -simple but effective if your application/site suffers from this.
Questions? - steve.castledine@projectdx.org