Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to insert an entire Table using innerHTML in javascript
    primarykey
    data
    text
    <p>I have form that I want people to fill out but if they are already members I would like them to check a check box and the form which is in a table to switch to a sign in form which is also in a table. Is there a way to to this?</p> <p>here is some of the code: </p> <pre><code>function CheckMember() { // Function to Check if Check box is Checked var ismember = document.getElementById('checkbox').value; // Check if ismember = 0 if (ismember == '1') { document.getElementById("forms").innerHTML = "&lt;table width='25%' border='0' cellpadding='5' cellspacing='5' bgcolor='#&lt;?php echo $tablebg; ?&gt;'&gt; &lt;tr&gt;&lt;td align='center' colspan='3'&gt; &lt;span class='style1'&gt;Already a Member?&lt;/span&gt; &lt;input id='checkbox' type='checkbox' value='1' name='ismemeber' class='style2' onclick='CheckMember()' /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td nowrap='nowrap'&gt;&lt;div align='center'&gt;&lt;span class='style1'&gt;&lt;h3&gt;Please enter username and password&lt;/h3&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td align='center'&gt;&lt;span class='style1'&gt;Login:&lt;/span&gt;&lt;br /&gt;&lt;input type='input' name='access_login' class='style2' /&gt;&lt;br /&gt;&lt;span class='style1'&gt;Password:&lt;/span&gt;&lt;br /&gt;&lt;input type='password' name='access_password' class='style2' /&gt;&lt;p&gt;&lt;/p&gt;&lt;input type='submit' name='Submit' value='Submit' class='style2' /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; // If ismember is anything else else document.getElementById("forms").innerHTML = "&lt;table width='25%' border='0' cellpadding='5' cellspacing='5' bgcolor='#&lt;?php echo $tablebg; ?&gt;'&gt; &lt;tr&gt;&lt;td align='center'&gt;Already a Member? &lt;input id='checkbox' type='checkbox' name='ismemeber' onclick='CheckMember()' /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td nowrap='nowrap'&gt;&lt;div align='left'&gt;&lt;span class='style1'&gt;First Name&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;span class='style1'&gt;:&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;div align='left'&gt;&lt;input type='text' name='ffname' class='style2' maxlength='25' /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td nowrap='nowrap'&gt;&lt;div align='left'&gt;&lt;span class='style1'&gt;Middle Initial&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;span class='style1'&gt;:&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;div align='left'&gt;&lt;input name='fmname' type='text' class='style2' size='3' maxlength='1' /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td nowrap='nowrap'&gt;&lt;div align='left'&gt;&lt;span class='style1'&gt;Last Name&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;span class='style1'&gt;:&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;div align='left'&gt;&lt;input type='text' name='flname' class='style2' maxlength='25'/&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td colspan='3'&gt;&lt;input type='hidden' name='submitted' value='1' /&gt;&lt;span class='style1'&gt;Yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;No&lt;/span&gt;&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td colspan='3'&gt;&lt;center&gt;&lt;input type='submit' value='Submit' /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type='reset' value='Reset' /&gt;&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td colspan='3' nowrap='nowrap'&gt;&lt;center&gt;&lt;span class='style5'&gt;All Fields are Required&lt;/span&gt;&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; }; &lt;/script&gt; </code></pre> <p>HTML Portion:</p> <pre><code>&lt;div id="forms"&gt;CHANCE THIS&lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload