Javascript Setinterval Works But Not Infinite Loop June 12, 2024 Post a Comment I don't understand why the infinite loop does not work but uncommenting the function call works. Solution 1: When you use setInterval you keep adding the function you are calling to the queue of things for the browser to do. Repaint events are also added to this queue. When you use an infinite loop, the browser never gets to the end of the function, so it never gets around to running a repaint and the image in the document never updates.Solution 2: JavaScript-in-a-browser is a part of a larger construction. You need to align to the rules of this construction and don't hurt it. One of the rule is that your JavaScript must run quick and exit then. Exit means that control gets back to the framework, which does all the job, repaint the screen etc. Try to hide and show something many times:Baca JugaChrome Cuts Off Parts Of Type On The Left, Firefox And Ie Display Fine. Chrome Bug?How To Include A Php File In A Html File Via A Php ScriptCross Browser Issue : Document.getelementbyid().value Not Working In Ie But Works In Firefoxfor (n = 0; n < 200; n++) { $("#test").hide(); $("#test").show(); } CopyWhen this code runs, you won't see any flickering, you will see that the last command will have effect.Have to say, it's not easy to organize code that way, if you want to make a cycle which paints nice anims on a canvas, you have to do it without while. Share You may like these postsHow To Search A Spreadsheet Using Google Visualization Query - Based On Mulitple Search CriteriaHow Do You Load 2 Javascript Files That Could Have Common Variables Between Them And Accessing It On A Html Page?Searching Columns Html TableChange Colour Of Fixed Text Based On Underlaying Colours Post a Comment for "Javascript Setinterval Works But Not Infinite Loop"
Post a Comment for "Javascript Setinterval Works But Not Infinite Loop"