harshpandya Posted March 6, 2008 Share Posted March 6, 2008 How to check if some function has been executedHelpCode:function start(){ document.getElementById("div1").style.display = "block"; document.getElementById("div0").style.display = "none"; }//displays the popupfunction f(){If(start has been called){alert("hello");}So how do i check if start() has been executed or not??HelpThanks Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2008 Share Posted March 6, 2008 Initialize a global variable to false and set it to true inside the start function. If the variable is true then you know the function was executed. Link to comment Share on other sites More sharing options...
harshpandya Posted March 6, 2008 Author Share Posted March 6, 2008 Initialize a global variable to false and set it to true inside the start function. If the variable is true then you know the function was executed.Forgot to tell but the start Function is in PHP file and f() function is in another Javascript file So how should i do this NowThanks it was great idea though, Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted March 6, 2008 Share Posted March 6, 2008 Forgot to tell but the start Function is in PHP file and f() function is in another Javascript fileYeah, that's only a minor detail. Especially since the start function you posted above has Javascript code in it to access the DOM.Have PHP print out some Javascript code doing the same thing, first print some code that initializes a Javascript variable to one value, and then in the function print some code that sets the value to something else. You'll have to make sure you print out at least the start of the HTML document before doing any of that though, or else record it in PHP using the same method and print the results later on after you start the page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.