<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'help with onclick' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'help with onclick' posted on the 'JavaScript' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 03:52:57 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 03:52:57 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>help with onclick</title>
      <link>http://www.programmersheaven.com/mb/java-script/239151/239151/help-with-onclick/</link>
      <description>I have created a web page with a table that needs to add a row when the Add Row button is clicked.  How do I capture the click event and do a loop to create another row in the table?  &lt;br /&gt;
&lt;br /&gt;
Thanks for the help!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/239151/239151/help-with-onclick/</guid>
      <pubDate>Wed, 28 Jan 2004 08:24:17 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: help with onclick</title>
      <link>http://www.programmersheaven.com/mb/java-script/239151/239156/re-help-with-onclick/#239156</link>
      <description>&lt;pre class="sourcecode"&gt;&amp;lt;input type="button" onClick="addrow()"&amp;gt;

function addrow() {
with (document)
var table = (getElementById)? getElementById('table') : all['table'];

table.addRow();
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I haven't tested that, and I may have done some things I shouldn't, but it should give you the general idea.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/239151/239156/re-help-with-onclick/#239156</guid>
      <pubDate>Wed, 28 Jan 2004 09:11:05 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: help with onclick</title>
      <link>http://www.programmersheaven.com/mb/java-script/239151/239424/re-help-with-onclick/#239424</link>
      <description>: &lt;pre class="sourcecode"&gt;&amp;lt;input type="button" onClick="addrow()"&amp;gt;
: 
: function addrow() {
: with (document)
: var table = (getElementById)? getElementById('table') : all['table'];
: 
: table.addRow();
: }&lt;/pre&gt;&lt;br /&gt;
: &lt;br /&gt;
: I haven't tested that, and I may have done some things I shouldn't, but it should give you the general idea.&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
I got this code to work but how do I add a check box not just text to the table?  &lt;br /&gt;
td1.appendChild(document.createTextNode("want a check box here"))&lt;br /&gt;
Thanks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
function addRow(id){
    var tbody = document.getElementById
    (id).getElementsByTagName("TBODY")[0];
    var row = document.createElement("TR")
    var td1 = document.createElement("TD")
    td1.appendChild(document.createTextNode("column 1"))  //how do I get a check box or a text field?
    var td2 = document.createElement("TD")
    td2.appendChild (document.createTextNode("column 2"))
    row.appendChild(td1);
    row.appendChild(td2);
tbody.appendChild(row);
  }

&amp;lt;a href="javascript:addRow('myTable')"&amp;gt;Add row&amp;lt;/a&amp;gt;

&amp;lt;table id="myTable" cellspacing="0" border="1"&amp;gt;
  &amp;lt;tbody&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;row1_column1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;row1_column1&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/tbody&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/239151/239424/re-help-with-onclick/#239424</guid>
      <pubDate>Thu, 29 Jan 2004 09:08:07 -0700</pubDate>
      <category>JavaScript</category>
    </item>
    <item>
      <title>Re: help with onclick</title>
      <link>http://www.programmersheaven.com/mb/java-script/239151/239578/re-help-with-onclick/#239578</link>
      <description>var check = document.createElement('input');&lt;br /&gt;
check.setAttribute('type','check');&lt;br /&gt;
td1.appendChild(check);&lt;br /&gt;
&lt;br /&gt;
I think that's the one.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java-script/239151/239578/re-help-with-onclick/#239578</guid>
      <pubDate>Fri, 30 Jan 2004 00:24:20 -0700</pubDate>
      <category>JavaScript</category>
    </item>
  </channel>
</rss>