Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking windows

Status
Not open for further replies.
Aug 18, 2003
111
GB
I have a page with address contacts on it, when you click the hyperlink i want the details to appear in a new window in a form for editing. Also once the form has been edited i want the window to close and the original page to refresh and show the changed contact.

I've created the to pages, when i click the hyperlink it opens up the windows with the data in it but the original page goes blank. Also once i've edited the window page and submit the original screen opens within the window.

I know my problem is with windows and targets. Can anyone direct me to some help.

How do i target a different window?

Cheers
Pete

If it ain't broke, don't fix it!
 
like W3C does? I think they do that with ASP..

______________________________________________________________________________
"The sluggard does not plow after the season, so he begs during the harvest and has nothing."
-[Proverbs 20:4]


 
I'm not sure if this will help you, but I'll put it out there anyway. You can interact with a window if you know the handle of it. For child windows, you must create a handle like so:
Code:
HWND = window.open("somepage.htm");
Now you can manipulate the window directly using it's handle, HWND like so:
Code:
HWND.execScript("alert('Hi')");
HWND.close();
The child window can manipulate the parent window like so:
Code:
window.opener.execScript("alert('Hey')");
If you already know this and I'm stating the obvious, my bad :)
 
if the above doesnt help post your code and let us look at it, may be more than just targeting a window...reminder, most people block pop-ups, might want to do so in the page it's self, it would be easier, or you could just use SQL and PHP and give the user their own account...

just some options

______________________________________________________________________________
"The sluggard does not plow after the season, so he begs during the harvest and has nothing."
-[Proverbs 20:4]


 
here is my code to open up the window, which it does except that the first page displays a blank screen.

<a href="javascript: window.open('contacts.cfm?edit=#findcontact.recno#','NewWin','toolbar=no,status=no,width=400,height=300')">Edit</a>




Also when the form is complete i do this to get back to the first screen

window.location.focus()
window.close('contacts.cfm')

but i can't refresh the page to show changes. how can i move focus and reload page?


Cheers
Pete

If it ain't broke, don't fix it!
 
As far as I know, the window.close method takes no paramaters, so you can change this:

Code:
window.close('contacts.cfm')

to read this:

Code:
window.close();

And if you're about to close the window anyway, this step is fairly pointless:

Code:
window.location.focus()

so you should be able to remove it altogether.

Hope this helps,
Dan
 
thanks

but how do reload my original page to so it displays my changes

Cheers
Pete

If it ain't broke, don't fix it!
 

You can use

Code:
window.opener.document.getElemenyById('someId')

to refer to elements in the opener window. Using this, you could run an update function before closing the popup window to update any content necessary in the opener window.

You also have the option of going server-side (useful if you're doing a shopping cart, etc), going one step further and submitting a form in the opener window after populating its values.

Hope this gives you some food for thought!

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top