| Author |
how to check if image is loaded or not
|
sreenivas shyamala
Greenhorn
Joined: Dec 29, 2008
Posts: 1
|
|
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
Joined: Nov 08, 2001
Posts: 15357
|
|
Eric
|
 |
Trilochan Bharadwaj
Ranch Hand
Joined: Feb 02, 2009
Posts: 100
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
Trilochan Bharadwaj wrote:
Except that addEventListener is not cross-browser.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Trilochan Bharadwaj
Ranch Hand
Joined: Feb 02, 2009
Posts: 100
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
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
Joined: Feb 02, 2009
Posts: 100
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
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
Joined: Feb 02, 2009
Posts: 100
|
|
Ah cool just what I was looking for, thanks!
trilochan.
|
 |
Trilochan Bharadwaj
Ranch Hand
Joined: Feb 02, 2009
Posts: 100
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
|
Great! Please be sure to leave any feedback for making the 2nd edition even better than the first on the books forum!
|
 |
 |
|
|
subject: how to check if image is loaded or not
|
|
|