如何在执行函数Click_Functionps()时刷新DIV容器?

我编写了一段代码,想要在执行函数Click_Functionps()时刷新DIV容器代码。但我的代码不起作用,上面写着:

missing ; before statement
var newHTML = "<img class="displayed" src="ganttchart.php">";

那么,我应该把;放在哪里?

<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

var newHTML = "<img class=\"displayed\" src=\"ganttchart.php\">";

Also, there is no element with the ID scrollbar. Either change the DIV from class="scrollbar" to id="scrollbar" or use ID chart right away or replace the javascript by following document.getElementsByClassName("scrollbar")[0]. But keep in mind, that getElementsByClassName() is not supported by IE. I highly recommend using id instead of class.

You haven't escape double-quote in this part :

function replaceContent() {
   var newHTML = "<img class=\"displayed\" src=\"ganttchart.php\">";
   document.getElementById("scrollbar").innerHTML = newHTML;
}

You can try these: -

<div class="buttons">
    <a href="#" class="regular" id="scrollbar" 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>

This type of error will not come if you will use any IDE(netbeans etc).. Because IDE check your syntax error while your are doing code..