Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

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.