Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2012 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2935060 to your computer and use it in GitHub Desktop.
Save anonymous/2935060 to your computer and use it in GitHub Desktop.
JavaScriptとCSSについて質問です。 要素の折りたたみを行いたい.. - 人力検索はてな http://q.hatena.ne.jp/1339739700
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
function showHide(foldingID) {
if( document.getElementById(foldingID)){
if( document.getElementById(foldingID).style.display == "none"){
document.getElementById(foldingID).style.display = "block";
}
else{
document.getElementById(foldingID).style.display = "none";
}
}
}
</script>
</head>
<body>
<a href="#" onClick="showHide('test');return false;">test</a>
<table>
<td>aa</td>
<td>bb</td>
<div id="test" style="display: none">
<td>cc</td>
</div>
<td>dd</td>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment