Member_2_241474
asked on
Target frame in parent with link from child?
I want to pop up a child dialog window from link on parent frameA. When user clicks link on child, close child and display linked URL in parent frameB.
I would like to do this with a modal child, but I can live with modeless if the function also closes the window.
It seems like this should be easy, but I can't find a solution.
I would like to do this with a modal child, but I can live with modeless if the function also closes the window.
It seems like this should be easy, but I can't find a solution.
ok... i think i recreated your situation and got it to do what you want. let me know if this is not the case:
in the asp page for frameA:
<span onClick="window.showModalD ialog('Chi ldWithLink .asp', window.parent.frames['main ']);">link </span>
in the asp page for the child modal:
<script language="javascript">
function closeWin() {
if (window.dialogArguments && dialogArguments.location) {
dialogArguments.location.h ref = "new.asp";
window.close();
}
}
</script>
<body>
<input type=button value=close onClick="closeWin();">
</body>
in this example main is the name of framesetB and new.asp is the new file to display in framesetB
basically, i am passing the target frame as a parameter to the modal so I can set its target from there.
hope this helps!!
Jason
in the asp page for frameA:
<span onClick="window.showModalD
in the asp page for the child modal:
<script language="javascript">
function closeWin() {
if (window.dialogArguments && dialogArguments.location) {
dialogArguments.location.h
window.close();
}
}
</script>
<body>
<input type=button value=close onClick="closeWin();">
</body>
in this example main is the name of framesetB and new.asp is the new file to display in framesetB
basically, i am passing the target frame as a parameter to the modal so I can set its target from there.
hope this helps!!
Jason
please update your question (did this work?)
Jason your idea did not work for me....
so i recreated it...
page1.asp
<html>
<head>
<script>
function fnCallDialog()
{ showModelessDialog('ChildW ithLink.as p',window, "status:fa lse;dialog Width:300p x;dialogHe ight:300px ");
}
</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=f nCallDialo g();">link </a>
</body>
</html>
ChildWithLink.asp
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h ref = page;
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a href="javascript:;" onClick="closeWin('new.asp ');">this is a link to new.asp</a>
<br />
<br />
<a href="javascript:;" onClick="closeWin('page1.a sp');">thi s is a link to page1.asp</a>
</body>
</html>
new.asp
<html>
<head>
</head>
<body>
new.asp
</body>
</html>
Try that and please let us know...
Good luck!
BRUNO
so i recreated it...
page1.asp
<html>
<head>
<script>
function fnCallDialog()
{ showModelessDialog('ChildW
}
</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=f
</body>
</html>
ChildWithLink.asp
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a href="javascript:;" onClick="closeWin('new.asp
<br />
<br />
<a href="javascript:;" onClick="closeWin('page1.a
</body>
</html>
new.asp
<html>
<head>
</head>
<body>
new.asp
</body>
</html>
Try that and please let us know...
Good luck!
BRUNO
After further look, I neglected the frameset part. Also the same code that works fine on my machine causes errors on other machines.
This should be fixable by changing the second page...
ChildWithLink.asp
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h ref = page;
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a onClick="closeWin('new.asp ');">this is a link to new.asp</a>
<br />
<br />
<a onClick="closeWin('page1.a sp');">thi s is a link to page1.asp</a>
</body>
</html>
Sorry!
BRUNO
This should be fixable by changing the second page...
ChildWithLink.asp
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a onClick="closeWin('new.asp
<br />
<br />
<a onClick="closeWin('page1.a
</body>
</html>
Sorry!
BRUNO
ASKER
Jason, sorry for the delay in acknowleddging your response. I went on vacation and did not even look at a crt or lcd!
Thanks to both Bruno and Jason. But I can't get either solution to work. I tried a number of different combinations. The last version (below) opens the url in the Link fram instead of Main.
Here's what I have:
========================== ========== =
START.HTM - The frameset definition
-------------------------- ----------
HTML><HEAD></HEAD>
<FRAMESET ROWS="64px,*" Border=0>
<NOFRAME>You must use a browser that can display frames to see this page.</NOFRAME>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Link"
NORESIZE
SCROLLING="NO"
SRC="MenuLink.asp"
>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Main"
NORESIZE
SCROLLING="NO"
SRC="Main.htm"
>
</FRAMESET>
</HTML>
========================== ========== =
ChildWithLink.asp - the modal popup
-------------------------- ---------- -
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h ref = page;
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a href="javascript:;" onClick="closeWin('new.asp ');">this is a link to new.asp</a>
<br />
<br />
<a href="javascript:;" onClick="closeWin('page1.a sp');">thi s is a link to page1.asp</a>
</body>
</html>
========================== ==========
Page1.asp, new.asp, main.htm - just
to show something -
-------------------------- ---------
<html>
<head>
</head>
<body>
MAIN (or NEW or Page1)
</body>
</html>
Thanks to both Bruno and Jason. But I can't get either solution to work. I tried a number of different combinations. The last version (below) opens the url in the Link fram instead of Main.
Here's what I have:
==========================
START.HTM - The frameset definition
--------------------------
HTML><HEAD></HEAD>
<FRAMESET ROWS="64px,*" Border=0>
<NOFRAME>You must use a browser that can display frames to see this page.</NOFRAME>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Link"
NORESIZE
SCROLLING="NO"
SRC="MenuLink.asp"
>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Main"
NORESIZE
SCROLLING="NO"
SRC="Main.htm"
>
</FRAMESET>
</HTML>
==========================
ChildWithLink.asp - the modal popup
--------------------------
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a href="javascript:;" onClick="closeWin('new.asp
<br />
<br />
<a href="javascript:;" onClick="closeWin('page1.a
</body>
</html>
==========================
Page1.asp, new.asp, main.htm - just
to show something -
--------------------------
<html>
<head>
</head>
<body>
MAIN (or NEW or Page1)
</body>
</html>
jriggin,
I would be happy to email you the files... I have it working in my local directory....that way you can throw them in and modify as necessary
jason
I would be happy to email you the files... I have it working in my local directory....that way you can throw them in and modify as necessary
jason
ok let's try this again, using your frameset....
start.asp
-----------------
<HTML><HEAD></HEAD>
<FRAMESET ROWS="64px,*" Border=0>
<NOFRAME>You must use a browser that can display frames to see this page.</NOFRAME>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Link"
NORESIZE
SCROLLING="NO"
SRC="MenuLink.asp"
>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Main"
NORESIZE
SCROLLING="NO"
SRC="new.asp"
>
</FRAMESET>
</HTML>
MenuLink.asp
------------------------
<html>
<head>
<script>
function fnCallDialog()
{ showModelessDialog('ChildW ithLink.as p',window. parent.fra mes['Main' ],"status: false;dial ogWidth:30 0px;dialog Height:300 px");
}
</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=f nCallDialo g();">link </a>
</body>
</html>
ChildWithLink.asp
----------------
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h ref = page;
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a onClick="closeWin('new1.as p');">this is a link to new1.asp</a>
<br />
<br />
<a onClick="closeWin('MenuLin k.asp');"> this is a link to MenuLink.asp</a>
</body>
</html>
new.asp
-------------------
<html>
<head>
</head>
<body>
new.asp
</body>
</html>
new1.asp
--------------------
<html>
<head>
</head>
<body>
new1.asp
</body>
</html>
try those combination of files, things should be just as you want them.
Good Luck!
BRUNO
start.asp
-----------------
<HTML><HEAD></HEAD>
<FRAMESET ROWS="64px,*" Border=0>
<NOFRAME>You must use a browser that can display frames to see this page.</NOFRAME>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Link"
NORESIZE
SCROLLING="NO"
SRC="MenuLink.asp"
>
<FRAME
FRAMEBORDER="NO"
MARGINHEIGHT="0"
MARGINWIDTH="0"
NAME="Main"
NORESIZE
SCROLLING="NO"
SRC="new.asp"
>
</FRAMESET>
</HTML>
MenuLink.asp
------------------------
<html>
<head>
<script>
function fnCallDialog()
{ showModelessDialog('ChildW
}
</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=f
</body>
</html>
ChildWithLink.asp
----------------
<html>
<head>
<script language="javascript">
function closeWin(page)
{
if (window.dialogArguments && dialogArguments.location)
{
dialogArguments.location.h
window.close();
}
}
</script>
</head>
<body>
<br />
<br />
<a onClick="closeWin('new1.as
<br />
<br />
<a onClick="closeWin('MenuLin
</body>
</html>
new.asp
-------------------
<html>
<head>
</head>
<body>
new.asp
</body>
</html>
new1.asp
--------------------
<html>
<head>
</head>
<body>
new1.asp
</body>
</html>
try those combination of files, things should be just as you want them.
Good Luck!
BRUNO
ASKER
Thanks - this does the deed!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry - I thought I accepted this last time.
no problem....thanks for coming back and cleaning this up!
BRUNO
BRUNO
ASKER
window.showModalDialog("Ch