Αυτός ο ιστότοπος θα έχει περιορισμένη λειτουργικότητα, όσο εκτελούμε εργασίες συντήρησης για να βελτιώσουμε την εμπειρία σας. Αν ένα άρθρο δεν επιλύει το ζήτημά σας και θέλετε να κάνετε μια ερώτηση, η κοινότητα υποστήριξής μας είναι έτοιμη να σας βοηθήσει στο Twitter (@FirefoxSupport) και στο Reddit (/r/firefox).

Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά κατάχρησης».

Μάθετε περισσότερα

javascript settimer broken FF 73.0

  • 2 απαντήσεις
  • 1 έχει αυτό το πρόβλημα
  • 1 προβολή
  • Τελευταία απάντηση από jamescobban

more options

I have the following Javascript code which has been working for over 10 years and still works on Chrome, but does not work on FF 73.0 on Ubuntu Linux.

```

/************************************************************************

*  timer														        *
*																		*
*  This timer is started whenever the user presses a key in the input	*
*  field and pops if 0.9 second passes without a new keystroke			*
************************************************************************/

var timer = null;

/************************************************************************

*  function onKeyDownName												*
*																		*
*  This method is called when a key is pressed in the Name field.		*
*  A timer is set so that when the user stops typing the selection		*
*  list is repopulated.												*
*																		*
*  Input:																*
*		event	if passed, event.keyCode identifies the key pressed		*
*				in older releases of Internet Explorer use window.event	*
************************************************************************/

function onKeyDownName(event) {

   if (timer)

clearTimeout(timer);

   timer	= setTimeout(update, 900);

} // function onKeyDownName

/************************************************************************

*  function update														*
*																		*
*  This method is called when the user stops typing to repopulate		*
*  the selection list based upon the current contents of the Name		*
*  field.  It is also the onchange method for the following fields:	*
*  'birthmin', 'birthmax', 'incMarried', 'includeParents',				*
*  'includeSpouse', and 'Sex', and it is called by the onchange		*
*  method for the field 'treeName'.									*
************************************************************************/

function update() {

   var	form	= document.nameForm;
   if (form)
   {		// form present

var url = "/FamilyTree/getIndivNamesXml.php"; ... code to complete url by appending values of elements from form // invoke script to obtain list of names for selection list HTTP.getXML(url, // see O'Reilly Javascript gotNames, noNames);

// clear out the old selection list while we are waiting var select = form.individ; select.options.length = 0;

// put a dummy entry at the top of the selection, otherwise // selecting the first name does not call onchange var name = '[choose an individual]'; var option = new Option(name, -1, false, false); option.innerHTML = '[choose an individual]'; select.appendChild(option);

   }		// form present
   else
       alert("nominalIndex.js:update: cannot find form");

} // function update ```


When I put alerts into nameOnKeyDown and update I see that nameOnKeyDown is called but update is never called.

You can see the above code in action at https://www.jamescobban.net/FamilyTree/nominalIndex.php?name=allenby,%20a&treename=&lang=en

This code has worked for over 10 years, and still is working today on Chrome, but the timer never pops on Firefox 73.0 on Ubuntu Linux 19.10.

I have the following Javascript code which has been working for over 10 years and still works on Chrome, but does not work on FF 73.0 on Ubuntu Linux. ``` /************************************************************************ * timer * * * * This timer is started whenever the user presses a key in the input * * field and pops if 0.9 second passes without a new keystroke * ************************************************************************/ var timer = null; /************************************************************************ * function onKeyDownName * * * * This method is called when a key is pressed in the Name field. * * A timer is set so that when the user stops typing the selection * * list is repopulated. * * * * Input: * * event if passed, event.keyCode identifies the key pressed * * in older releases of Internet Explorer use window.event * ************************************************************************/ function onKeyDownName(event) { if (timer) clearTimeout(timer); timer = setTimeout(update, 900); } // function onKeyDownName /************************************************************************ * function update * * * * This method is called when the user stops typing to repopulate * * the selection list based upon the current contents of the Name * * field. It is also the onchange method for the following fields: * * 'birthmin', 'birthmax', 'incMarried', 'includeParents', * * 'includeSpouse', and 'Sex', and it is called by the onchange * * method for the field 'treeName'. * ************************************************************************/ function update() { var form = document.nameForm; if (form) { // form present var url = "/FamilyTree/getIndivNamesXml.php"; ... code to complete url by appending values of elements from form // invoke script to obtain list of names for selection list HTTP.getXML(url, // see O'Reilly Javascript gotNames, noNames); // clear out the old selection list while we are waiting var select = form.individ; select.options.length = 0; // put a dummy entry at the top of the selection, otherwise // selecting the first name does not call onchange var name = '[choose an individual]'; var option = new Option(name, -1, false, false); option.innerHTML = '[choose an individual]'; select.appendChild(option); } // form present else alert("nominalIndex.js:update: cannot find form"); } // function update ``` When I put alerts into nameOnKeyDown and update I see that nameOnKeyDown is called but update is never called. You can see the above code in action at https://www.jamescobban.net/FamilyTree/nominalIndex.php?name=allenby,%20a&treename=&lang=en This code has worked for over 10 years, and still is working today on Chrome, but the timer never pops on Firefox 73.0 on Ubuntu Linux 19.10.

Τροποποιήθηκε στις από το χρήστη jamescobban

Επιλεγμένη λύση

Hi jamescobban

This is a user support focused forum and because of this there aren't many folks who can answer developer questions like your question.

The best place is stack overflow: https://stackoverflow.com/questions/tagged/firefox

More details: https://support.mozilla.org/en-US/kb/where-go-developer-support

Cheers!

...Roland

Ανάγνωση απάντησης σε πλαίσιο 👍 0

Όλες οι απαντήσεις (2)

more options

Επιλεγμένη λύση

Hi jamescobban

This is a user support focused forum and because of this there aren't many folks who can answer developer questions like your question.

The best place is stack overflow: https://stackoverflow.com/questions/tagged/firefox

More details: https://support.mozilla.org/en-US/kb/where-go-developer-support

Cheers!

...Roland

more options

Thank you for looking at my report.

This wasn't a developer question because I wasn't asking how to get the code working. It was a caution that I had observed a specific problem on a specific release of Firefox that was not observed on other browsers. However the problem has now gone away as mysteriously as it appeared with no changes to any of my code.