aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes focus() not working in firefox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "focus() not working in firefox" Watch "focus() not working in firefox" New topic
Author

focus() not working in firefox

Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
Hi,

Could you please help me to resolve the issue with firefox & safari browser. The issue is javascript focus() function on document object is not working in FF n safa.., but its working fine in IE.

Thanks.
vidya lakshmi
Greenhorn

Joined: Apr 09, 2007
Posts: 8
For firefox how you have used whether like this,

[code}
document.getElementById()
[/code]

Please just mention how you have called the javascript and what you have done? Then only we can give a correct solution.

Regards,
vidya
Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
excactly document.getElementById('id').focus();
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
And what type of element is this thing you are trying to focus?

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

"Rakesh MR", please check your private messages for an important message from me.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
its a DIV <div id='id1'>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well a div does not have a focus method. That is your problem.

You want to bring it into view? http://radio.javaranch.com/pascarello/2005/01/09.html

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

"Rakesh MR", My request that you change your display name to adhere to JavaRanch standards was not a suggestion. Valid display names are mandatory for participation on the Ranch. Please change your display name as instructed prior to your next post.

Be aware that accounts with invalid display names are disabled.

bear
JavaRanch Sheriff
Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
My center content of the page is divided into two sections(both are scollable). I need to focus the right section element(div) when I select an element(div) from left side. Now focus is not coming to the corresponding sections in firefox but its fine in IE.

I am using document.getElementById(id).focus()

pls provide/suggest solution for this prob.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Originally posted by Rakesh Kurup:
pls provide/suggest solution for this prob.
Please use real words when posting to the forums. Abbreviations such as "pls" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Originally posted by Rakesh Kurup:
I am using document.getElementById(id).focus()
Again, if the element is a <div>, you are not going be able to get this to work in a cross-browser fashion as not all browsers allow focus to <div> elements.
Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
It will be great if anybody can help me to resolve this kind of cross-browser issues with DIV s.
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Rakesh,

I think Bear's advice is pretty clear:
can't you focus a specific element inside your div?

Herman
Rakesh Kurup
Greenhorn

Joined: Oct 11, 2007
Posts: 6
thanks for the help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: focus() not working in firefox
 
Similar Threads
JSF xhtml pages not working with Safari Browser
How to force a browser to redraw ?
Firefox doesn't show background color for selected option
Automatic logon?
focus() not working in firefox