Add label to table cell

I have an HTML table.
The below code is attempting to add a <p> tag to act as a label to show the results of the ajax call.   My attempt is to do the following steps:
1.  identify the parent of the current field, which should be the <td>.
2. Add a <p> to the <td> as a child
3. Populate the <p>

How can I add the label.  I need to keep it dynamic.

here is the err:
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.1.4322)
Timestamp: Sat, 2 Jan 2010 15:20:49 UTC

Message: Type mismatch.

Line: 1063
Char: 3
Code: 0
URI: http://7iprod/ifas7/workflow/custom/SUTTERPPF/common/wfcommon.js

if(id.indexOf("glkey") > -1)
	var glkey = document.getElementById(id).value
	       xmlhttpPost("SUTTERPPF/common/wfbdrvgljukeyobj.asp", "mode=getglkey&glkey=" + glkey)
		var parent = document.getElementById(id).parentNode
		label = parent.appendChild("p") 
		label.innerHTML = responseVal

Open in new window

Who is Participating?
kadabaConnect With a Mentor Commented:
here s the revised code.

if(id.indexOf("glkey") > -1)
	var glkey = document.getElementById(id).value;
	xmlhttpPost("SUTTERPPF/common/wfbdrvgljukeyobj.asp", "mode=getglkey&glkey=" + glkey);
	var parent = document.getElementById(id).parentNode;
	var label = document.createElement("p");
	label.innerHTML = responseVal;

Open in new window

Hello KeithMcElroy,

What's line 1063 in the code snipet ?

KeithMcElroyAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.