81,094
社区成员
发帖
与我相关
我的任务
分享
<script>
function expand(id)
{
var obj = document.getElementById(id);
if(obj != 'undefined')
{
if(obj.style.display == 'none') obj.style.display = 'block';
else obj.style.display = "none";
}
}
</script>
<a href="#" onclick="expand('test')">+</a> <a href="#" onclick="expand('test')">-</a>
<div style="display:none;border:1px #000000 solid;width:100px;height:100px"
id="test">aaaaa</div>
#content {
font-size: 14px;
width: 100px;
height: 40px;
padding: 10px;
border: 2px #ccc double;
overflow: hidden;
}
#key {
color: red;
float: right;
margin-top: -10px;
}
</style>
<script>
var s=5;
var minheight=50;
var maxheight=150;
function movie(){
var key = document.getElementById("key").innerText;
if(content.style.pixelHeight==0)content.style.pixelHeight=minheight;
if(key=="+"){
content.style.pixelHeight+=s;
if(content.style.pixelHeight<maxheight){
setTimeout("movie();",1);
}else{
document.getElementById("key").innerText="-";
}
}else{
content.style.pixelHeight-=s;
if(content.style.pixelHeight>minheight){
setTimeout("movie();",1);
}else{
document.getElementById("key").innerText="+";
}
}
}
</script>
<div id="content">
电影
<span id="key" onclick="movie();">+</span><br><br>
大话西游,<br>
破坏王<br>
苏乞儿<br>
百变星君<br>
</div>