クリックで出たり消えたりするだけのjavascript

この記事をシェアする

  • ツイッターでシェアする
  • facebookでシェアする
  • google+でシェアする
  • はてぶにブックマークする

無駄な動き無しで、jQuery無しで、出したり消えたりするだけのjavascriptの備忘録。

 

<!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>

<script type="text/javascript">
<!--
function hidebox(){
document.getElementById("boxblock").style.display = "none";
}
function showbox() {
document.getElementById("boxblock").style.display = "block";
}
window.onload = function(){
hidebox();
};
//-->
</script>

</head>

<body>

<form id="f1" action="#">
<p><input type="button" value="出現" onclick="showbox()"> <input type="button" value="消失" onclick="hidebox()"></p>

<div id="boxblock">
(゜Д゜)ノ
</div>

</form>

</body>
</html>

 

サンプル↓

(゜Д゜)ノ