Jump to content


Photo

changing _parent's select options from _blank


  • Please log in to reply
1 reply to this topic

#1 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 01 June 2006 - 10:53 PM

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.
window.opener.location.reload(true); window.close();


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?

#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 03 June 2006 - 01:30 AM

ha! it took me 24 hours to figure it out, but it works...

page1:
<form blah blah...
<div id="testdiv"><select name="hellothere"><option value="1">1</option></select></div>
</form> ...blah blah

page2:
<script ...
window.opener.getElementById("testdiv").innerHTML = '<select name="hellothere"><option value="1">1</option><option value="2">2</option></select>';
window.close();
...

edit: fixed a bug I later discovered in firefox by using getElementById("testdiv") instead of just testdiv.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users