I am using the following code to fade a marquee, var objfade=document.getElementById("Marquee"+Btn); objfade.filters[0].apply(); objfade.style.visibility="hidden"; objfade.filters[0].play(); Code (markup): And it works fine, however after the fade I want to remove the marquee, document.body.removeChild(objfade); Code (markup): If I place this statement after the fade code it executes before the fade is done. If I create a loop to wait for fade, fade stops. The only exception to this is when I put an alert() in the loop then the fade continues while the alert is displayed. Is there anything else that I could put in loop that would have the same effect? Or is there an event generated by the fade that I could use to trigger function to remove the marquee?
Hello, Below URL May help U? http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm use setTimeout in your script.
Yeah, timeout won't work, in fact nothing will! Javascript is single threaded. If you do anything with Javascript all other processes are suspended, however I did find a solution. Do an AJAX call! In the code for the AJAX call I include the fade effect (I needed to do this call to update a file anyway). while the page is waiting on the xmlHttp Response the fade effect completes, when the xmlHttp Returns I do my deletion! works great!