[Wylug-help] javascript quickie

Gary Stainburn gary.stainburn at ringways.co.uk
Wed Nov 26 12:07:20 UTC 2008


Hi folks.

I've got the following HTML which works:

<td
  id="td_pdi_23096"
  bgcolor=#ff9999 
  title="Click to set" 
  onclick="GooleSetPDI(23096,'t');return false;"
>
P.D.I.<br>Pinnacle not raised
</td>

GooleSetPDI is called, the AJAX function runs and the the response is 
received.

Then, in the respose javascript I have:

  var TD=document.getElementById('td_pdi_'+response[1]);
  if (TD) {
    if (response[2] == 't') {
      TD.style.backgroundColor='#99ff99';
      TD.innerHTML='P.D.I.<br>Pinnacle raised';
      TD.onclick="GooleSetPDI("+response[1]+",'f');return false;";
    } else {
      TD.style.backgroundColor='#ff9999';
      TD.innerHTML='P.D.I.<br>Pinnacle not raised';
      TD.onclick="GooleSetPDI("+response[1]+",'t');return false;";
    }
  }
  else
    alert("The records were updated, but an error occured updating the 
screen");

The TD changes colour, the TD content changes, but the onclick stops working.

Anyone know what stupid mistake I've made?
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



More information about the Wylug-help mailing list