Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: Suspending the flow of JS/ES execution Date: Thu, 12 Sep 2013 15:00:15 -0600 Lines: 162 Message-ID: References: <4fpYt.72772$wA2.68551@fx32.iad> X-Trace: individual.net wqbOsT8zls3AKcaOAnkJagTPvg0siyPqO0HfUj24v/37hKop8k Cancel-Lock: sha1:itSlRKqZ24uqbYnM0c+F4wqwUJA= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: csiph.com comp.lang.javascript:21304 Daniel said: > Unless MyNewAlert goes out of its way to do something asynchronously, > you've already got that. > > If that is the case, you'll need to rely on callbacks. > Hi Daniel: Below is the body of my new alert function called Alert() -- note the capitalized 'A' so I still have the regular alert() available. Also, I've been experimenting with setTimeout() and setInterval(and gotr deeper into trouble :( Hope you can suggest some code that will stop further execution until the new Alert() function is complete and the 'OK' button is clicked. btw, I don't *think* I went out of my way to do something asynchronously ... ??? Thanks, -Mel Smith ****** here's the code -- please don't throw up on it ******* var alertinit = false; // build new Alert on first call var alertinps,nalertinps,alertdisables ; function Alert(cmsg) { var i,alertobj,capobj,msgobj,okobj ; var inpobj ; alertinps = document.getElementsByTagName("input") ; nalertinps = alertinps.length ; alertdisables = [] ; for (i=0;i

' + '
' + '
' + ' ' + '
' var containobj = getobj("container") ; containobj.appendChild(alertdiv) ; alertinit = true; // use it from now on } alertobj = getobj("ialert") ; // now set the style for the main alert box alertobj.style.position = "absolute" ; alertobj.style.top = "30%" ; alertobj.style.left = "25%" ; alertobj.style.height = "40%" ; alertobj.style.width = "50%" ; alertobj.style.marginTop = "0px" ; alertobj.style.marginBottom = "0px" ; alertobj.style.padding = "0px" ; alertobj.style.zIndex = "1000" ; alertobj.style.overflow = "auto" ; alertobj.style.textAlign = "center" ; alertobj.style.color = "black" ; alertobj.style.background = "lightgray" ; alertobj.style.border = "2px solid black" ; // now set styling for the alert caption capobj = getobj("ialertcaption") ; capobj.style.position = "absolute" ; capobj.style.top = "0%" ; capobj.style.height = "12%" ; capobj.style.marginTop = "0px" ; capobj.style.marginBottom = "0px" ; capobj.style.padding = "0px" ; capobj.style.left = "0%" ; capobj.style.width = "100%" ; capobj.style.textAlign = "center" ; capobj.style.fontWeight = "bolder" ; capobj.style.textDecoration = "underline" ; capobj.style.color = "black" ; capobj.style.background = "yellow" ; capobj.innerHTML = " Please Read Message Below, then Click 'OK' " ; // now prepare and display the message msgobj = getobj("ialertmsg") ; msgobj.style.position = "absolute" ; msgobj.style.top = "20%" ; msgobj.style.left = "0%" ; msgobj.style.width = "100%" ; msgobj.style.marginTop = "0px" ; msgobj.style.marginBottom = "0px"; msgobj.style.padding = "0px"; msgobj.style.textAlign = "center" ; // re-format with
replacing '~' chars, etc cmsg = cmsg.replace(/~/g,"
") ; msgobj.innerHTML = cmsg ; // now place the 'OK' button a bit up from the bottom of my standard Alert Box okobj = getobj("ialertok") ; okobj.style.position = "absolute" ; okobj.style.bottom = "5%" ; okobj.style.left = "45%" ; okobj.style.width = "10%" ; okobj.style.marginTop = "0px" ; okobj.style.marginBottom = "0px"; okobj.style.padding = "0px"; okobj.style.textAlign = "center" ; alertobj.style.display="block" ; getobj("ialertokbutt").focus() ; // now somehow I have to stop execution flow past my alert box ??? } function AlertFin() { var i,j ; var lexit ; var nlendisables = alertdisables.length ; var alertobj = getobj("ialert") ; alertobj.style.display = "none" ; for (i=0;i 0 ) { for (j=0;j