<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math </title>
</head>
<body>
<input name="hah" type="button" value="刷新" onclick="newNum()"/>
<script type="text/javascript">
function newNum(){
document.write(Math.random());
}
</script>
</body>
</html>将 “documen.write”换成“alert”或者“confim”代码就ok了
document.write(document.body.innerHTML);前面加上一句这个。document.write重写了界面,会将原来的全部覆盖掉