<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<details id="details" οnclick="onc(this)">
<summary>我爱我家</summary>
<P style="display: none;" id="p">超级好看的温情的哭戏,你准备和我一起哭了吗?</P>
</details>
</body>
<script>
function onc(details){
var p=document.getElementById("p");
if(details.open){
p.style.display="none";
}else{
p.style.display="block";
}
}
</script>
</html>
点击summary标签,可将<p>元素伸缩或显示