www.webdeveloper.com
Results 1 to 7 of 7

Thread: setTimeout / Opera problems

  1. #1
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138

    setTimeout / Opera problems

    Hi,
    I have a simple script to change the page after a certain time. It works fine in Netscape, IE, Safari and Firefox, but not Opera.

    function startTimer() { timer = setTimeout("redirect()", 16000) }

    function redirect() {
    parent.content.location="main.html";
    and so on for other frames...
    }

    and startTime is called using an onload within an img tag.

    Any ideas? Or can Opera just not do it?!

    Derek

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Move your onload event to the body and see if it works. Opera might not support "onload" in the IMG element. (I don't even think "onload" is in the specification for the IMG tag, some browsers probably just decided to implement it.)
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  3. #3
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138
    Hmm...

    I put it in an IMG tag because it's animated GIF - I want to forward the page once the GIF has played through once.

    Is there any way of linking it to the GIF (ie. call the function once the GIF has loaded, not the page), yet placing it in the body?

  4. #4
    Join Date
    Oct 2004
    Posts
    1,118
    Try to figure out if it is a setTimeout() problem or an onload problem. There are some old articels you can google that say Opera doesn't support onload for an image.
    Last edited by 7stud; 03-16-2005 at 04:19 AM.

  5. #5
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138
    It's the 'onload' Opera doesn't like (works fine with 'onclick').

    Any ideas folks?

  6. #6
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    try adding your onload function to the very bottom of the page, that way it has to load before it runs it.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  7. #7
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138
    That seems to do the job!

    I can't tell yet for sure if it only starts after the image is loaded until I upload the site, but thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles