brausy
asked on
link in a showModalDialog in the same window
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?
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
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
<script>
window.name="mymodal"
</script>
<a href="test2.htm" target="mymodal">Test2</a>
Works!!
window.name="mymodal"
</script>
<a href="test2.htm" target="mymodal">Test2</a>
Works!!
ASKER
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
ASKER
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
ASKER
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?
"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.show ModalDialo g(this.hre f, window)); return false">Click</a>
Modal:
<a href="#" onClick="alert(window.dial ogArgument s.document .myForm.my Field.valu e); returnValue='Hello from modal'; self.close(); return false">Click</a>
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.show
Modal:
<a href="#" onClick="alert(window.dial
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
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.documen t.body.inn erHTML
Ivan
modalDialog.document.body.
Ivan
ASKER
mplungjan thanks a lot I solved the Problem.
I can write into and read out of the iframe of the main window
I can write into and read out of the iframe of the main window
<script>
name="mymodal"
</script>
<a href="..." target="mymodal"
or
<a href="..." target="_self"
Michel