Solved

Target frame in parent with link from child?

Posted on 2001-06-08
12
669 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:jriggin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 1

Author Comment

by:jriggin
ID: 6168839
Child window opened with
window.showModalDialog("ChildWithLink.asp", "_blank")
0
 

Expert Comment

by:JCsomay
ID: 6169159
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.showModalDialog('ChildWithLink.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.href = "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
0
 

Expert Comment

by:JCsomay
ID: 6181633
please update your question (did this work?)
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 18

Expert Comment

by:bruno
ID: 6181964
Jason your idea did not work for me....

so i recreated it...



page1.asp

<html>
<head>
<script>
function fnCallDialog()                                            
{ showModelessDialog('ChildWithLink.asp',window,"status:false;dialogWidth:300px;dialogHeight:300px");
}
</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=fnCallDialog();">link</a>
</body>
</html>




ChildWithLink.asp

<html>
<head>
<script language="javascript">
function closeWin(page)
     {
     if (window.dialogArguments && dialogArguments.location)
          {
             dialogArguments.location.href = 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.asp');">this 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
0
 
LVL 18

Expert Comment

by:bruno
ID: 6182059
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.href = 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.asp');">this is a link to page1.asp</a>
</body>
</html>


Sorry!

BRUNO
0
 
LVL 1

Author Comment

by:jriggin
ID: 6182797
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.href = 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.asp');">this 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>

0
 

Expert Comment

by:JCsomay
ID: 6182819
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
0
 
LVL 18

Expert Comment

by:bruno
ID: 6182851
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('ChildWithLink.asp',window.parent.frames['Main'],"status:false;dialogWidth:300px;dialogHeight:300px");
}

</script>
</head>
<body>
in the asp page for frameA:
<br />
<a href="javascript:onClick=fnCallDialog();">link</a>
</body>
</html>


ChildWithLink.asp
----------------
<html>
<head>
<script language="javascript">
function closeWin(page)
     {
     if (window.dialogArguments && dialogArguments.location)
          {
             dialogArguments.location.href = page;
             window.close();  
           }
     }
</script>
</head>
<body>
<br />
<br />
<a onClick="closeWin('new1.asp');">this is a link to new1.asp</a>
<br />
<br />
<a onClick="closeWin('MenuLink.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
0
 
LVL 1

Author Comment

by:jriggin
ID: 6203176
Thanks - this does the deed!
0
 
LVL 18

Accepted Solution

by:
bruno earned 200 total points
ID: 6203893
jriggin,

Thanks for coming back and updating the question, please accept either one of mine or JCsomay's answers, whichever you feel helped you the most.

Keep in mind I took the majority of my code from his original post...  :-)


BRUNO
0
 
LVL 1

Author Comment

by:jriggin
ID: 6228245
Sorry - I thought I accepted this last time.
0
 
LVL 18

Expert Comment

by:bruno
ID: 6228254
no problem....thanks for coming back and cleaning this up!

BRUNO
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question