michaellunsford Posted June 1, 2006 Share Posted June 1, 2006 I have a form that allows the user to change the options in a select box. I have an "edit" button right next to the box that opens a new window for the editing purpose. Once the change is complete, a simple script refreshes the parent page and closes the current one.[code]window.opener.location.reload(true); window.close();[/code] Problem is, they fill out the form then figure out they want to change the select box options. So, is there a way to replace the select options in the _parent window -- but not refresh the entire page? Quote Link to comment https://forums.phpfreaks.com/topic/10992-changing-_parents-select-options-from-_blank/ Share on other sites More sharing options...
michaellunsford Posted June 3, 2006 Author Share Posted June 3, 2006 ha! it took me 24 hours to figure it out, but it works...page1:[code]<form blah blah...<div id="testdiv"><select name="hellothere"><option value="1">1</option></select></div></form> ...blah blah[/code]page2:[code]<script ...window.opener.getElementById("testdiv").innerHTML = '<select name="hellothere"><option value="1">1</option><option value="2">2</option></select>';window.close();...[/code]edit: fixed a bug I later discovered in firefox by using getElementById("testdiv") instead of just testdiv. Quote Link to comment https://forums.phpfreaks.com/topic/10992-changing-_parents-select-options-from-_blank/#findComment-41341 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.