New Windows via Javascript

P

PWS

www.middlesexccl.com

If you visit the above link and click on one of the buttons, e.g.
League Administration, a the requested page should open in a new
window. On my test set-up and when I view the live site this happend
without error. However for some people when they click on the same
button they also get a new Team window, with an ASP error because no
team has been selected.

If a team is selected from the drop down that team's page should open
in a new window, it does for me without issue, and I have not heard of
anyone having any problems.

The javascript I use to open new centerd windows is:

function OpenWin(WinName,width,height)
{
var left = 0
var top = 0;
if (window.innerWidth != undefined)
{
left = (window.innerWidth/2) - width/2;
top = (window.innerHeight/2) - (height+15)/2;
}
else if (window.screen)
{
left = (window.screen.availWidth/2) - width/2;
top = (window.screen.availHeight/2) - (height+15)/2;
}
var options = ",width=" + width + ",height=" + (height+15) + ",left="
+ left + ",top=" + top;
window.open("", WinName ,"toolbar=0,scrollbars=0" + options);
var a = window.setTimeout("document.SelectTeam.submit();",500);
}

Can anyone look at the saource code for the above page and tell me why
the team window is sometimes opening when a button is clicked?
 
R

RobG

www.middlesexccl.com

If you visit the above link and click on one of the buttons, e.g.
League Administration, a the requested page should open in a new
window. On my test set-up and when I view the live site this happend
without error. However for some people when they click on the same
button they also get a new Team window, with an ASP error because no
team has been selected.

If they are using Safari or Firefox, they will see the error 100% of
the time if scripting is enabled.

If a team is selected from the drop down that team's page should open
in a new window, it does for me without issue, and I have not heard of
anyone having any problems.

The javascript I use to open new centerd windows is:

It doesn't center the window for me, please don't try to do that.
function OpenWin(WinName,width,height)
{
var left = 0
var top = 0;
if (window.innerWidth != undefined)
{
left = (window.innerWidth/2) - width/2;
top = (window.innerHeight/2) - (height+15)/2;}

else if (window.screen)
{
left = (window.screen.availWidth/2) - width/2;
top = (window.screen.availHeight/2) - (height+15)/2;}

var options = ",width=" + width + ",height=" + (height+15) + ",left="
+ left + ",top=" + top;
window.open("", WinName ,"toolbar=0,scrollbars=0" + options);
var a = window.setTimeout("document.SelectTeam.submit();",500);

}

Can anyone look at the saource code for the above page and tell me why
the team window is sometimes opening when a button is clicked?

Seems to me your window opening script submits a form called
"SelectTeam" without any validation about 0.5 seconds after opening
the window. That is likely the source of your problem - why you use
script to submit a form is beyond me.
 
P

PWS

Seems to me your window opening script submits a form called
"SelectTeam" without any validation about 0.5 seconds after opening
the window. That is likely the source of your problem - why you use
script to submit a form is beyond me.


I am more likley to follow advcie such as that about if I understand
the rationale behind it.

At present I have button which should open new windows following the
onclick events, and I have a drop-down which should open a window
follwoing the onchange event. Please xplain what is wrong with this -
other than the problem I have go, which is the onchange event of the
drop-down must be happening when the onclick event of the buttons
occurs.
 

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
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top