Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to check if image is loaded or not

 
sreenivas shyamala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to get book covers from amazon,librarything,openlibrary through webservice by giving isbn number...am getting book covers..but i have to check if amazon image is loaded or not..if amazon image is not available i have to go check librarything image..n i have to wait until image is loaded..only after loading image i have to check next image...
how do i do it using javascript...
can anyone give me solution...thanks in advance...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Eric
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way would be:



Within your js code, rather than referencing it on HTML element itself ... but the solution provided by other poster also works.

Trilochan
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trilochan Bharadwaj wrote:

Except that addEventListener is not cross-browser.
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cross-browser event handling

I can't haggle on which approach is better because I am newbie myself, But If you have some time, you should do a look up on Event Model of W3C and google on "Non Obtrusive javascripting"
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Being a newbie, I'd highly recommend looking into a library such as jQuery that make cross-browser things like events and Ajax a breeze.

P.S. Please do not post in all uppercase. I have fixed it for you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trilochan Bharadwaj wrote:But If you have some time, you should do a look up on Event Model of W3C and google on "Non Obtrusive javascripting"

To whom is this addressed?

You'll not find me arguing again Unobtrusive JavaScript; in fact, I wrote a book on it (with respect to jQuery).
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted that tag to demonstrate how it cranks me up sometimes when we do things like <body onload="my entire script comes here, so have fun debugging this"></body> or something like that ... All I wanted to show this guy was, there are ways of doing this in a cross browser way and not stick onEvent stuff with js function calls ... I didn't intend to throw it out at you, I apologize if that caused you any concerns. No disrespect

I <3 JQuery! its such a sweet framework (I was a stickler for Dojo for a while, until I got hooked to JQuery, I am still learning it however ... ). What book are we talking about? I wanna get reference under my belt for JQuery, havent found anything handy except for documentation yet.


Trilochan.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trilochan Bharadwaj wrote:I posted that tag to demonstrate how it cranks me up ....

No one said you did anything wrong; I merely pointed out that the posted code was not cross-browser as that's important for any readers to know.

What book are we talking about? I wanna get reference under my belt for JQuery, havent found anything handy except for documentation yet.

jQuery in Action
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah cool just what I was looking for, thanks!

trilochan.
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Bear,

Thanks for the book link, I just got me a MEAP of second Ed. weee hee to JQuery!


Trilochan.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! Please be sure to leave any feedback for making the 2nd edition even better than the first on the books forum!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic