Logan
asked on
focus/blur mozilla problems
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].e lements[c] ;
d.blur();
d.focus();
if( d.value != "" ){ d.select(); }
}
I call dF in two manners:
1) <body onload="dF('myForm','myFie ld');"> // 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::sel ectedIndex ]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STR ING)" location: "JS frame :: /js/TMP9tegb3qfj3.php :: dF :: line 209" data: no]
Source File: js/TMP9tegb3qfj3.php Line: 209
Any suggestions?
Thanks in advance
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].e
d.blur();
d.focus();
if( d.value != "" ){ d.select(); }
}
I call dF in two manners:
1) <body onload="dF('myForm','myFie
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::sel
Source File: js/TMP9tegb3qfj3.php Line: 209
Any suggestions?
Thanks in advance
The field to be selected is NOT an <input> field. It is a <select> and therefore you cannot call select() on it.
ASKER
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 :)
ASKER
btw,
errors are in this lines:
d.blur();
d.focus();
errors are in this lines:
d.blur();
d.focus();
What FireFox version? Because it works in Mozilla1.7.2
Ok, I downloaded Firefox0.9.3 and the strange thing is that the function IS executed even that the exception message occures.
ASKER
yup, thats the matter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points.
ASKER
You earned it :)