How can I make an in page pop-up?

Javascript pop-up and refresh underlying page

  • Hello there readers! I am trying to make the following thing work: I have a page on which i have a fixed arrival and departure date. At the moment i want to change my dates on this page a new window pops-up on which i fill in my new arrival and departure dates. At the moment i submit the new values in this popup i want to refresh the undelying page (from which i called the pop-up). How do i do this? to see the example pages that i mean click here first: (to set a cookie with dates): http://new.hotels.nl/cgi-bin/searchav.pl?plaats=Amsterdam&numpers=2&arrday=17&arrmonth=9&arryear=2002&depday=20&depmonth=9&depyear=2002 then click on this link: (to go to a working hotel page) http://new.hotels.nl/amsterdam/novotel/ on this page you can click on 1 of the arrival or departure links in the room window. The thing that i am trying to solve is that after clicking submit in the pop-up the underlying page has got to be refreshed...... Thanks for your input guys / gals ! Kees Eldering

  • Answer:

    Hello, kees!: I think this is what you are looking for, here is the sample code, be careful when copying and pasting with word wrapping: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> <!-- function MM_openBrWindow(divname,winName,features,curvalue) { //v2.0 w=window.open('',winName,features); w.document.write('<form name="form1" method="post" action="">'); w.document.write('<input type="text" name="textfield" value="'+curvalue+'"><br>'); w.document.write('<input type="button" value="Press here" onClick="window.opener.document.getElementById(\''+divname+'\').innerHTML=form1.textfield.value; window.close();">'); w.document.write('</form>'); w.document.close(); } //--> </script> </head> <body bgcolor="#FFFFFF" text="#000000"> <table width="400" border="2" cellspacing="0" cellpadding="0"> <tr> <td><a href="javascript:MM_openBrWindow('text1','popup','width=200,height=100',document.getElementById('text1').innerHTML)">Arrival</a> </td> <td><div id="text1">This is a text to test</div></td> </tr> <tr> <td><a href="javascript:MM_openBrWindow('text2','popup','width=200,height=100',document.getElementById('text2').innerHTML)">Departure</a></td> <td><div id="text2">This is a second text to test</div></td> </tr> </table> <p>&nbsp;</p> </body> </html> How it works?, it's really easy, the links call a javacript function called MM_openBrWindow: function MM_openBrWindow(divname,winName,features,curvalue) { //v2.0 w=window.open('',winName,features); w.document.write('<form name="form1" method="post" action="">'); w.document.write('<input type="text" name="textfield" value="'+curvalue+'"><br>'); w.document.write('<input type="button" value="Press here" onClick="window.opener.document.getElementById(\''+divname+'\').innerHTML=form1.textfield.value; window.close();">'); w.document.write('</form>'); w.document.close(); } The first parameter is the name of the div tag which holds the text to be edited, the second is the name of the new window, the third, the features of the window (border, status, etc) and the fourth is the current value for the div tag. This function, creates a new window and writes a simple form inside it, with an input field and a button. When the button is pressed, it changes the div.innerHTML property to be the same as the textfield and closes the window. I think you can easily adapt it to fit your needs, but don't hesitate to request for any help! ;-) I have tested it on IE and Mozilla, and it works well, but if you want something else just ask, we are here to help you- Regards.

kees-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.