473,500 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble opening a window using tabs navigation

7 New Member
Hello i have a button that clicking on it should open a pop-up with a calendar.

I'm working with IE 7.

the behaviour that follows clicking on the button is not persistent.

if i use the mouse to click the button i succeed, but when i navigate with tabs, sometimes it works right away, sometimes it needs 1-2 tries to open the window, and sometimes it doesn't succeed.

the problem is that
Expand|Select|Wrap|Line Numbers
  1. window.open(...)
returns null

This is my code-

Expand|Select|Wrap|Line Numbers
  1. function cal_popup1 (str_datetime) {
  2.     this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
  3.     if (!this.dt_current) return;
  4.  
  5.     var obj_calwindow = null;
  6.     var counter = 0;
  7.     while (obj_calwindow == null && counter < 10)
  8.     {
  9.         var obj_calwindow = window.open(
  10.         this.path + 'calendar.html?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
  11.         'Calendar', 'width=200,height='+(this.time_comp ? 215 : 190)+
  12.         ',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
  13.         );
  14.         alert("hello " + obj_calwindow);
  15.         counter++;
  16.     }
  17.  
  18.     if (obj_calwindow == null)
  19.     {
  20.         alert("couldn't open the window");
  21.     } else {
  22.         obj_calwindow.opener = window;
  23.         obj_calwindow.focus();
  24.     }
  25. }
i would appreciate your help
Jan 15 '08 #1
13 2234
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

So how do you call this code? Can you show the button HTML markup.
Jan 15 '08 #2
NoaD
7 New Member
this is how i call the script

Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.     <td width="17">&nbsp;</td>
  3.     <td class="text1" align="left" valign="middle" height="30">From date:</td>
  4.     <td align="left" valign="bottom" height="30">
  5.         <input type="Text" id="ONLINE_FROM"
  6.                 name="ONLINE_FROM"
  7.                 class="textbox" size=20 
  8.                 style="WIDTH: 152px"
  9.                 value="15/01/2008"/>
  10.         <span id='calStRef'>
  11.             <a href='javascript:calStart.popup();'>
  12.                 <img src="/images/cal.gif"  style='position:relative; top: 3px' border="0" alt="calendar"/>
  13.             </a>
  14.       </span>
  15.     </td>
  16. </tr>
and this is how calStart is
Expand|Select|Wrap|Line Numbers
  1. var calStart = new calendar1(document.forms['mmitab'].elements['ONLINE_FROM']);
and in calendar1

the code contains a reference to the first method that i wrote
Expand|Select|Wrap|Line Numbers
  1. function calendar1(obj_target) {
  2. ...
  3.     this.popup    = cal_popup1;
  4. ...
  5. }
one more thing i discovered - if i put the marker using the mouse on one field before the calendar button and i use 'tab' or 'shift+tab' than the pop-up opens OK

?
Jan 15 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
if i use the mouse to click the button i succeed, but when i navigate with tabs, sometimes it works right away, sometimes it needs 1-2 tries to open the window, and sometimes it doesn't succeed.
I don't seem to experience this problem. Can you give a test link which demonstrates the problem? Does this only occur in IE7 or in other browsers too?
Jan 16 '08 #4
NoaD
7 New Member
I don't seem to experience this problem. Can you give a test link which demonstrates the problem? Does this only occur in IE7 or in other browsers too?
thanks for your help, i can't give a test link since it's part of a bigger system.

i tested it on IE6 and FF as well.

in IE6 this behaviour is reproduced and in FF it works fine.

i thought that maybe something is lost or reset during the tabs navigation...

i also thought that it might be related to some pop-up blocking - but i turned it off and it didn't work.

do you know what could make the
Expand|Select|Wrap|Line Numbers
  1. window.open(...)
