onClick调用JS
<input type="button" onclick="test();"/>
<script type="text/javascript">
function a(){
return "hello";
}
function test(){
document.getElementById("show").innerHTML=a();
}
</script>
JS改变Html内容
<script type="text/javascript">
//---------------------
addDiv();
//---------------------
function addDiv(){
var dialog = document.createElement('div');
dialog.className = 'ds-thread';
dialog.setAttribute('data-thread-key',window.location.pathname);
dialog.setAttribute('data-title',window.location.pathname);
dialog.setAttribute('data-url',window.location.href);
document.getElementsByClassName('row')[1].appendChild(dialog);
}
</script>