JavaScript - Refresh Parent Page After Popup Closes
Hello:
I have the following div popup window: PHP Code: <div id='PopUp' style='display: none; position: absolute; height: auto; left: 13px; top: 10px; border: solid black 1px; padding: 10px; background-color: rgb(255,255,225); opacity:.95; text-align: justify; font-size: 12px; width: 70%; z-index:1200;'> <iframe id="mate\" frameborder=0 scrolling=yes width=100% src='client_edit/edit_client_data.php?customerid=$customerid' height=\"790\" align=\"left\"></iframe><br /> <div valign=\"top\" style='text-align: right; display: inline; position: absolute; left: 10px; top: 10px;'><a onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('PopUp').style.display = 'none' \" ><span valign='left' style=\"text-decoration: underline;\" ><img border='0' src='images/the-delete.png' width='22' height='20' title='Close Window'></span></a> </div></div> the popup is opened from its parent page with the following onclick event: PHP Code: <a href="javascript:void(0)\" onmouseover=\"document.edit_info.src='images/edit-user-info2.png'\" onmouseout=\"document.edit_info.src='images/edit-user-info.png'\" onclick=\"document.getElementById('PopUp').style.display = 'block' \"><IMG SRC=\"images/edit-user-info.png\" NAME=\"edit_info\" width='40' height='40' title='Edit Customer Contacts' ALT=\"...\"></a> Now when the popup is closed, I would like the parent page to automatically refresh. I would appreciate some help on this. To close the popup, the following is invoked: PHP Code: <div valign="top\" style='text-align: right; display: inline; position: absolute; left: 10px; top: 10px;'><a onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('PopUp').style.display = 'none' \" ><span valign='left' style=\"text-decoration: underline;\" ><img border='0' src='images/the-delete.png' width='22' height='20' title='Close Window'></span></a> </div> Similar TutorialsHey guys, Been searching on google for two days now, without a valid answer. I'm NEW to javascript, so I need some good help on this haha. I am using the following little piece of code to open a popup window: Code: <SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'> <!-- var win=null; function NewWindow(mypage,myname,w,h,pos,infocus){ if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;} else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20} settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings); win.focus();} // --> </script> The actual link to open the popup is like this: Code: <a href="javascript:NewWindow('upload.php','popup','550','252','center','front');">Open the popup</a> What I am opening is, an upload page to upload an image (PHP / AJAX). Once the upload is complete and I close the window, I need the parent window (the index page which the link to open the popup is on) to be refreshed, so you can see that the file has been successfully uploaded. Does anyone have a clue how I would fix this? If I need to use another code to open the popup, that's fine, I just need help on how to fix this, since I haven't been able to find the answer myself. Thanks in advance! I'm using submodal-1.6 for popup. When the popup closes I wanted parent page to refresh.I've tried the following window.opener.location.load(); window.opener.location.load(true); location.load(); window.parent.location.reload(); All works for IE, but when coming to mozilla ,firefox the refresh is a step delayed, i.e when I open my popup to add an itme to my cart on parent page ,for the first time it does not show anything , but when I try to add another item , the first one shows. Any advice would be really great. Hello, and thanks for any help. I'm developing a site to include a map of schools (http://www.fcsoablues.net/map.asp). I'm creating hotspot links to googlemaps for each school (in a new browser window). I've got that much working okay. My problem is, I'd like to include popups for each hotspot that, on mouseover, show the name of the school. The popup should close on mouseoff. Without this, users only see the map full of school icons, and it's difficult to know which school is which. Ideally, the popup should follow the cursor (not a must, though). I've included the BODY of the code I'm using below. Code: <body> <img src="/FCSOA_IMAGES/Foothill-Citrus area map.jpg" width="1600" height="826" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="1169,166,1196,194" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=alta+loma+high+school&fb=1&gl=us&hq=alta+loma+high+school&hnear=0x80c32def799fa121:0x5209947000caa933,Pomona,+CA&ei=6x40T_WtDMaU2AXbtPnzAQ&sa=X&oi=local_group&ct=image&ved=0CAgQtgM&iwloc=cids:11113758998891877583" target="_new" alt="Alta Loma High School" /> <area shape="rect" coords="776,299,803,324" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=claremont+high+school&fb=1&gl=us&hq=claremont+high+school&hnear=claremont+high+school&cid=0,0,7887364383841814220&ei=Mh80T-LLBanm2QX4s72RAg&sa=X&oi=local_result&ct=image&ved=0CA8Q_BI" target="_new" alt="Claremont High School" /> <area shape="rect" coords="523,262,548,289" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=San+Dimas+High+School&fb=1&gl=us&hq=San+Dimas+High+School&hnear=San+Dimas+High+School&cid=0,0,9099100455580750144&ei=Wx80T7X9D6O-2gXU9YGeAg&sa=X&oi=local_result&ct=image&ved=0CA8Q_BI" target="_new" alt="San Dimas High School" /> </map> </body> hi there. i have a classic asp page that is using the winhttprequest object to get the contents of website from a different server. Then i modify the html i get to suit my needs.. save it to a file, and then finally, i display this stuff in an IFRAME. (i wrapped a div tag around the iframe so technically, i'm doing something like: "divtabframe.innerHTML = '<IFRAME SRC='myserver/somepage.html'></IFRAME>) My problem is that when i refresh the main page, i want the iframe to also display the latest data. It does get the latest data from the external site and its saved in "somepage.html". But the iframe isn't updated unless i explicitly right-click inside the frame and manually select refresh. I have added a <meta http-equiv="refresh" content="30"> line to make it auto refresh on it's own. But the users find it annoying that the page refreshes while they're reading it. It would be ideal if when they refresh the main page, the iframe gets updated too. or i could create a new button too... as long as both pages are updated i did find this solution on a different website: document.getElementById(FrameID).contentDocument.location.reload(true); My page inside the iframe is ultimately "local" so it sounds like the above code should work, but i'm not sure what event would be best to trigger this javascript... and i still need a way to refresh the main page too. thanks. Hi I wanted to control parent page form popup. For example, I have a page: http://www.cmela.com/zz.php When i open a popup by clicking "Click Here to open popup page" and then on popup window, i wanted it to transfer parent page from making a click on a pop up window. Example is at: http://www.cmela.com/zz.php open pop up window, and then by clicking on a link on a pop up window i wanted my parent page to go to www.msn.com any help? Thanks Hello, I had a php page, which contains links when I click on a link it will issue a new page, I want to make the main page to be refreshed once the new page being closed. Any suggestions? thanks Hello everyone, I have a page. In that page is an iframe, lets name it 'A'. inside A there is another iframe 'B'. there is a link on that page which on click opens a popup. In that pop up, there is actually a document upload facility. Now i want that after every upload (onSubmit), iframe A should refresh. have done it many times but today its not working. Code: function validate() { (window.parent.opener.location.href)=(window.parent.opener.location.href); window.parent.opener.location.reload(true);// this is tried as well } Can some one please help. it always refreshes only B. Thanks Alright I have an Iframe, and at the end of that Iframe I have set a variable with JS to be equal to TRUE, indicating that the page has run through the script. I then check that the iframe from the parent window for that variable, if it has not been set yet (or does not equal true) it reloads the iframe. The code works fine FF and Opera. However in IE it does not reload the frame if it is not true, and in Chrome it alerts undefined and does not reload the frame. I have tried accessing the frame through the dom and it did not work for me, and i have also tried simply adding a tail to the iframes source with no success. PHP Code: <iframe name="ifrOne" src="iframe.htm" id="ifrOne"></iframe> <script type="text/javascript"> function frameLoad() { var testOne = window.ifrOne.test_var; if(testOne !== "TRUE") { alert(testOne); document.getElementById('ifrOne').contentDocument.location.reload(true); window.frames['ifrOne'].location.reload(true); } } </script> Hello, First post here. I have the need to create a popup after a delay. The problem I'm getting is that the parent page is refreshing automatically from the action of creating the popup. I don't want the parent page to refresh! This is what I currently have: Code: $popupScript = ' <script language="JavaScript"> setTimeout("window.open(\'index.php?do=renew\',\'Popup1\',\'toolbar=0, width=500, height=500\')",' . $delay . '); </script>'; The page is in php, so that's why I have it as a string, which I later pass to a template page. This would simply be: Code: <script language="JavaScript"> setTimeout("window.open('index.php?do=renew','Popup1','toolbar=0, width=500, height=500')",6000); </script> ... if it was placed straight into the HTML. Incidentally, it's included into the HTML HEAD area, not the body, as the original source of the script suggested: http://www.itechies.net/tutorials/js...op-delayed.htm $delay is the delay before the popup opens, in microseconds (so 6000 would be 6 seconds). What can I do to have the same delayed auto-popup functionality, but without it automatically refreshing the parent page where the above code resides? As some background to what I'm achieving: The issue with not wanting the parent page to refresh is that each time it does, the login session gets extended. The popup itself (which I already have working ok) provides a 'continue working' function, or close and refresh the parent is nothing has been done after a short period. Any help very welcome. I have a popup window which display a list of values in a tabular form. I have no problem to do the popup or display the table. The table has two columns; one is the "code" and the other is the "description". When a row is highlighted and the "SELECT" button in the popup window is clicked, I am supposed to pass the "code" of the highlighted row back to an input textfield in the parent window. And I am struggling with it. Would anybody kindly help? I want to implement a javascript function where a submit button will be submitted from the parent page each time I close a child page. Please let me know what I did wrong in my code and please elaborate your answer so that I could understand it better. Thank you so much for your help. I have the following jscript code but it is now working. Code: window.onunload = submitParent; function submitParent() { var doc = window.opener.document, theForm = doc.getElementById("finalForm"); theField = doc.getElementById("finalSelected"); theForm.submit(); theField.trigger('click'); } My form from the parent page is as follow. I want my jscript to just click on the submit button once. Code: <form id = "finalForm "name= "finalForm" method="POST" action=""> <input type="Submit" id = "finalSelected" name="finalSelected"/> I can't seem to figure out what I am doing wrong. When you click the photo the script opens and then closes and never shows the slide show. Test site : http://www.royalraves.com/test/html/pets.html Blackbox.css Code: #lightbox{ position: absolute; top: 0px; left: 0; width: 100%; z-index: 100; text-align: center; } #lightbox a img{ border: none; } #outerImageContainer{ position: relative; background-color: #f7f6f1; width: 250px; height: 250px; margin: 0 auto; border: 1px #CCC solid; border-bottom:0px; } #imageContainer{ padding: 10px; } #loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; } #hoverNav{ position: absolute; top: 0; left: 0; height: 0px; width: 0px; z-index: 0; } #imageContainer>#hoverNav{ left: 0;} #hoverNav a{ outline: none;} #prevLink, #nextLink{ width: 49%; height: 100%; background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */ display: block; } #prevLink { left: 0; float: left; } #nextLink { right: 0; float: right; } #prevLink2, #nextLink2 { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color:#000; font-weight:bold; cursor:pointer; } #imageDataContainer{ font: 14px Arial, Helvetica, sans-serif; background-color: #f7f6f1; height: 35px; border:1px #ccc solid; border-top:0px; margin:auto; } #imageData{ padding:0px 10px 10px 10px; } #imageData #imageDetails{ width: 50%; float: left; text-align: left; } #imageData #caption{ font-weight: bold; font-size:11px; color:#666; max-height:20px; } #imageData #numberDisplay{ display: block; clear: left; font-weight: normal; font-size:14px; color:#333; padding-bottom: 5px; } #imageData #slideshowLink{ width: 55px; float: right; padding:5px 0px 0 0px;} #imageData #bottomNavClose{ width: 55px; float: right; padding:5px 0px 0 0px; } #overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; } .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } * html>body .clearfix { display: inline; width: 100%; } * html .clearfix { /* Hides from IE-mac \*/ height: 1%; /* End hide from IE-mac */ } In Head: Code: <!--- JS Code for album ---> <link rel="stylesheet" href="backbox.css" type="text/css" /> <script type="text/javascript" src="js/prototype.compressed.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> <script type="text/javascript" src="js/dhtmlHistory.js"></script> <script type="text/javascript" src="js/customsignsheader.js"></script> Code: For the album: <!--- Album Code for Pets ---> <div onclick="dhtmlHistory.add('location1',{message: 'backbox'});countdown()"> <a href="images/pets/7.jpg" rel="lightbox[slide]" caption="Benjamin"> <img src="images/pets/7.jpg" alt="Benjamin" width="250" height="180" border="0" /></a> </div> <a href="images/pets/1.jpg" rel="lightbox[slide]" caption="Benjamin"></a> <a href="images/pets/2.jpg" rel="lightbox[slide]" caption="Cat TV"></a> <a href="images/pets/3.jpg" rel="lightbox[slide]" caption="Hamie"></a> <a href="images/pets/4.jpg" rel="lightbox[slide]" caption="Sun Spot"></a> <a href="images/pets/5.jpg" rel="lightbox[slide]" caption="Kita"></a> <a href="images/pets/6.jpg" rel="lightbox[slide]" caption="Paws to you"></a> <a href="images/pets/7.jpg" rel="lightbox[slide]" caption="Sun Spot"></a> <a href="images/pets/8.jpg" rel="lightbox[slide]" caption="Yard Work"></a> <a href="images/pets/9.jpg" rel="lightbox[slide]" caption="Yes"></a> <a href="images/pets/10.jpg" rel="lightbox[slide]" caption="Best of Buds"></a> </center> </div> <!--- End of Album Code---> ... but only in $%&/$ IE... you can see the parent page dropdowns when the page loads, but when the iframe loads it appears to overwrite the parent page completely... works fine in Chrome and FF. Here's the page EDIT: sorted. appears I had to clear the floats, or something i have a page named pck_rates.php which contains a form that go to the page update_pck_rates.php when i press updade data button in the second page i want the first page to be refreshed to show the new data's. i want to know if i can set a name to the page pck_rates.php and after the update query in the second page i will refresh the pck_rates.php page using this name?? i don't know what is the function and how to make this idea. can anyone help me please <HEAD><TITLE>main</TITLE> <meta http-equiv="refresh" content="5;url=http://localhost/php_basic/short_pro/php/main.php"> <!--<script language="JavaScript"> var i=0; function validat() { setTimeout("moretext()",5000); alert("santosh"); } function moretext() { if(i==0) { alert(window.location); window.location.reload(); i++; } else { } } </script>--> </head> <BODY onload="validat();"> i hav written dis code to auto refresh page only once but it is refreshing after every 5 seconds. Earlier i hav wriiten meta tag but it is refreshing page after every 5 seconds & after that i hav wriiten script to auto reffresh page only once but they both r doin the same work,so can u plz help me in solvin my problem Hi, For the last few day's i've been searching for a js/ajax div refresh. I need a js/ajax script that refresh a div every 10 seconds or gets menu.php file and updates it. Thanks. Is this possible? I am writing a script that will display an alert box that reads "your play was saved" after a user clicks the submit button on a form. The only problem is that after clicking save, the page refreshes. Here is the code I tried to use Code: function savedMessage(){ document.getElementById("CmdFinish").addEventListener("click",function(e) { GM_setValue("Saved", 1); }, false); if (GM_getValue("saved", 0) == 1) { alert("Your play has been saved"); GM_setValue("saved", 0); // or GM_deleteValue("saved"); } } The button ID is "CmdFinish" and the value is "saved". Is there ANY way i can make the script run only on a page refresh? **Note** The script is for a specific page and not the whole site, so it wont run on every refresh on the site, only when it's needed on 1 page. Is it possible to change the URL when a page refreshes? E.G Someone clicks a link on index.php to page1.php. When you refresh page1.php it actually loads page2.php The reason i ask my site uses AJAX to change pages (therefore doesnt refresh and stays on the index.php page). So if someone has followed 3-4 links and refreshes the page it will go back to the homepage, i want it so it reloads the currently page (i can use query strings to get the relevant page) How can I write a JavaScript for the following requirement. I have to go to a link say
Quote: www.google.com and refresh it for every 5 seconds continuously. Thanks |