74 users online (1 members and 73 guests)  


  Results 1 to 15 of 15

Related

  1. Put an image over the top of something?    Forum: Myspace Forum
    Replies: 3
  2. Replies: 3
  3. Replies: 3
  4. image    Forum: Graphics Forum
    Replies: 1
  5. How do I swap an image for BOTH an image and a sound?    Forum: Website Scripts Forum
    Replies: 1
  1. #1
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8

    Need Help! Image from another source displays if first image errors...

    Basically, I have a webcam on my website. And what I want to do is have a Webcam Offline image to display when it's not online. To put in a img of the current capture from the webcam, all i have to do is use a normal img tag, only have it point to my IP (img src="ip"). When the webcam is offline, it errors and gives the little red X. Now, I know this exists because I've used it before, and I lost the code. I remember it being OnError="" or something like that... if anyone can help, please do

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    This script may be of help...may not

    let me know
    http://socsci.uwosh.edu/campage.htm#Script

  3. #3
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    no, that's not what I need. I know that all you do is add a simple code to the end of the <img> tag, something like <img src="12.250.***.***" OnError="offline.jpg">

    its something like OnError= but im not sure

  4. #4
    Doorknob's Avatar
    Super Newbie

    Status
    Offline
    Join Date
    Jun 2002
    Location
    Malaysia
    Posts
    316
    if anyone finds out, reply here please. i would like to know too

  5. #5
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    This only works on browsers with good DOM -

    Code:
    <script language="JavaScript">
          function ImageLoadFailed() {
            window.event.srcElement.src = "http://www.quietdean.com/images/quietdeanlogo2.jpg";
          }
        </script>
    
    
    <img src="badger.jpg" id="stoat" onError="ImageLoadFailed();">
    The function is just to make life eaiser, it came from -

    http://www.developerfusion.com/show/1608/
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  6. #6
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    Thats it!!! Thanks so much!

  7. #7
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    wait... it doesnt work... whenever i put it on a server (it works fine when i open the .html file locally) it just keeps trying to load it then IE errors saying "Stack Overflow"

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Dyu wanna post your version here so we can see?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    IE version? 6.0.2

  10. #10
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Sorry, i meant your version of the script.

    The error from IE will happen if there is an error.

    Its looping, when you get an error (like, the file does not exist) it calls the function. If the function also errors, then it calls itself and loops. This will call a stack error.

    So, post your code, lets see where the error is.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  11. #11
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    sorry, im a noob...



    Code:
    <script language="JavaScript">
          function ImageLoadFailed() {
            window.event.srcElement.src = "offline.gif";
          }
        </script>
    
    
    <img src="http://12.250.21.142:8080/cam_1.jpg" id="stoat" onError="ImageLoadFailed();">

  12. #12
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    your not a noob, I didnt make myself clear.

    Also, where is this script hosted? as in web address?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  13. #13
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    http://66.30.50.0/ech/webcam.html

    (it might freeze IE)

  14. #14
    ECH2005's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    8
    heh, i found out what the problem is... for some reason it doesnt like .gifs... jpegs work fine... hrm, thats odd

    http://66.30.50.0/ech/webcam2.html

    anyone know WHY this is?

  15. #15
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Both links just worked fine for me . Odd.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread