我感觉没有错误,为什么点击按钮不能按照要求显示和隐藏
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>显示及隐藏</title>
</head>
<body>
<script type="text/javascript">
var Q=document.getElementById("q");
Q.style.color="red";
function x(){
Q.style.display="none";}
function y(){
Q.style.display="block";}
<h2 id="q">穷</h2>
</script>
<p>想住的好,为什么不买个别墅呢?</br>
因为</p>
<form>
<input type="button" onclick="x()" value="tell me" />
<input name="按钮" type="button" onclick="y()" value="not my bussiness" />
</form>
</body>
</html>
ReWorld
相关分类