-1

[Edited question] The javascript code :

var ECM_pos = [ 3,2];
function ECM_display() {
  document.forms["ECM"].elements[0].value = "  " + ECM_pos[0] + "o ";
  document.forms["ECM"].elements[1].value = "  " + ECM_pos[1] + "  ";}

function ECM_coloring(num, mycolor){
  switch (num){
    case 1: document.forms["ECM"].ECM_button1.style.background=mycolor; break;
    case 2: document.forms["ECM"].ECM_button2.style.background=mycolor; break;}}

function ECM_do() {
  ECM_coloring(1, "#2EFEF7"); ECM_coloring(2, "#2EFEF7"); ECM_display();}

when used in the html :

<body onLoad="window.ECM_do();">
<form name="ECM">
 <table >
   <tr> <td>
   <input type="button" name="ECM_button1" value="  A  "
              onClick="window.ECM_do();"> </td>
     <td> <input type="button" name="ECM_button2"
                 value="  2  "
                 onClick="window.ECM_do();"> </td>
     </tr>
     </table>
</form>

gives a deceptive answer: the cell with the 2 is too large. When you click on it, it goes to its normal size. If I change the value 2 in ECM_pos at the beginning or do any other change on this cell: this cells gets properly formatted. It looks like the rendering engine sees whether the content of this cell is new or not. If not new then it is not redone. Else it is. That's about as simple an example as I could get.

This hassle is rather recent, I think. Many thanks for any hints! Best, Olivier

4
  • Any input is welcome - you probably need to fix line 37 Commented May 19, 2018 at 12:19
  • Thanks, I cleared a previous error, the only error that is remaining has to do with $ : the javascript library I load also has some jquery that I use on some other page. But line 37 reads "var Capture_selectedstart=-1; // -1: aucune case de selectionnee " and I don't see what is wrong (except my french grammar :))?
    – Olivier
    Commented May 19, 2018 at 14:05
  • I cleared this last error, so now firefox announces no error -- Which does not mean that something is not lurking somewhere ....
    – Olivier
    Commented May 19, 2018 at 14:20
  • Creating an minimal reproducible example will help. Please edit the question to include the relevant code. Once the page you link to is fixed no one else will be able to use this question to solve their problems, unless the question contains the relevant code. Commented May 19, 2018 at 18:34

1 Answer 1

0

I did not find why the behaviour is like that, but here is a sensible workaround: in the html, put a default value that is distinct from the initialization value :) Anyway this default value will not be used (it was only here to make the code easier to read). Best, O.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.