I wrote the code to refresh DIV container once function click_function_ps() is executed. But my code does not work. It says:
missing ; before statement
var newHTML = "<img class="displayed" src="ganttchart.php">";
So, where do I need to put ; ?
<div class="buttons">
<a href="#" class="regular" onclick="click_function_ps(); replaceContent();">
<img src="images/opt.png" alt=""/> Run </a>
</div>
<div id="opt_container">
<table width="100%">
<tr>
<td width="100%">
<div class="scrollbar" id="chart">
<img class="displayed" src="ganttchart.php">
</div>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function replaceContent() {
var newHTML = "<img class="displayed" src="ganttchart.php">";
document.getElementById("scrollbar").innerHTML = newHTML;
}
</script>
Try this
Also, there is no element with the ID
scrollbar. Either change the DIV fromclass="scrollbar"toid="scrollbar"or use IDchartright away or replace the javascript by followingdocument.getElementsByClassName("scrollbar")[0]. But keep in mind, thatgetElementsByClassName()is not supported by IE. I highly recommend usingidinstead ofclass.