I have an issue that has occurred with the upgrade to Windows SP2.
When I wrote the code originally, it worked fine. Now I get a Runtime Error when the Javascript attempts to open the 2nd window. The intent is to have two windows open beside each other. If I comment out one of the window open lines, the expected window does open. Problem only occurs when two windows are attempted.
Here’s the code:
function displayHelp(DocID)
{
// var h = window.screen.height;
var h = 700;
var w = window.screen.width;
var date = window.document.forms[0].elements["Rating_Date"].value;
var rated = window.document.forms[0].elements["Employee_Name"].value;
Subject: JavaScript - Opening Multiple Windows beside each other.
I’ve tried removing the ‘.focus()’ but that didn’t make a difference.
Also, I’ve swapped the two window.open statements around, and it’s always the second open that gets the runtime error.
Strangely too, I clicked the button on the main form twice, and both windows appeared, the first one with the first click of the button, the second window with the second click.
The issue seems to be not with the statements, but with having two window.open(s). Anyone know a workaround ?
Subject: JavaScript - Opening Multiple Windows beside each other.
I agree. It sounds like a version issue.
Try breaking it down to simpler pieces and debugging from there. Your code may be succinct and efficient, but it may be easier to debug if you build up one variable at a time, such as:
Subject: JavaScript - Opening Multiple Windows beside each other.
Can you do a window.open().focus()?
Thats a big difference between the two lines. Technically the function might return a window. But in the asynch world of browsers maybe it doesnt exist yet properly.