用按钮输出文字,按钮就会消失 如何解决?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>单击事件 </title>
<script type="text/javascript">
function fontshow(){
var fontshow=document.getElementById("fontshow");
// 给id为fontshow的p标签赋值
fontshow.innerHTML="你好";
}
</script>
</head>
<body>
<form>
<input name="点击我" type="button" value="点击我" onclick="fontshow()"/>
<!--需要重新定义一个标签,才不会替换掉-->
<p id="fontshow"></p>
</form>
</body>
</html><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>单击事件 </title>
<script type="text/javascript">
function fontshow(){
var fontshow=document.getElementById("fontshow");
// 给id为fontshow的p标签赋值
fontshow.innerHTML="你好";
//隐藏点击按钮
document.getElementById("id").style.display="none";
}
</script>
</head>
<body>
<form>
<input name="点击我" id="id" type="button" value="点击我" onclick="fontshow();"/>
<p id="fontshow"></p>
</form>
</body>
</html>
你好,不太懂你的问题,可以说的详细点么?