Jump to content

Search the Community

Showing results for tags 'setInterval'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 2 results

  1. I'm playing a video and while it is playing I'm using setInterval to search for a string every second. This is working perfectly. When I pause the video then I want the search loop to stop, but it's not stopping with the clearInterval command. What am I doing wrong here? I'm stumped. Thanks, Andrew // ------------ PLAY PAUSE ------------ function playPause() { if (vvid.paused) {vvid.play(); var vInterval = setInterval(function() { findWord(); }, 1000); findWord(jQuery('#findWord').val()); } else { vvid.pause(); clearInterval(vInterval); } }
  2. Good day, I appreciate that this is a popular query but I've been searching the web for answers and I've been unable to get my code to work. I'm trying to create the effect of an animated button on a website. I have a div which contains an <img/>. This image is the "animated button". I have already prepared the additional images to represent the following frames. Now, the JavaScript code I have (which I've pulled together looking at examples) is below. var navAniButton;var aniImgs;var imgAniTimer;var index;var maxImages; function updateVar() {navAniButton = document.getElementById("navAniButton");aniImgs = ["images/Frame1.png", "images/Frame2.png", "images/Frame3.png", "images/Frame4.png", "images/Frame5.png", "images/Frame6.png", "images/Frame7.png", "images/Frame8.png"];imgAniTimer = setInterval(changeAniImg(), 500);index = 0;maxImages = aniImgs.length - 1;} function changeAniImg() {var curAniImg = aniImgs[index];index = (index == maxImages) ? 0 : ++index;navAniButton.src =curAniImg;} The updateVar(); function is called in the body "onload" to update the global variables. When the page is loaded the image src is loaded correctly and then it appears that the JavaScript attempts to change the src, because the image changes to a cross (you know, as if it can't locate the file). But, I can't figure out why it does this. I've opened the debugger and, originally, it advised that the maxImages variable had not been defined. It hadn't. So, I amended that, but now I'm not receiving any errors in the console. I apologise if I've missed something extremely obvious or if I'm omitted something that would help you all out. Let me know if I can help at all.
×
×
  • Create New...