点击展开修改成IE,火狐,SAFARI,CHROME兼容的代码 5
<scripttype="text/javascript">functionopenShutManager(oSourceObj,oTargetObj,shutAble,...
<script type="text/javascript">
function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
var openTip = oOpenTip || "";
var shutTip = oShutTip || "";
if(targetObj.style.display!="none"){
if(shutAble) return;
targetObj.style.display="none";
if(openTip && shutTip){
sourceObj.innerHTML = shutTip;
}
} else {
targetObj.style.display="block";
if(openTip && shutTip){
sourceObj.innerHTML = openTip;
}
}
}
</script> 展开
function openShutManager(oSourceObj,oTargetObj,shutAble,oOpenTip,oShutTip){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
var openTip = oOpenTip || "";
var shutTip = oShutTip || "";
if(targetObj.style.display!="none"){
if(shutAble) return;
targetObj.style.display="none";
if(openTip && shutTip){
sourceObj.innerHTML = shutTip;
}
} else {
targetObj.style.display="block";
if(openTip && shutTip){
sourceObj.innerHTML = openTip;
}
}
}
</script> 展开
1个回答
展开全部
您好!很高兴为您答疑!
<div id="a" style="height:100px;width:200px;overflow:hidden;">
测试内容,随便写多少都可以。
</div>
<a href="javascript:void(0)" id="show" onclick="document.getElementById('a').style.height='500px';document.getElementById('hidden').style.display='';document.getElementById('show').style.display='none';">展开</a>
<a href="javascript:void(0)" id="hidden" style="display:none;" onclick="document.getElementById('a').style.height='100px';document.getElementById('hidden').style.display='none';document.getElementById('show').style.display='';">关闭</a>
您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
<div id="a" style="height:100px;width:200px;overflow:hidden;">
测试内容,随便写多少都可以。
</div>
<a href="javascript:void(0)" id="show" onclick="document.getElementById('a').style.height='500px';document.getElementById('hidden').style.display='';document.getElementById('show').style.display='none';">展开</a>
<a href="javascript:void(0)" id="hidden" style="display:none;" onclick="document.getElementById('a').style.height='100px';document.getElementById('hidden').style.display='none';document.getElementById('show').style.display='';">关闭</a>
您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询