Jump to content


This topic is now archived and is closed to further replies.


changing _parent's select options from _blank

Recommended Posts

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?

Share this post

Link to post
Share on other sites
ha! it took me 24 hours to figure it out, but it works...

[code]<form blah blah...
<div id="testdiv"><select name="hellothere"><option value="1">1</option></select></div>
</form> ...blah blah[/code]

[code]<script ...
window.opener.getElementById("testdiv").innerHTML = '<select name="hellothere"><option value="1">1</option><option value="2">2</option></select>';

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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.