Can I call functions in a modeless dialog from the parent
February 3, 2012 9:38 AM Subscribe
Is there anyway to call functions of a modeless dialog (in IE) from the parent window that spawned the dialog?
I'd like the user to be able to click on items in the parent window in order to change some data in the dialog upon which they can then perform actions.
Also I'm not quite sure what the difference is between opening a new window with window.open vs window.showModelessDialog and when I'd use one over the other.
Thanks!
posted by zeoslap to computers & internet (3 answers total)
mainPage.html
<html> <head> <title>I am the main page</title> </head> <body> <h1>I am the main page.</h1> <p>I am data.</p> <p><button onclick="window.showModelessDialog('dialogPage.html', window);">I am a button</button></p> <p id="displayArea">I can be updated.</div> </body> </html>dialogPage.html<html> <head> <title>I am a dialog page</title> <script> window.onload = function(){ document.getElementById('updateButton').onclick = function(){ var openerWindow = window.dialogArguments; var dialogValue = document.getElementById('someText').getAttribute('value'); openerWindow.document.getElementById('displayArea').innerHTML = dialogValue; }; }; </script> </head> <body> <h1>I am a dialog page</h1> <p><input type="text" value="Some Text." id="someText"></p> <p><button onclick="" id="updateButton">Update</button></p> </body> </html>posted by artlung at 12:36 PM on February 3, 2012