Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling function from function WEIRD RESULTS
    primarykey
    data
    text
    <p>I was trying to show a text gradually on the screen (like marquee). e.g. H.. He.. Hell.. Hello. when I'm tracing it in debug in VS2010 it's working! but when it's actually running it shows the whole sentence at once.</p> <p>I made a certain "delay" for about 3 seconds between each letter so it would suppose to take a while, but in reality it's shows everything immediately.</p> <p>Who's the genius to solve this mystery? (please don't give me advices how to create the marquee effect, it's not the issue anymore. now it's just a WAR between me and javascript!) I'm assuming that it has to do with synchronization when calling function from function? </p> <p>Thanks to whomever will help me get my sanity back.</p> <p>you can download the code from here (VS project): <a href="http://pcgroup.co.il/downloads/misc/function_from_function.zip" rel="nofollow">http://pcgroup.co.il/downloads/misc/function_from_function.zip</a></p> <p>or view it here:</p> <pre><code> &lt;body&gt; &lt;script type="text/javascript"&gt; //trying to display this source sentence letter by letter: var source = "hi javascript why are you being such a pain"; var target = ""; var pos = 0; var mayGoOn = false; //this function calls another function which suppose to "build" the sentence increasing index using the global var pos (it's even working when following it in debug) function textticker() { if (pos &lt; source.length) { flash(); if (mayGoOn == true) { pos++; mayGoOn = false; document.write(target); textticker(); } } } function flash() { //I tried to put returns everywhere assuming that this may solve it probably one of them in not necessary but it doesn't solve it if (mayGoOn == true) { return; } while (true) { var d = new Date(); if (d.getSeconds() % 3 == 0) { //alert('this suppose to happen only in about every 3 seconds'); target = source.substring(0, pos); mayGoOn = true; return; } } } textticker(); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload