473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

New Windows via Javascript

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?

Apr 19 '07 #1
2 1436
On Apr 20, 6:16 am, PWS <p...@twelve.me.ukwrote:
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.
--
Rob

Apr 19 '07 #2
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.

Apr 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Benson | last post by:
Hi, I'm in a tightly-secured environment where I may not be allowed to use Python for some scripting work, and may have to fall back on what came with Windows 2K. I'm cracking "VBScript in a...
2
by: Raptor | last post by:
I'm a complete Javascript n00b, using a snippet I found on the web. I'll probably be buying a Javascript book. What's the authoritative on-line resource for Javascript, like php.net is for PHP? ...
16
by: Robert Mark Bram | last post by:
Hi All! Is there a way to reference a window by name without doing something like this: open (, 'windowName'); The open method will open a blank window if there is no window with such a name....
4
by: Hal | last post by:
Can someone please tell me what is wrong with this script? <script language="JavaScript"> <!-- function HF_CloseAllChildren() { if (g_win1) != undefined { if ((g_win1) && !(g_win1.closed))...
7
by: lvpaul | last post by:
Hallo ! I am using IIS-Windows-Authentication in my intranet (web.config <authentication mode="Windows" /> <identity impersonate="true" /> How can I get the users (client) IP-Address ? I...
3
by: Angus Comber | last post by:
Hello Can javascript call/reference COM object. VBScript can do this (as it is from Microsoft). Can javascript? If so how? Angus
4
by: korund | last post by:
Is there any difference to read & write to windows Registry with VBScript or JavaScript? Both scripting languages have similar syntax. What is preferable use for this? thanks.
69
by: Peter Olcott | last post by:
Does JavaScript represent its controls internally as Microsoft Windows controls, or does it build them from scratch like Java?
9
by: oz | last post by:
Hi All, I want to make a dictionary with windows application. My data is html format. therefore, i use webBrowser control on my windows form. If the user click any word in webBrowser control,...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.