newbtophp Posted July 18, 2009 Share Posted July 18, 2009 Can someone help me please? I have a form which on submit it shows a div, the problem is it shows the div for less then a second then returns back to its normal state and hides. Heres the javascript: <script language="javascript"> function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "show"; } else { ele.style.display = "block"; text.innerHTML = "hide"; } } </script> Heres the snippet from the form: <input name="submit" type="submit" value="Submit" onclick="javascript:toggle();"><BR> Heres the div (im trying to show when the form is submitted): <div id="toggleText" style="display: none"><iframe src="yell.php" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe></div> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/166451-solved-onclick-show-div/ Share on other sites More sharing options...
nadeemshafi9 Posted July 19, 2009 Share Posted July 19, 2009 dose your form submission reload the page ? Quote Link to comment https://forums.phpfreaks.com/topic/166451-solved-onclick-show-div/#findComment-877799 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.