<a id="demo" href="#" οnclick="aaa">AAAA</a>
<script> /*这个要放在<a>下面,文档从上往下读,如果放在<a>的上面会读不到id="demo"的对象而失去作用,但是aaa()却可以引用到*/
document.getElementById("as").style.backgroundColor ="red";
function aaa(){document.getElementById("as").innerHTML="更换字";}
</script>