[Javascript] (no subject)

Kim Hoogenberg kim.hoogenberg at virgil.nl
Fri Jan 14 04:41:18 CST 2005


Hi Roger,

Every javascript window object has its own execution context. When some 
frame has loaded its script from a different hostname, protocol or 
webcontext, it may not read or write properties from/to another window 
object (i.e. frame) on the same page. This might be your problem. Can 
you tell me something more about frames you're using and the sources 
(URL's) that are loaded into it?

Thanks,

Kim

> Hi Roger.
>
> I have had the same error message a number of times, it seems that the 
> little popup with previously filled in values is getting permission 
> errors becuase the state of the element is changed through JavaScript 
> and not by 'pure' user interaction.
>
> I'm afraid I have no real solution, I'll just advice you to wrap that 
> one line of code i a try-catch statement to avoid showing the error.
>
> To switch to the next element in tab order, I think you'll have to run 
> over all elements in the form.elements[]-array and look for 
> currentTabIndex+1, and then focus that element. Not sure, but that 
> would be my immidiate solution.
>
> Regards,
> H
>
> Roger Roelofs wrote:
>
>> Dear list.
>>
>> I'm working on a project for large amounts of data entry via the 
>> web.  I have a routine (pasted below) that examines the content of 
>> the current entry field and automatically goes to the next field when 
>> the correct number of characters have been typed.  The function works 
>> well except for two problems.
>>
>> 1.  The line 'nextElem.focus();' generates an error, but works 
>> anyway.  Here's the error text.
>> --------------   error text   -----------
>> 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 :: 
>> http://rer2.datacomp-intranet.com/js/util.js :: smartJump :: line 
>> 414"  data: no]
>> ----------------------------------------
>>
>> 2.  My routine gets the next form element based on source order, not 
>> based on tab order as specified by the tabindex attribute.
>>
>> Any ideas about how to deal with these issues?
>>
>> -----------  code  -------------
>> function smartJump(e, maxLen, skipVal, nextElem, flip) {
>>     if (arguments.length < 3) {
>>         skipVal = ""
>>     }
>>     if (arguments.length < 5) {
>>         flip = ""
>>     }
>>         var isNN = (e.target);
>>     if (!e) e = window.event;
>>     var myKeyCode = (isNN) ? e.which : e.keyCode;
>>     var mySource = (isNN) ? e.target : e.srcElement
>>     var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
>>     if((mySource.value.length >= maxLen) && 
>> !containsElement(filter,myKeyCode)) {
>>         mySource.value = trim(mySource.value.slice(0, maxLen));
>>         if (arguments.length < 4) {
>>             nextElem = null;
>>         }
>>         if(((flip == "flip") && ( mySource.value == skipVal )) ||
>>             ((flip == "") && ( mySource.value != skipVal ))){
>>             nextElem = null;                   }
>>         if (!nextElem) {
>>             nextElem = mySource.form.elements[(getIndex(mySource)+1)];
>>         }           nextElem.focus();  // <-- generates err in Moz, 
>> but works anyway
>>         nextElem.select();
>>     }
>>     return true;
>> }
>>
>> function getIndex(input) {
>>     var index = -1, i = 0, found = false;
>>     while (i < input.form.length && index == -1) {
>>         if (input.form[i] == input) index = i;
>>         else i++;
>>     }
>>     return index;
>> }
>>
>> TIA
>>
>> Roger
>> -------------------------------------------------------
>> Roger Roelofs                 web   www.datacompusa.com
>> Datacomp Appraisal Services   web   www.mhvillage.com
>> 3215 Eaglecrest Drive, NE     Email rer at datacompusa.com
>> Grand Rapids, MI  49525-4593 
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list