Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Can this be done in Javascript?
Old 12-21-2004, 08:55 PM Can this be done in Javascript?
Junior Talker

Posts: 3
Location: So Cal
Trades: 0
I have an image hosted online that I want to display on a web page, but if the server the image is hosted on is down, then I want a different image (hosted on a different server) to appear in its place.

Can this be done with Javascript, maybe using the if statement? If yes, then how?

I know html and can do all the img tags, but I only know a little Javascript.
Thanks
jasekasp is offline
Reply With Quote
View Public Profile Visit jasekasp's homepage!
 
 
Register now for full access!
Old 12-22-2004, 06:18 AM
sdcdesign.co.uk's Avatar
Extreme Talker

Posts: 198
Location: High Wycombe, Buckinghamshire, London
Trades: 0
Hi,

To my knowledge so far, i've never come across a way to detect if a server is down in javascript. A colleague of mine did it once but it was extensive asp.net using Tcp.IP protocols!


So, i think the answer is no, your better off trying to see if there is a pre-made script in php or asp.net or something along those lines.

However, i might be completely mistaken!

Good Luck,


Sean
__________________
[ Insert witty, yet highly intelligent signature here ]
sdcdesign.co.uk is offline
Reply With Quote
View Public Profile Visit sdcdesign.co.uk's homepage!
 
Old 12-23-2004, 02:56 PM
Rufo's Avatar
Extreme Talker

Posts: 173
Trades: 0
You could probably use a hidden IMG tag, which has its SRC attribute set to the remote image.
Javascript could then be used to check whether the IMG's onLoad event was fired within a certain period of time (eg. 3 seconds).
If it had not loaded, you could assume that the server was down, and set the SRC attribute to an alternate image using javascript.

Rufo.
__________________

Please login or register to view this content. Registration is FREE
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Reply     « Reply to Can this be done in Javascript?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60892 seconds with 12 queries