Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: Help Urgently Needed: How to update table text from JS?


Message #1 by "Robert Nyman" <robert.nyman@c...> on Mon, 18 Nov 2002 18:23:07 +0100
Robert,

Many thanks for this perfect solution!  I'm learnin'!!

Pete

-----Original Message-----
From: Robert Nyman [mailto:robert.nyman@c...]
Sent: Monday, November 18, 2002 12:23 PM
To: javascript
Subject: [javascript] SV: Help Urgently Needed: How to update table text
from JS?


It depends on what browsers you're targetting (as always),
but for IE 4+ and Netscape 6+ you can use the innerHTML property:

document.getElementById("pendingTD").innerHTML = "Pending";

<td id="pendingTD"></td>


/Robert



-----Ursprungligt meddelande-----
Från: Peter Kipe [mailto:pkipe@c...]
Skickat: den 18 november 2002 17:06
Till: javascript
Ämne: [javascript] Help Urgently Needed: How to update table text from
JS?


I originally posted this on beginning_javascript, but haven't had a
response yet, so I'm posting to this group.

I'm putting together a prototype of a design concept and need a little
help.

I have a form containing a table that has a checkbox in the first
column,
a blank second column, and remaining columns filled with text.  When the

checkbox is clicked, the JS puts up a popup that captures a couple of
things, then closes.

For this prototype, I want to also put the text "Pending" in the second
column on the same row as the checked checkbox.  This is where I'm stuck
-
I can't figure out how to make the cell addressible from JS.

Here's the JS:

    <script type="text/javascript"><!--
      function GetReasonAmerican() {
        var CheckedHold = document.Payees.American.checked;
        if (CheckedHold == true)
          var CancelHold = showModalDialog("popup.htm",
GetReasonAmerican, "dialogHeight:195px; dialogWidth:540px; resizable:no;

help:no; center:yes")
          if (CancelHold == "true")
            {document.Payees.American.checked = false;}
      }
      //-->
    </script>

And here's the table row definition:

    <tr>
      <td align="center" valign="top" width="4%">
        <input type="checkbox" name="American" value="ON"
onClick="Javascript:GetReasonAmerican()">
      </td>
      <td align="left" valign="top" bgcolor="#F2F8FC"
width="9%">&nbsp;</td>
      <td align="left" valign="top" width="163%">American General
Reinsurance Company</td>
      <td align="right" valign="top" width="10%">12,000.00-</td>
    </tr>

I would prefer not to have an input text box appear in the cell
position,
just the text "Pending".  Can anyone help?

Thanks in advance,

Pete




  Return to Index