I am little bit poor with the HTML & javascript.
I am using document.write() method in javascript to populate some data (in table) after clicking on the button. But as i click on the button it populates in the new page. Since my requirement is that, when i click on the plus sign, it should show the connected objects below that sign like tree or structure browser.
So my code is ,
<tr style="{display='none'}">
<td align="center" class="bord"><input type="checkbox" value="<%= strObjectId %>" name="rdel"></td>
<td class="bord"><%= strId %></td>
<td align="center" class="bord"><input type="button" name = "button" value="Plus" onclick ="PopulateData()"/></td>
<!-- <table id="tbl1"> <tr><td class="bord">22</td>
<td class="bord">Part</td>
<td class="bord">part001</td>
<td class="bord">desc</td>
<td class="bord">Owner</td>
<td class="bord">ObjectId</td>
</tr></table>
-->
<td class="bord"><%= strType %></td>
<td class="bord"><a href="ltSearchDocProperties.jsp?" target ="_blank"><%= strName.concat("_").concat(strObjectId) %></a></td>
<td class="bord"><%= strDesc %></td>
<td class="bord"><%= strOwner %></td>
<td align="center" class="bord"><a href="ltFileCheckin.jsp?objectId=<%=strObjectId%>" target ="_blank"><img src="/DMS/images/iconSmallDocumentAttachment.gif"><%= strObjectId %></a></td>
<!--<td class="bord"></td>
<td class="bord"></td>
<td class="bord"></td>-->
<td class="bord"></td>
<td class="bord"></td>
</tr>
And my javascript method is :
function PopulateData()
{ // alert("hello");
document.write("<table><tr><td class=\"bord\">22</td><td>Part</td><td>part001</td> <td>descrip</td><td>Owner</td><td>ObjectId</td></tr></table>");
}
</script>
To achieve this task, I am using a button & calling a function PopulateData() on onclick(). Initially i hard-coded all the values. Using PopulateData() method on onclick is one way. So plz suggest me any other easiest ways so that i could achieve this ?
document.write
can only have any effect if it opens a new document. If you want to modify an existing document then you must use DOM manipulation withdocument.createElement
,document.createTextNode
,document.appendChild
and friends. There are plenty of tutorials out there.