baksanyprobby
New Member
again as always, thanks for your time. this is driving me crazy.Note: at no point do i want the page to refresh.I have a form then a loading bar image then a linked button. the main page starts off with just a form and a submit buttonWhat i would like to do is when the form is submitted the whole \[code\]div\[/code\](1)& its inside and its contents to disappears, then simultaneously a new \[code\]div\[/code\](2) in its place, appears with a \[code\]loading.gif\[/code\] image and the \[code\]submitted entry\[/code\], then after 5 secinds this div disappears and in its place another \[code\]div\[/code\](3) with a \[code\]button\[/code\] link and text inside appears\[code\]div1\[/code\]: shows form till button click, \[code\]div2\[/code\]: then loading image for 5 secs\[code\]div3\[/code\]: link and text stays visible My code as is (nothing hides with it and divs are showin when there not meant to be) \[code\] <html> <head> <script type="text/javascript"> function countdown() { var i = document.getElementById('counter'); if (parseInt(i.innerHTML)<=0) { location.href = 'http://stackoverflow.com/questions/15675260/#'; clearInterval(t); exit; } i.innerHTML = parseInt(i.innerHTML)-1; } var t = setInterval(function(){ countdown(); },1000); </script> </head> <body> <!--1. Show until submit then hide --> <div id="div1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> Answer: <input type="Text" Name="info" required> <input type="Submit" value="http://stackoverflow.com/questions/15675260/Send"> </form> </div> <!--2. Show for 5 seconds on submit then hide --> <div id="div2"> <?php if (count($_POST) > 0 && isset($_POST["info"])){ // add First and Second Numbers $sum = $_POST["info"]; // their Answer is diplayed echo " Your answer $sum". "<br />"; echo '<img src="http://i.imgur.com/nh9eh0c.gif" border=0>'. "<br />"; echo ' Submiting answer in <span id="counter"> 5</span>' . "<br />"; // after 5 secounds this hides and is replace with a button link and the text "thank you" } ?> </div> <!--3. Show after 5 seconds above then nothing --> <div id="div3"> <?php echo 'Back home'. "<br />"; echo '<a href="https://www.google.co.nz/"><img src="http://www.skeletonsthemovie.com/images/home-button-large.png" border=0></a>'; ?> </div> </body> </html>\[/code\]Hope this isn't to confusing it was quite hard to word properly.. any help would be amazing !