如何将一个div固定到另外一个div的右上角啊?代码如下
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xh...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="zh-CN" xml:lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>显示/隐藏</title>
<style type="text/css">
<!-- /* PR 50198763 */
*{margin:0;padding:0;}
#left,#right,#left1,#right1{height:550px;}
#left{background:#CCC;}
#left1{background:#CCC;}
#right{background:#f5f5f5;}
#right1{background:#f5f5f5;}
.left{float:left;width:20%;display:none;}
.right{float:right;width:97%;display:block;}
.left1{float:left;width:2%;display:block;}
.right1{float:right;width:79%;display:none;}
.p{float:right;position:relative;}
-->
</style>
<script type="text/javascript">
function pr()
{
var L=document.getElementById("left");
var L1=document.getElementById("left1");
var R=document.getElementById("right");
var R1=document.getElementById("right1");
if (L1.className=="left1")
{
L1.style.display="none";
L.style.display="block";
L1.className="left";
R.style.display="none";
R1.style.display="block";
}
else
{
L.style.display="none";
L1.style.display="block";
L1.className="left1";
R1.style.display="none";
R.style.display="block";
}
}
</script>
</head>
<body>
<div id="left" class="left">
<div id="p"><a href="javascript:pr()">A/H</a></div></div>
<div id="left1" class="left1">
<div id="p" style="float:right"><a href="javascript:pr()">A/H</a></div>
</div>
<div id="right" class="right">aaa</div>
<div id="right1" class="right1">bbb</div>
</body>
</html>
我想将点击一次A/H以后那个A/H移到包含它的div的右上角,该如何修改呢? 展开
<html lang="zh-CN" xml:lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>显示/隐藏</title>
<style type="text/css">
<!-- /* PR 50198763 */
*{margin:0;padding:0;}
#left,#right,#left1,#right1{height:550px;}
#left{background:#CCC;}
#left1{background:#CCC;}
#right{background:#f5f5f5;}
#right1{background:#f5f5f5;}
.left{float:left;width:20%;display:none;}
.right{float:right;width:97%;display:block;}
.left1{float:left;width:2%;display:block;}
.right1{float:right;width:79%;display:none;}
.p{float:right;position:relative;}
-->
</style>
<script type="text/javascript">
function pr()
{
var L=document.getElementById("left");
var L1=document.getElementById("left1");
var R=document.getElementById("right");
var R1=document.getElementById("right1");
if (L1.className=="left1")
{
L1.style.display="none";
L.style.display="block";
L1.className="left";
R.style.display="none";
R1.style.display="block";
}
else
{
L.style.display="none";
L1.style.display="block";
L1.className="left1";
R1.style.display="none";
R.style.display="block";
}
}
</script>
</head>
<body>
<div id="left" class="left">
<div id="p"><a href="javascript:pr()">A/H</a></div></div>
<div id="left1" class="left1">
<div id="p" style="float:right"><a href="javascript:pr()">A/H</a></div>
</div>
<div id="right" class="right">aaa</div>
<div id="right1" class="right1">bbb</div>
</body>
</html>
我想将点击一次A/H以后那个A/H移到包含它的div的右上角,该如何修改呢? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询