Solved

link in a showModalDialog in the same window

Posted on 2002-07-02
11
385 Views
Last Modified: 2012-06-21
I need a returnvalue from a showModalDialog. This dialog has some links, which should open in the same ModalDialogWindow, but they don´t they always open in a new browser window. How can I keep everything in just one Window?
0
Comment
Question by:brausy
[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
  • 2
11 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 7124788
try

<script>
name="mymodal"
</script>

<a href="..." target="mymodal"

or
<a href="..." target="_self"

Michel
0
 

Expert Comment

by:ipis
ID: 7124928
you can't open links in a modalDialog - all requests from it are sent to the opener.
You could try this:
1. target the links to a hidden iframe in the main window
2. take the innerHTML of the document.body of the hidden iframe
3. replace the innerHTML of the modalDialog.

Ivan
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 7126178
<script>
window.name="mymodal"
</script>

<a href="test2.htm" target="mymodal">Test2</a>

Works!!
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:brausy
ID: 7126454
mplungian, your answer does not work. I tried the thing with the iframe, but got stuck could you be a little more precise, as I am not a professional in javascript
0
 

Author Comment

by:brausy
ID: 7126488
mplungian, your answer does not work. I tried the thing with the iframe, but got stuck could you be a little more precise, as I am not a professional in javascript
0
 

Author Comment

by:brausy
ID: 7126573
the problem is as soon as I am in the ShowModalDialog Window i cannot get access to the iframe of the main document. I was able to write into the hidden frame, but I cloud not read out of it. And how can I write into the ShowModalDialog via JavaScript?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 7126634
"This dialog has some links, which should open in the same ModalDialogWindow"

IN the page in the modal dialog have this:

<script>
name="mymodal"
</script>

<a href="..." target="mymodal"

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp

Here is and example:


Parent:
<form name="myForm">
<input type="text" name="myField" value="Hello">
</form>

<a href="xx.htm" onClick="alert(window.showModalDialog(this.href, window)); return false">Click</a>



Modal:

<a href="#" onClick="alert(window.dialogArguments.document.myForm.myField.value); returnValue='Hello from modal'; self.close(); return false">Click</a>



0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 200 total points
ID: 7126636
Change
window.dialogArguments.document.myForm.myField.value
to
window.dialogArguments.iframeName.document.myForm.myField.value

to acccess a form in an iframe in the opener

The pages MUST ALL COME FORM THE SAME SERVER!!!
0
 

Author Comment

by:brausy
ID: 7129350
Okay I figured everything out and it works.
1. I write the link of the ShowModalWindow in the hidden frame of the opener.
2. I have access to this hidden frame and the InnerHTMl as well as to the innerText
3. last but not least I do not know how to write this innerHTML into the ShowModal Window and how to clear the old text of the ShowModal Window

0
 

Expert Comment

by:ipis
ID: 7129436
3. last but not least I do not know how to write this innerHTML into the ShowModal Window and how to clear the old text of the ShowModal Window

modalDialog.document.body.innerHTML = opener.hiddenFrame.document.body.innerHTML

Ivan
0
 

Author Comment

by:brausy
ID: 7141089
mplungjan thanks a lot I solved the Problem.
I can write into and read out of the iframe of the main window
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

628 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