sayedsohail Posted July 12, 2007 Share Posted July 12, 2007 Hi everyone, I am just wondering if anyone had come across something like alternate to using window.open. Please guide me if this is possible to use <div> element as an alternate to popup. At the moment i am using window.open which works perfectly fine. But just wondering if i can open a php file inside a div element i.e, i got a simple registration form with usual login name and password and submit button, which i wish to open inside a div element in the current window instead of using a popup window. I knew it is possible if i type the registration form within the current window and div element, than i can trigger style visibility= visible, which shows the registration form using z-index, but i want to separate out/branch out the form code in a external file and refer it inside the div. Please advise. Thanks Sayeed Quote Link to comment Share on other sites More sharing options...
SharkBait Posted July 12, 2007 Share Posted July 12, 2007 So you just want to open PHP script within a <div> tag? <?php echo "<div>"; require("myfile.php"); echo "</div>"; ?> Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted July 12, 2007 Author Share Posted July 12, 2007 thanks, as i mentioned earlier in the last paragraph "I knew it is possible if i type the registration form within the current window and div element, than i can trigger style visibility= visible, which shows the registration form using z-index, but i want to separate out/branch out the form code in a external file and refer it inside the div." Hope you got my point. What i am trying to achieve is to display the form/open the form.php file inside a div element without using iframes or typing directly echo "div"; ... Quote Link to comment Share on other sites More sharing options...
Philip Posted July 13, 2007 Share Posted July 13, 2007 Something like this: http://www.bookmarkmania.com/ajax/show_hide_div.html ? If yes, just look at the source code, let me know if you need an explanation. Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted July 13, 2007 Author Share Posted July 13, 2007 Yes something like this but, how do i dynamically include a php file/form inside div id=2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Show/Hide Div</title> <script language="JavaScript" type="text/javascript"> <!-- function toggleDiv(divId) { if(document.getElementById(divId).style.display=="") { document.getElementById(divId).style.display="none"; } else { document.getElementById(divId).style.display=""; } } //--> </script> </head> <body> <div id='1'> Div 1<br /><br /> Always show! </div> <a href="#" onclick="toggleDiv('2');">Click to show/hide</a> <div id="2" style='display:none'> Only show after clicking! </div> </body> </html> Quote Link to comment 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.