<html>
<body>
<p>单击按钮等待 3 秒,然后提示“Hello”。</p>
<button onclick="myFunction()">试一试</button>
<script>
var myVar;
function myFunction() {
myVar = setTimeout(alertFunc, 3000);
}
function alertFunc() {
alert("Hello!");
}
</script>
</body>
</html>