<head>
<script type="text/javascript">
function disp_prompt()
{
var name=prompt("Please enter your name","")
if (name!="")
{
document.getElementById(‘text_show‘).innerHTML="Hello "+name+"!";
}
}
</script>
</head>
<body>
<div id="text_show">
<input type="button" onclick="disp_prompt()"
value="Display a prompt box" />
</div>
</body>
</html>
时间: 2024-10-03 18:43:07