ie7 problem

B

Bob

Hello,

The following function is failing in ie7. Can anyone offer a solution?


function pause(numberMillis) {
if (IEVERSION >= 5.5) {
var dialogScript = 'window.setTimeout(function () {
window.close(); }, ' + numberMillis + ');';
var result =
window.showModalDialog('javascript:document.writeln("<script>'+dialogScript+'</script>")');
}
 
W

web.dev

Bob said:
Hello,

The following function is failing in ie7. Can anyone offer a solution?

You have not given a context in which you are trying to achieve with
the code given.
function pause(numberMillis) {
if (IEVERSION >= 5.5) {

How are you obtaining the version number? Is it even reliable?
var dialogScript = 'window.setTimeout(function () {
window.close(); }, ' + numberMillis + ');';
var result =
window.showModalDialog('javascript:document.writeln("<script>'+dialogScript+'</script>")');

Generally good practice to place a type attribute:

<script type = "text/javascript">

The string '</script>' is causing the browser to think that this is
where the script actually ends. Escape the slash:

<\/script>
 
B

Bob

Thanks for your reply. Th IEVERSION variable is set in another area.
It does seem to work ok. The problem I'm having with the code is that
it infinitely executes. By that I mean, it is being called repeatedly
(like a sleep function) to allow form field processing to be handled.
Problem only on ie7.
 
B

Bob

I believe that I've isolated the problem to showModalDialog. Is this a
known problem with ie7? Is there an alternative to showModalDialog?
Thanks.
 
S

sagesmith

It's not a problem. This script is a hack. I'm sure they tightened it
up in ie7. We'll have to find an alternative way to pause on a
different thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,260
Messages
2,571,039
Members
48,768
Latest member
first4landlord

Latest Threads

Top