Solved

focus/blur mozilla problems

Posted on 2004-09-08
9
281 Views
Last Modified: 2008-02-01
Hi all,

I use the following function without problems in almost any browser (in NS4 does not work, but that is not a problem):

function dF( f, c ){
      var d = window.document.forms[f].elements[c];
      d.blur();
      d.focus();
      if( d.value != "" ){ d.select(); }
}

I call dF in two manners:

1) <body onload="dF('myForm','myField');"> // No problem

2) When current field.maxLength has been reached or enter key is pressed, set focus to next field // Here comes the problems in FireFox

Error: [Exception... "'Permission denied to get property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: /js/TMP9tegb3qfj3.php :: dF :: line 209"  data: no]
Source File: js/TMP9tegb3qfj3.php Line: 209

Any suggestions?

Thanks in advance
0
Comment
Question by:Logan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 12008948
The field to be selected is NOT an <input> field. It is a <select> and therefore you cannot call select() on it.
0
 
LVL 3

Author Comment

by:Logan
ID: 12009088

That's not the problem Zvonko (but thanks!)

The form is:

<body onLoad="dF( 'pepe', 'dni' )">
<form action="#" method="post" name="pepe" id="pepe">
<input name="cif" type="text" maxlength="9" tabindex="1">
<input name="dni" type="text" maxlength="9" tabindex="2">
<input name="nif" type="text" maxlength="9" tabindex="3" onClick="dF( 'pepe', 'cif' )">
</form>
</body>

As u can see there aren't selects :)
0
 
LVL 3

Author Comment

by:Logan
ID: 12009098
btw,

errors are in this lines:

d.blur();
d.focus();
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
ID: 12009153
What FireFox version? Because it works in Mozilla1.7.2
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12009296
Ok, I downloaded Firefox0.9.3 and the strange thing is that the function IS executed even that the exception message occures.
0
 
LVL 3

Author Comment

by:Logan
ID: 12009486
yup, thats the matter
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 400 total points
ID: 12009936
I have four four postings on the net with exact the same symptoms, bot no solution.
I have tried adding fields, remoing tabindex, commenting all calls in the script, disabling popup blocker, testing in save mode, but nothing indicated any solution.

So I am sorry, I see no solution here.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12014924
Thanks for the points.
0
 
LVL 3

Author Comment

by:Logan
ID: 12014937
You earned it :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question