my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes Javascript called with some delay Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript called with some delay" Watch "Javascript called with some delay" New topic

Javascript called with some delay

Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 90

I hava an issue in my javascript function which is called from body onload of the window.
actualy inside the javascirpt, i am diabling the button, which is in centre of the window.
after i am displaying some list of images.
my problem is , the button disabled only after load the all images in bottom of the screen
i want to disable the button before full screen loaded.

anybody help me to solve this issue?

Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 466

Please post your JS funtion for us to help.

Vinod Tiwari | Twitter | Shikshanirman | Guftgu
Rob Crowther
Ranch Hand

Joined: Nov 06, 2012
Posts: 297

You need DOMContentLoaded instead of load. Or you could use jQuery $(document).ready() which will take care of compatibility with older browsers.

Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63544

If the button is to always be disabled upon load, why are you using JavaScript at all? Just mark the button as disabled in the markup.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Javascript called with some delay
It's not a secret anymore!