View Full Version : Disable link clicking until page loads

04-27-2004, 05:40 PM

I've been scouring the web for about the past hour looking for a script solution that will prevent clicking of any links until after the page fully loads up. Perhaps my Google skills are below par. ;)

Here's the deal. I use a product named RoboHelp HTML to create HTML Help files. This product has a really easy to use feature called a "DHTML Drop Down". Basically, you select the link text, click a button and add the text you want to appear when clicked, then click OK. RoboHelp handles inserting the code (stashing it in a hidden DIV) and has JavaScript behind the scenes to make the hidden DIV appear or disappear depending upon the state when the link is clicked upon. If you have inserted quite a few of these and the page is lengthy, the page may take a while to load up. If this is the case and a user clicks one of these links before the page loads completely, a JavaScript error is produced and prevents any of the other links from working until the page is reloaded. Hence my search for some scripting to prevent anything from occurring until the page is completely loaded.

Any pointers to existing scripts would be appreciated. Thus far, all I can seem to find are scripts that prevent right clicking or scripts that handle allowing only a single click of a form submit button.

Thanks in advance... Rick :)

04-27-2004, 05:48 PM
can only point you in the right direction:

suggestion number 1:
use the document.readyState method to determine if the page has finished loading, and if so then execute the rest of your script.

suggestion number 2:
put an transparent image at the end of document, and use the image.complete method to determine if it has loaded, and then execute the rest of your script.

these are only suggestions, however, and maybe not what you're looking for. basically, don't have the time to look into this properly ;)

04-27-2004, 06:41 PM

I've encountered a similar problem while using a Macromedia's Halo CSS page template with dynamic server side content.

Try manually moving the scripts to the top of the page under the <body> tag. That way the scripts are loaded before the links.

Simon (http://www.siondvorak.com)