is there any way to set focus to a particular browser tab using javascript?
My purpose is to set focus to a tab(assuming there are many tabs in a single window) based on ajax fetch
OK, here's something I can't figure out: my tab key seems to have stopped working in Firefox. I am not sure if it has something to do with a recent Mozilla update or a recent Firefox update. Previous to whatever event causes the current condition, I could tab from one form field to another on webpages (e.g. tab from entering my username to the password field) but no longer.
I went to the Mozilla support forum to see what I could find. A good article on setting the tab focus however after attempting all the setting and restarting Firefox as well as my netbook, I still cannont tab through fields in webpages.
Any thoughts?
Many
I'm not sure if this is a change in the UI for Lucid, a bug, or a configuration setting somewhere that I have overlooked, but when I click a hyperlink in Evolution or Ctrl+click a hyperlink in Open Office, the links are opened in a new tab in Firefox, but the focus isn't switched to Firefox. I have to manually Alt+Tab to Firefox to see the web page that is opened.
In Firefox, I have "When I open a link in a new tab, switch to it immediately" selected, and in Preferences -> Preferred Applications I have "Open link with browser default" selected. Is there another setting somewhere that will switch the focus to Firefox when a link is opened that I am missing?
There's a comment in jquery.autocomplete.cs:
// TODO provide option to avoid setting focus again after selection?
useful for cleanup-on-focus
Since I needed that option I've added it to my private copy. The
changes have been trivial (basically 2 lines added). Should I send it
to someone for incorporating it into the next release anyway?
I am struggling with setting focus on an input text element. I have 2
input text elements as follows:
<fieldset id='rackScanEntry'>
RU:<input type='text' size="2" id='ru'>
Barcode:<input type='text' name="assetBarcode" size="20"
id='assetBarcode'>
</fieldset>
the first is usually updated by js using val() jquery method. Then I
have a "change" event on the second one. Once change is triggered, the
values of the two elements are validated and then stored in an array
for an ajax post later. I then increment the value of the first field
and then set the value of the second to empty using val("). Finally, I
try to reset the focus on the second field to wait for another entry.
No matter where I put the $("#assetBarcode").focus() code, I can not
get this to focus. What am I doing wrong?
I'm trying to create a custom Firefox tab that will open up a specific search result in Google. I look for my TV shows on tv.com, and I do so by using this search:
site:www.tv.com "Airs: Sunday September 21, 2008"
If you google that search, you'll see what I mean. But I have to fix the date each time I run the search, and I want to automate it so I can simply set it as a bookmark/tab to open.
Firefox will run javascript as a search; check this out:
javascript:location.href='http://www.google.com/search?hl=en&q='+'site:www.tv.com\%20'+'\"Airs\%20'+new%20Date().toLocaleString("%A,%20%B,%20%m,%20%Y")+'\"'
It searches for this: site:www.tv.com "Airs Sun 21 Sep 2008 10:28:18 PM EDT"
Is there a way to alter that Javascript snippet to get it to adhere to this format exactly, and update the date automatically? I lack the JS-fu to figure it out.
site:www.tv.com "Airs: Sunday September 21, 2008":(
I am facing problem for setting focus which is working Mozilla and not working in IE.
Code snippet which i have written for setting focus which works fine in Mozilla not in IE
Code snippet,
for(var i=0; i<form1.elements.length; i++) {
if(document.forms['form1'].elements[i].name==urlparts[1]) {
document.forms['form1'].elements[i].focus();
//alert('after focus');
}
}
If you keep that alert its working fine even in IE but if you commnet it is failing again
Please Provide me the solution which i need to implement
I need a help of u all. How to stay the focus in firefox using javascript. We all know that .focus() will work in IE. But i want it to be work on all browsers. The focus should stay in the textbox if it is empty. Without entering anything it should not move...
Hopefully, this is simple.
I have a div, id is 'container', that is used to hold all document information.
On window load, I have it create two separate arrays, one for Started and one for Completed, that creates all elements for the page (DOM). The window will always load the Started array first like it should and set focus to the text input that was created and appended. When I remove all the nodes of the container to add the array of elements from Completed, it is unable to set focus on the new and different text input. The two text boxes have different id's and are never on the same page/siblings of each other.
I have made sure that the element actually exists as well as tried a bunch else before setting focus but it almost refuses to. :(
Since technically each array is the same with Started having a dataContainer being the lastChild, would it be easier just to redo innerText on some of the other elements? Or should it work the way I originally had it going?
Hope this is clear, but chances are... it's not.
TIA!
Hi, Is that possible to set focus on specific tab? For example, I want to set the focus in main tab on submit action but On modify action, i like to set the focus in history tab.
When I drag a firefox tab to the bar, so to create a link to a page, I'd like to use the small site logo thumb image right to the page name in the tab as the icon image for the link on the bar.
I think that should be the standard behaviour of gnome too.
Anyway do you know how do I identify the file name to search for in the firefox cache files?
Odd error this. Am getting an Ubuntu crash once or twice each day when I close a Firefox tab ... happens if I'm a bit careless when clicking on the X of the tab ... if I'm really precise there's no problem.
Firefox 3.0.7, Hardy Heron.
Ubuntu just crashes to black screen, have to re-boot, then it all works fine again until the next time.
Tried searching for similar problems but they seem to be last year or 2007.
Not a major concern, just a pesky annoyance. Any ideas ?
Thanks in advance for any suggestions.
Niall.
There are many ways for setting focus on form fields. I'm actually looking for some code that automatically detects if there is any form on the page & then automatically sets the focus to the first field of the form.
No need of putting Form Name & Field Name in Javascript.
Is there any way to do this ???
Please Help!!!
I've been reading a lot of websites lately with pdfs, and having to download them and open them in a seperate program (window) is beginning to get at me. Is there any way to open them in a firefox tab, like any other webpage?
Firefox tab switching (among other things) is slower on ubuntu linux than windows on identical hardware.
Q1: What software is responsible for the slowdown?
Q2: Can I expect an improvement if I use TWM or some other stripped down WM?
I have a strange issue with Hardy. After a long and intense session of Firefox, may occur an xorg crash when closing a Firefox tab.
Requirements to replicate the issue on my system:
- an intense firefox session without closing it
- intense use of tabs
- sites with multiple flash animations
- Compiz enabled
Xorg crashes to text mode and the only way to return to graphics is to hit CTRL+ALT+DEL to restart the system. In text mode remains a strange unmovable mouse pointer.
I've filled a bug (https://bugs.launchpad.net/ubuntu/+source/xorg), but in the meanwhile I want to know if someone has the same issue.
In the bug description I've written a procedure that lead me to replicate the issue, but not always, only two or three times over many retries.
I don't know if it's related to fglrx driver, I use default version shipped in Hardy.
The browser war is getting more exciting every day with the upcoming releases of Firefox 4 and Opera 11.
http://www.mozilla.com/en-US/firefox/beta/
http://www.opera.com/browser/next/
There was a lot of talk a couple of months ago about the similarities of both browsers interfaces. Regardless of who copied the UI of the competitor, they are both looking really good.
Although the Linux version of Firefox 4 doesn't look so shiny as the Windows version, Mozilla has introduced tons of new features (http://www.mozilla.com/en-US/firefox/beta/features/) and revolutionized tab browsing with Tab Groups (http://www.youtube.com/watch?v=1Nfx98L_nUk) (aka Tab Candy or Firefox Panorama). Not to mention the performance boost, which is huge, due to the new JaegerMonkey (http://en.wikipedia.org/wiki/JaegerMonkey#J.C3.A4gerMonkey) JIT method.
Now is time for Opera developers to show their cards, with the release of the first Beta iteration of Opera 11, which introduces support for extensions (https://addons.labs.opera.com/addons/extensions/) (available since alpha), Plug-ins on demand (similar to Chrome) and the newly arrived Tab Stacking (http://www.youtube.com/watch?v=5hqSGGk1YTI), among other things.
Tab Groups and Tab Stacking share the same concept, although they differ a lot in regard to implementation. Tab Groups is more like KDE workspaces, while Tab Stacking is more like the window grouping feature of KDE panel Task Manager. However, they both allow you to group related tabs for maximizing productivity and for keeping the tab bar less cluttered.
Although I'm probably too excited with my new toy, I must admit I prefer Opera's Tab Stacking. The reason for that is because I don't need to leave the main browser window to access the tab groups and it integrates pretty well with my tab setup (visual tabs on the right).
Which one do you prefer and why?
Firefox Tab Groups
http://goo.gl/7wOnf
Opera Tab Stacking
http://goo.gl/R5kvW
In my MDI app I have a DialogBar with several edit boxes that display mouse position. I use the tab key to switch the focus from the view to these edit boxes.
//from within the view OnKeyUp()I call:
GetWinX()->SetFocus(); //put the focus into the Absolute X coordinate box - this works
I would then like to hit tab again and go to the next edit box and back to the view on the next time tab is pressed.
Since the focus is now in the dialogbar I had assumed that I would handle the OnKeyUp for my dialog bar class in order to detect whether the tab key had been pressed again and move the focus to the proper window.
However, this code never gets called:
void CSettingsBar::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{ //pressin tab in the view moves the focus to the CEdit on the dialog bar
if(GetFocus() == GetWinX()) //if the X box has the current focus
{
GetWinY()->SetFocus(); //set the focus to the Y box
GetWinY()->SetSel(0, -1); //highlight the box
}
else if(GetFocus() == GetWinDX()) //if the DX box has the current focus
{
GetWinDY()->SetFocus(); //set the focus to the DY box
GetWinDY()->SetSel(0, -1); //highlight the box
}
else if(GetFocus() == GetWinY() || GetFocus() == GetWinDY()) //if the focus is in either Y ot DY
GetView()->SetFocus(); //set the focus back to the view
}
Note that I dont want the default tab order behavior. I only want the focus to switch between certain CEdits on the dialog bar and then back to the view.
How do I handle this situation since the above code doesn't get called?
Any help would be appreciated.
Thanks,
Josh Knox
http://www.maxymtech.com
I'm having trouble getting the tabs function to set focus properly
when the tab key is pressed. I'm trying to create a form where the
user can just press the tab key to move from field to field, even
across tabs. In Firefox, it will select a text box easily enough, but
in IE, it moves to the *second* text box on the new tab. To make
matters stranger, in Firefox it won't set focus on a drop-down select
at all.
I'll appreciate any help you can give on this.
Here's my sample html page, based on the example and using the flora
CSS:
------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Using JQuery Tabs</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="flora.tabs.css" type="text/css"
media="screen" title="Flora Tabs">
<script type="text/javascript" src="jquery-1.2.6.js"></script>
<script type="text/javascript" src="ui.core.js"></script>
<script type="text/javascript" src="ui.tabs.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#example > ul").tabs();
// if tab is pressed from these fields, show the next tab
$("input#zipCode,input#notificationDate").bind("keydown",
function(e) {
var keynum;
var keychar;
var numcheck;
if(window.event) // IE
{
keynum = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which;
}
keychar = String.fromCharCode(keynum);
numcheck = /\t/;
if (numcheck.test(keychar)) { //it's a tab
selectNextTab();
setFocus();
}
});
});
function selectNextTab() {
var $tabs = $('#example > ul').tabs();
var selected = $tabs.data('selected.tabs');
switch(selected) {
case 0:
$('#example > ul').tabs('select', 1);
break;
case 1:
$('#example > ul').tabs('select', 2);
break;
case 2:
$('#example > ul').tabs('select', 3);
break;
}
}
function setFocus() {
var $tabs = $('#example > ul').tabs();
var selected = $tabs.data('selected.tabs');
switch(selected) {
case 1:
$('input#notificationtype').select();
break;
case 2:
$('input#householdIncome').select();
break;
case 3:
$('input#testInput').select();
break;
}
}
</script>
</head>
<body>
<div id="example" class="flora">
<ul>
<li>
<a href="#fragment-1"><span>The first thing</span> </a>
</li>
<li>
<a href="#fragment-2"><span>Second Thing</span> </a>
</li>
<li>
<a href="#fragment-3"><span>Thing Three</span> </a>
</li>
</ul>
<div id="fragment-1">
<table width="98%" align="center">
<tr>
<td width="10%">
Address 1
</td>
<td>
<input type="text" id="address1" name="address1" tabindex="1"
size="45">
</td>
</tr>
<tr>
<td>
Address 2
</td>
<td>
<input type="text" name="address2" tabindex="2" size="45">
</td>
</tr>
<tr>
<td>
City
</td>
<td>
<input type="text" name="city" tabindex="3">
</td>
<td>
State
</td>
<td>
<select tabindex="4">
<option>
Florida
</option>
<option>
New York
</option>
</select>
</td>
<td>
Zip Code
</td>
<td>
<input type="text" id="zipCode" name="zipCode" tabindex="5">
</td>
</tr>
</table>
</div>
<div id="fragment-2">
<table width="98%" align="center">
<tr>
<td width="20%">
<span style="text-decoration: none; color: black;">Notification
Type</span>
</td>
<td colspan="2">
<input type="text" id="notificationtype" tabindex="6">
</td>
<td>
<span style="color: black">Notificaton Date</span>
</td>
<td colspan="1">
<input type="text" id="notificationDate"
name="notificationDate"
tabindex="7">
</td>
</tr>
</table>
</div>
<div id="fragment-3">
<table width="98%" align="center">
<tr>
<td width="20%">
<span style="text-decoration: none; color: black;">Test
Select</span>
</td>
<td colspan="2">
<select id="testSelect" tabindex="8">
<option>
One thing
</option>
<option>
The other Thing
</option>
</select>
</td>
<td>
<span style="color: black">Test Input</span>
</td>
<td colspan="1">
<input type="text" id="testInput" name="testInput"
tabindex="9">
</td>
</tr>
</table>
</div>
</div>
</body>
</html>