troubleshooting Question

innerhtml not ouputting <TD>s

Avatar of Sailing_12
Sailing_12 asked on
Web Languages and StandardsJavaScript
4 Comments1 Solution525 ViewsLast Modified:
I'm having a problem with the attached code - everything works pretty good except that my hard-coded <td> and </td> tags are not being output from the innerHTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add/Remove child: Javascript</title>
function addEvent() {
  var ni = document.getElementById('dynTable');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById("theValue").value -1)+ 2;
  numi.value = num;
  var rowIdName = "row"+num;
  var newrow = document.createElement('tr');
  newrow.innerHTML = num + "<td><input type=\"text\" name=\"stockNumber" + num + "\" /></td><td><input type=\"text\" name=\"quantity" + num + "\" /></td><td><input type=\"text\" name=\"reason" + num + "\" /></td><td><a href=\"javascript:;\" onclick=\"removeElement(\'"+rowIdName+"\')\">Remove </a></td>";
function removeElement(rowNum) {
  var d = document.getElementById('dynTable');
  var oldrow = document.getElementById(rowNum);
	<cfform action="confirm.cfm" name="rmaForm">
    <input type="hidden" value="0" id="theValue" />
	<table border="1" id="dynTable">
    <p><a href="javascript:;" onclick="addEvent();">Add additional items</a> - must be from same order.</p>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros