Darren
08-20-2007, 10:56 PM
Is it possible to execute showModalDialog() asychronously?
I'm doing a test page right now, testing out both setTimeout() and setInterval and noticed that if I open a popup using showModalDialog(), both setTimeout() and setInterval pause while the modal popup is visible.
Here's the two files I'm experimenting with right now:
file1.htm<html>
<head>
<script type="text/javascript">
function startMonitoring() {
window.setInterval('advanceTwo()',1000);
advanceOne();
}
function startPopup() {
showModalDialog("pop.htm");
}
function advanceOne() {
var x = document.getElementById('one');
x.value = x.value * 1 + 1;
setTimeout('advanceOne()',1000);
}
function advanceTwo() {
var x = document.getElementById('two');
x.value = x.value * 1 + 1;
}
</script>
</head>
<body>
<p><input id="one" type="text" value="0" /></p>
<p><input id="two" type="text" value="0" /></p>
<p><button onClick="startMonitoring()">Monitor in page</button></p>
<p><button onClick="startPopup()">Monitor in popup</button></p>
</body>
</html>
pop.htm<html>
<head>
<script type="text/javascript">
function startMonitoring() {
advanceOne();
window.setInterval('advanceTwo()',1000);
}
function advanceOne() {
var x = document.getElementById('one');
x.value = x.value * 1 + 1;
setTimeout('advanceOne()',1000);
}
function advanceTwo() {
var x = document.getElementById('two');
x.value = x.value * 1 + 1;
}
</script>
</head>
<body onLoad="startMonitoring()">
<p><input id="one" type="text" value="0" /></p>
<p><input id="two" type="text" value="0" /></p>
</body>
</html>
I launch file1.htm. I click the "Monitor in page" button and watch the values in the input fields tick up. I then click the "Monitor in popup" button. the modal popup appears, and the values tick upward in that window, however the values in the underlying window stop advancing... not what I wanted.
Can this be done?
Thanks in advance,
Darren
I'm doing a test page right now, testing out both setTimeout() and setInterval and noticed that if I open a popup using showModalDialog(), both setTimeout() and setInterval pause while the modal popup is visible.
Here's the two files I'm experimenting with right now:
file1.htm<html>
<head>
<script type="text/javascript">
function startMonitoring() {
window.setInterval('advanceTwo()',1000);
advanceOne();
}
function startPopup() {
showModalDialog("pop.htm");
}
function advanceOne() {
var x = document.getElementById('one');
x.value = x.value * 1 + 1;
setTimeout('advanceOne()',1000);
}
function advanceTwo() {
var x = document.getElementById('two');
x.value = x.value * 1 + 1;
}
</script>
</head>
<body>
<p><input id="one" type="text" value="0" /></p>
<p><input id="two" type="text" value="0" /></p>
<p><button onClick="startMonitoring()">Monitor in page</button></p>
<p><button onClick="startPopup()">Monitor in popup</button></p>
</body>
</html>
pop.htm<html>
<head>
<script type="text/javascript">
function startMonitoring() {
advanceOne();
window.setInterval('advanceTwo()',1000);
}
function advanceOne() {
var x = document.getElementById('one');
x.value = x.value * 1 + 1;
setTimeout('advanceOne()',1000);
}
function advanceTwo() {
var x = document.getElementById('two');
x.value = x.value * 1 + 1;
}
</script>
</head>
<body onLoad="startMonitoring()">
<p><input id="one" type="text" value="0" /></p>
<p><input id="two" type="text" value="0" /></p>
</body>
</html>
I launch file1.htm. I click the "Monitor in page" button and watch the values in the input fields tick up. I then click the "Monitor in popup" button. the modal popup appears, and the values tick upward in that window, however the values in the underlying window stop advancing... not what I wanted.
Can this be done?
Thanks in advance,
Darren