jwright9
asked on
Unable to assign a string value to an innerHTML data member in javascript
This is my JSP with html and javascript:
<div id="myPageResultContentDiv " style='display:none'>
<table id='myPageContentTable' class="content" style="width: 995px;">
<thead>
<tr id="0">
<th style="width: 104px;" class="active"><a id="sc0" name="sc0" href="javascript:void(0)" onClick="javascript:redoSo rt(0);">Se rial Number</a></th>
<th style="width: 130px;" class="active"><a id="sc1" name="sc1" href="javascript:void(0)" onClick="javascript:redoSo rt(1);">Pr oduct Name</a></th>
<th style="width: 210px;" class="active"><a id="sc2" name="sc2" href="javascript:void(0)" onClick="javascript:redoSo rt(2);" class="down">Marketing Program Name</a></th>
<th style="width: 210px;" class="active">Marketing Program Description</th>
<th style="width: 30px;">Remove</th>
</tr>
</thead>
</table>
</div>
I'm trying to populate most of the table using this line:
document.getElementById('m yPageConte ntTable'). innerHTML= strVar;
strVar is a string that contains <tr> and <td> tags that are rows that I want to insert into the table myPageContentTable using the innerHTML data member. When I try to do it the header is not showing at all in my table. Any suggestions?
<div id="myPageResultContentDiv
<table id='myPageContentTable' class="content" style="width: 995px;">
<thead>
<tr id="0">
<th style="width: 104px;" class="active"><a id="sc0" name="sc0" href="javascript:void(0)" onClick="javascript:redoSo
<th style="width: 130px;" class="active"><a id="sc1" name="sc1" href="javascript:void(0)" onClick="javascript:redoSo
<th style="width: 210px;" class="active"><a id="sc2" name="sc2" href="javascript:void(0)" onClick="javascript:redoSo
<th style="width: 210px;" class="active">Marketing Program Description</th>
<th style="width: 30px;">Remove</th>
</tr>
</thead>
</table>
</div>
I'm trying to populate most of the table using this line:
document.getElementById('m
strVar is a string that contains <tr> and <td> tags that are rows that I want to insert into the table myPageContentTable using the innerHTML data member. When I try to do it the header is not showing at all in my table. Any suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try something likr this:
Open in new window