fail?
Jan 16 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
I assume by tabs navigation you mean pressing the tab key and then when the link receives focus pressing the return key?
Jan 16 '08 #6
NoaD
7 New Member
I assume by tabs navigation you mean pressing the tab key and then when the link receives focus pressing the return key?
Yes, this is what i mean
Jan 16 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
The only thing I can think of right now is that IE sometimes has a problem with th "javascript:" protocol in the href attribute (it's bad practice anyway - the href should always point to a real URL). So, the line:
[HTML]<a href='javascript:calStart.popup();'>[/HTML] could be changed to:[HTML]<a href='somepage.html' onclick="calStart.popup(); return false;">[/HTML] See if that makes a difference.
Jan 16 '08 #8
NoaD
7 New Member
The only thing I can think of right now is that IE sometimes has a problem with th "javascript:" protocol in the href attribute (it's bad practice anyway - the href should always point to a real URL). So, the line:
[HTML]<a href='javascript:calStart.popup();'>[/HTML] could be changed to:[HTML]<a href='somepage.html' onclick="calStart.popup(); return false;">[/HTML] See if that makes a difference.
Hello,

i tried your suggestion but it didn't help entirely,
i figured that if i don't you the mouse at all before i press return on the button it doesn't work.

only after i place the marker using the mouse on some field and navigate from there, your solution works better, although not 100% of the time.

the keyboard navigation is supposed to be transparent, No?

i have another button on the screen that after i reach it using the tabs I'm not able to continue to other control using 'tab' or 'shift'+'tab'

any idea?
Jan 17 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
i tried your suggestion but it didn't help entirely,
i figured that if i don't you the mouse at all before i press return on the button it doesn't work.

only after i place the marker using the mouse on some field and navigate from there, your solution works better, although not 100% of the time.

the keyboard navigation is supposed to be transparent, No?
I see what you mean. The window has to have focus for the keyboard tab navigation to work. What originally has focus?
i have another button on the screen that after i reach it using the tabs I'm not able to continue to other control using 'tab' or 'shift'+'tab'

any idea?
Post the code for this button. Is it the last button?
Jan 18 '08 #10
NoaD
7 New Member
I see what you mean. The window has to have focus for the keyboard tab navigation to work. What originally has focus??
what initially gets the focus is the last control added to the page, when i start to move with the tabs. i start from that button

[HTML]<TD align="left"><INPUT type="button" name="cancelButton" class="BtnCreate" value="<i18n:message key="link.cancel"/>" onclick="window.close()" style="width : 80;"></TD>[/HTML]

Post the code for this button. Is it the last button?
i found the problem the button had an attribute [HTML]onFocus="window.focus()"[/HTML], after i removed it the tabs go O.K.

so now the only problem is that the window doesn't open :(
Jan 20 '08 #11
acoder
16,027 Recognized Expert Moderator MVP
i found the problem the button had an attribute [HTML]onFocus="window.focus()"[/HTML], after i removed it the tabs go O.K.
Well, that was going to cause problems. Good spot.
so now the only problem is that the window doesn't open :(
Even if the button/link has focus?
Jan 21 '08 #12
NoaD
7 New Member
Even if the button/link has focus?
what do you mean has focus?
when i hit return it attempts to open the pop-up - this means that it has focus, right?
Jan 21 '08 #13
acoder
16,027 Recognized Expert Moderator MVP
what do you mean has focus?
when i hit return it attempts to open the pop-up - this means that it has focus, right?
Yes, that's correct. Can you produce a test version that demonstrates this problem?
Jan 21 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

8
37493
by: ajay | last post by:
How to make a new page appear in tab instead of new window. I use Netscape 7+. Is there any provision to do in HTML language ? Ajay
17
3024
by: George Hester | last post by:
http://tinyurl.com/5uj6w The lower middle icon the "block" should not drop down when the mouse is over it. How can I stop that? Also the navigation divs both top and bottom should follow the...
14
11016
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
8039
by: sjp | last post by:
I need to open new windows only for the purpose of viewing linked images, maybe a dozen or so throughout the site. Using the Target="blank" command is quick, easy and seems like the best way to...
44
9382
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute...
1
6258
by: OtisUsenet | last post by:
Hello, I have some onClick events in <a href...> elements, so they get called when a user clicks on a link. This works well, and looks like this: <a onclick="onLinkClick(123);"...
9
5231
by: John | last post by:
Tried this on microsoft.public.access.gettingstarted - no response - perhaps more appropriate here. I'm not a database user, simply helping someone get started with a new computer. The old...
18
2474
by: fishwick | last post by:
I haven't really done any css in quite a while, and am banging my head against the wall trying get the rudimentary layout together of a church website home page to display correctly - I don't want...
2
3600
by: pbd22 | last post by:
Hi. I have built a site with tabs-based navigation as a pretty major component. The tabs use window.location.href to understand where the user is and displays the appropriate tabs accordingly....
0
7018
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
7182
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
7232
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...
1
6906
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
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.