document.write();
doucment.write会覆盖文档 使用innerHTML可以实现
<script>
window.onload=function()
{
var btn=document.getElementById('click');
var p=document.getElementById('x');
btn.onclick=function()
{
x.innerHTML="你好"
}
}
</script>
</head>
<body>
<input type="button" id="click" value="click" />
<p id="x"></p>