Jump to content

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?
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.