Hi guys I have been having trouble with this for days now. The code below paused for 2000ms using setTimeout in IE and return to the location specified. It works well in IE but loops forever in Firefox, does any of you know what could be going on, please help many thanks tldmic <script type="text/javascript"> function validate(form) { if(form.subject.value == "") { document.write("Please submit!!"); setTimeout("document.location.href='test.php'",2000); return false; } return true; } </script> <form action='test.php' method='post' onsubmit="return validate(this)"> <h3 class='post_header'>Message Post: </h3> <span class='post_title'> Message Title : <input type='text' name='subject' size='20'> </span> <p> <input type='submit' name='submit' value="submit"> </div> </form>
Why would you do that? Don't reload your page. Just add "Please add a subject" next to the subject input box and .focus() to the message title.
Hi, thanks very much, I do not know how to do the .focus() thing, can you please advice, thank you again
http://pastebin.com/raw.php?i=Zz3C7f86 You should not use <p> to make a linebreak, that is what <br> is for. Additionally, use <label> instead of h3/h2.
Hi, thanks a lot, I have made a huge research and discovered that there is bug existing in firefox for setTimeout not to function. I am not yet a guru in programming, but from the internet research, no one was able to give functioning answer. I have tried your proposal still nothing happens, what you told me only affects the css or html side not the client side like js. however, I have manipulated the results to work in a reverse and it seems to be working,but it's a long process. perhaps if you do not mind, provide me with a sample code that works in both IE and FX using setTimeout function. Your help does help me a lot to open my eyes to different angle thank you again