473,903 Members | 3,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onFocus or focus() issues in Mozilla for Red Hat Linux 8.0?

Hi,

I have Red Hat 8.0 and have the default Mozilla browser that comes with
it. I am programming in javascript and have come across something
problematic. Given the following code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="TEXT" NAME="input1">
<INPUT TYPE="BUTTON" VALUE="Click" onFocus="input2 .focus()"
onClick="alert( 'You clcked me!')">
<INPUT TYPE="TEXT" NAME="input2">
</FORM>
</BODY>
</HTML>

When using MSIE or Netscape for Windows: if you click inside the first
text input and then tab to the button, it will automatically forward focus
to the second text input where you can type text there. This is how I want
it to behave.

But when using Mozilla in RH8.0: when you tab to the button the cursor
appears in the second text input, and so looks like it is working correctly.
But when you try to type something, nothing happens -- the cursor just sits
there blinking. If you then hit the enter key, it will act the same as if
the button has focus (popping up the alert window, since hitting Enter while
a button has focus is the same as clicking the button with the mouse).
So it seems to me that when tabbing to the button, the button is
internally keeping focus even though the event handler is telling it to
forward focus to the second text input and even though the second text input
appears to have focus with the appearance of a cursor.
And the problem isn't only when the element I am trying to skip is a
button. Given the following code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="TEXT" NAME="input1">
<INPUT TYPE="TEXT" NAME="input2" onFocus="input3 .focus()">
<INPUT TYPE="TEXT" NAME="input3">
</FORM>
</BODY>
</HTML>

Once again, MSIE and Netscape for Windows handles this properly. But in
Mozilla for RH8.0 when tabbing to the second text input, the cursor appears
there and you can type in the second text input -- it doesn't forward the
focus at all. And worse yet when tabbing from the second text input to the
third text input, the cursor skips the THIRD text input and appears in the
location input at the top of the browser!!!
Furthermore when 'clicking' on the second text input with the mouse, the
text cursor appears in the second text input and stays there but typed text
from the keyboard appears in the third text input.

Does anyone know if these are bugs with that Mozilla (or that version of
it), or does Mozilla have a different event handler or javascript command
that I can give to make it work properly??? The Netscape version on Windows
I am using is 4.0, and I thought Mozilla was created FROM Netscape...

Thanks in advance,
Scott Navarre
Jul 20 '05 #1
4 2407
Scott Navarre wrote:
Hi,

I have Red Hat 8.0 and have the default Mozilla browser that comes with
it. I am programming in javascript and have come across something
problematic. Given the following code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="TEXT" NAME="input1">
<INPUT TYPE="BUTTON" VALUE="Click" onFocus="input2 .focus()"
onClick="alert( 'You clcked me!')">
<INPUT TYPE="TEXT" NAME="input2">
</FORM>
</BODY>
</HTML>


Mozilla doesn't know if you're referring to id 'input2', class 'input2'
or name 'input2'. Use 'document.getEl ementById(input 2).focus()'.
--
Robert Mohr
mo*****@osu.edu
mo***@cis.ohio-state.edu
Jul 20 '05 #2
On Sat, 28 Feb 2004 08:03:25 -0500, Robert Mohr <mo*****@osu.ed u> wrote:
Scott Navarre wrote:


[snip]
<FORM>
<INPUT TYPE="TEXT" NAME="input1">
<INPUT TYPE="BUTTON" VALUE="Click" onFocus="input2 .focus()"
onClick="alert( 'You clcked me!')">
<INPUT TYPE="TEXT" NAME="input2">
</FORM>
</BODY>
</HTML>


Mozilla doesn't know if you're referring to id 'input2', class 'input2'
or name 'input2'. Use 'document.getEl ementById(input 2).focus()'.


That wouldn't do much good. Even if you correctly specified the string
literal 'input2' only IE, out of my four browsers, will return a reference
to the third input element.

It should be clear from the name that the getElementById method will only
return a reference to an element with the given id attribute, not a
matching name attribute.

The controls exist within a form, so the simpler approach would be:

onfocus="this.f orm.input2.focu s();"

However, if the sole purpose is to skip a control in the tabbing order,
use the tabindex attribute:

