I have select list which submits the page and the page is then re-rendered with various fields hidden depending on the value of the select list. There is a button at the top of the page which is causing problems if it is pressed before the page is fully rendered.

Is there a way in javascript that I can on press of the button I can tell if the page is fully rendered?

Or is there a better way to do this?

p.s we don't use jquery but do use prototype.

Thanks

Dougal.

Thanks for the link but still don't quite get how to tell on an onclick of a button whether or not the page is loaded.

You can set a variable to 0 at the start of your page, and to 1 when the page has loaded. On the click of your button, check this variable.

Thanks.

last question - where would I set the variable in? I do not want it to be an item on my page.

Okay, then disable the button when the page starts, and enable it when the page is done loading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.