Wrox Home  
Search P2P Archive for: Go

  Return to Index  

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


Message #1 by "Peter Kipe" <pkipe@c...> on Mon, 18 Nov 2002 17:05:51
Joe,

It's not working for some reason.  When I click the checkbox, I get the
message "Error on page" with a warning icon in IE6's status bar, and the
popup doesn't appear.  When I move the cursor off of the checkbox, the
message changes to "Done", but it's still prefixed with the warning icon.
Here's what I have for the function:

    <script type="text/javascript"><!--
      function GetHoldReason(this)
       {if (this.checked)
         {var CancelHold = showModalDialog("popup.htm", GetReasonAmerican,
"dialogHeight:195px; dialogWidth:540px; resizable:no; help:no; center:yes");
          if (CancelHold == "true")
           {this.checked = false;
            this.parentElement.parentElement.cells[1].innerHTML = "";}
          else
           {this.parentElement.parentElement.cells[1].innerHTML 
"Pending";}
         }
        else
         {this.parentElement.parentElement.cells[1].innerHTML = "";}
       }
    //-->
    </script>

Here's the HTML:

    <tr>
      <td align="center" valign="top" width="4%">
        <input type="checkbox" value="ON"
onclick="JavaScript:GetHoldReason(this)">
      </td>
      <td align="center" valign="top" width="9%"
id="HoldPending">&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>

Can you see what I'm doing wrong?

Also, you asked why I'm still passing a function pointer.  I presume you're
referring to the second parameter in the showModalDialog statement --
GetReasonAmerican.  That code was in something I started this function
from -- can I just remove the reference and keep the delimiting comma?
Remember, I'm depending upon CancelHold (in this function) to tell me if the
popup was closed via a Save button, or by a Cancel button, both of which are
contained in popup.htm.  The following function is contained in popup.htm:

    <script language="javascript">
      function SetCancel(value)
      {if (value == "true")
	  {window.returnValue = "true";}
       else
	  {window.returnValue = "false";}

       window.close();
      }
    </script>

Pete


  Return to Index