<input ... name="input1" tabindex="1">
<input ... type="button" tabindex="0">
<input ... name="input2" tabindex="2">

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #3
Didn't help -- even if I use 'document.forms[0].elements[2].focus()', it
behaves EXACTLY the same way.
"Robert Mohr" <mo*****@osu.ed u> wrote in message
news:c1******** *@ripley.netsca pe.com...
Scott Navarre wrote:
Hi,

I have Red Hat 8.0 and have the default Mozilla browser that comes with it. I am programming in javascript and have come across something
problematic. Given the following code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="TEXT" NAME="input1">
<INPUT TYPE="BUTTON" VALUE="Click" onFocus="input2 .focus()"
onClick="alert( 'You clcked me!')">
<INPUT TYPE="TEXT" NAME="input2">
</FORM>
</BODY>
</HTML>


Mozilla doesn't know if you're referring to id 'input2', class 'input2'
or name 'input2'. Use 'document.getEl ementById(input 2).focus()'.
--
Robert Mohr
mo*****@osu.edu
mo***@cis.ohio-state.edu

Jul 20 '05 #4
Scott Navarre wrote:
But when using Mozilla in RH8.0: when you tab to the button the cursor


so upgrade... your html works fine with current Mozilla. Red Hat 8.0
shipped with Mozilla 1.0.1, which (compared to current builds) was buggy.

--
------------------------------------------------------------------
Andrew Schultz | The views expressed might
aj******@eos.nc su.edu | not represent those of NCSU.
http://www4.ncsu.edu/~ajschult/ | They are however, correct.
Jul 20 '05 #5

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

Similar topics

1
20286
by: Rich Morey | last post by:
Hello, I have created a form and assigned each of the form elements to a class in a style sheet. I would like to know if it is possible to add 'OnFocus' and 'OnBlur' events to the style sheet class so that I can change the background color of a form element WITHOUT having to add 'OnFocus' and 'OnBlur' events to each individual form element..
1
8771
by: Michael Albanese | last post by:
I am developing an application to handle my compay's OSHA reporting requirements. Some of the input criteria are technical and narowly defined, so I was trying to prvide what i call "Context Sensitive Help" by providing a short instructional message based on which control has Focus. Because of the way that a Radio Button List control is rendered in the browser i can not attach an onFocus event
2
3144
by: Paresh Shah | last post by:
Hi Friends... I have an query on how to capture onFocus event for all the input controls without writing onFocus event in the <input> tag. say my html form has 3 or 4 or 5 input text boxes, now I want to capture onFocus event for all the text boxes without writing onFocus code in <input> tag.
2
3993
by: swathi | last post by:
----------------------------------------------------------------------- A poll associated with this post was created, to vote and see th results, please visit http://www.forum4designers.com/message103437.htm ----------------------------------------------------------------------- Question: iframe onfocus problem in mozilla browse - attached zip fil - multi.html in attached zi...
1
2393
by: Eric Trav | last post by:
Hello, I am using mozilla and javascript to change the style background color for my select with onfocus() and back to white with onblur(). When i process onfocus(); i have to click on the select three times to get the popup menu and everything seems slow. No errors are reported in the console however it seems as if the click event is not being processed after the focus event is processed.
8
3560
by: Yeah | last post by:
I wish to use a drop box where each Option will not take the user to a web page - but a certain location on the same page the drop box exists. For example, Option 1 would take the user to "Chapter 1", Option 2 would be "Chapter 2", and so on. All destinations are on the same page. I already have <A NAME="#ChapterX"> tags placed in the appropriate places in the document. (A no-GO button drop box is preferred.) How do I achieve this?
7
3126
by: ukfusion | last post by:
i need a way of changin a class name on focus which works in both ie and mozilla style browsers.....i think i read that className doesnt work in mozilla because its a reserved term or something....is there something similar which i can apply to an oFocus which is browser compatible and does not require script. thanks
2
2490
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. http://www.littleworksstudio.com/temp/usenet/focus.html To simulate the problem, just enter or change the "first" textbox and either click or tab to another control., it is tied to the onchange event. An alert box that simulates the "warning". When you close it the focus will not move...
0
10007
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9854
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11297
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9693
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7215
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6100
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4734
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3329
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.