Solved

focus/blur mozilla problems

Posted on 2004-09-08
9
279 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
  • 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
Technology Partners: 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bootstrap Form 16 37
Why is initMap returning "not a function" error. 3 64
Date on a table 16 33
converting document.write() to innerHTML 7 42
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

679 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