<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Splitter</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../theme/default/style.css"type="text/css">
<link rel="stylesheet" href="../css/map-style.css" type="text/css"> <link href="../css/demo.css" rel="stylesheet" type="text/css" />
<script src="../scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="../scripts/miniui/miniui.js" type="text/javascript"></script>
<link href="../scripts/miniui/themes/default/miniui.css" rel="stylesheet" type="text/css" />
<link href="../scripts/miniui/themes/icons.css" rel="stylesheet" type="text/css" />
<script t type="text/javascript" src="../lib/OpenLayers.js"></script>
<script t type="text/javascript" src="../js/custom-map-operator.js"></script>
<script t type="text/javascript" src="../js/custom-map-trunck.js"></script> <script type="text/javascript">
</script>
<style type="text/css">
#text {
position: absolute;
top: 5em;
right: 1em;
width: 100px;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
}
</style>
</head>
<body style="width:99%;height:100%;margin:0px 0px 0px 0px" onload="init()"></div> <div id="map" style="width:100%; height:94%; border: 2px solid #ccc; "></div> <div id="text" style=" border: 2px solid #ccc; " >
<p>临时订阅组</p>
</div>
</div>
<div showCollapseButton="true" minSize="0" size="0">
<input value="增加图层" type="button" onclick="addLayer()"></input> </div>
</div> <script type="text/javascript">
mini.parse();function init(){}
var listId=0;
var count=0;
var linshi="linshi_"
function addLayer(name,color ){var name="ccc";
var color="#FF0000"
listId++;
count++;
if(count>10){
alert("只允许10条线路的添加!!");
return false;
}
$('#text').append(
'<div style="display:inline" id=linshi_'+listId+'>' +
'<input type=checkbox id=check_'+listId+' onclick="check(this)"/>' +
'<p style="display:inline;color:'+color+'" >'+name+'</p> ' +
'<img src="../scripts/miniui/themes/icons/remove.gif" alt="删除临时订阅" onclick="removeLayer(this)" name=linshi_'+listId+' /></div></br>'); return true;
}
////删除临时订阅的操作
function removeLayer(evt){
var divId=evt.name;
count--;
var div =document.getElementById(divId);
//document.getElementById(divId).removeNode(true);
div.onclick = function(){
this.parentNode.removeChild(this);
} var divText =document.getElementById("text"); divText.style.display=='none';
divText.style.display=='block';
}
//选中临时订阅
function check(evt){
var ee=evt;
} </script></body>
</html> 这是我写的一个测试用例 动态添加和删除 div
但是在删除div 之后 父亲div 不能很好的自适应打大小了 不能收缩回到原来的大小了 请高人指点一下子 应该怎么设置 在线等答案了 要是不明白我说的 您可以运行一下子 就看出问题了 谢谢了 O(∩_∩)O~
<head>
<title>Splitter</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../theme/default/style.css"type="text/css">
<link rel="stylesheet" href="../css/map-style.css" type="text/css"> <link href="../css/demo.css" rel="stylesheet" type="text/css" />
<script src="../scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="../scripts/miniui/miniui.js" type="text/javascript"></script>
<link href="../scripts/miniui/themes/default/miniui.css" rel="stylesheet" type="text/css" />
<link href="../scripts/miniui/themes/icons.css" rel="stylesheet" type="text/css" />
<script t type="text/javascript" src="../lib/OpenLayers.js"></script>
<script t type="text/javascript" src="../js/custom-map-operator.js"></script>
<script t type="text/javascript" src="../js/custom-map-trunck.js"></script> <script type="text/javascript">
</script>
<style type="text/css">
#text {
position: absolute;
top: 5em;
right: 1em;
width: 100px;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
}
</style>
</head>
<body style="width:99%;height:100%;margin:0px 0px 0px 0px" onload="init()"></div> <div id="map" style="width:100%; height:94%; border: 2px solid #ccc; "></div> <div id="text" style=" border: 2px solid #ccc; " >
<p>临时订阅组</p>
</div>
</div>
<div showCollapseButton="true" minSize="0" size="0">
<input value="增加图层" type="button" onclick="addLayer()"></input> </div>
</div> <script type="text/javascript">
mini.parse();function init(){}
var listId=0;
var count=0;
var linshi="linshi_"
function addLayer(name,color ){var name="ccc";
var color="#FF0000"
listId++;
count++;
if(count>10){
alert("只允许10条线路的添加!!");
return false;
}
$('#text').append(
'<div style="display:inline" id=linshi_'+listId+'>' +
'<input type=checkbox id=check_'+listId+' onclick="check(this)"/>' +
'<p style="display:inline;color:'+color+'" >'+name+'</p> ' +
'<img src="../scripts/miniui/themes/icons/remove.gif" alt="删除临时订阅" onclick="removeLayer(this)" name=linshi_'+listId+' /></div></br>'); return true;
}
////删除临时订阅的操作
function removeLayer(evt){
var divId=evt.name;
count--;
var div =document.getElementById(divId);
//document.getElementById(divId).removeNode(true);
div.onclick = function(){
this.parentNode.removeChild(this);
} var divText =document.getElementById("text"); divText.style.display=='none';
divText.style.display=='block';
}
//选中临时订阅
function check(evt){
var ee=evt;
} </script></body>
</html> 这是我写的一个测试用例 动态添加和删除 div
但是在删除div 之后 父亲div 不能很好的自适应打大小了 不能收缩回到原来的大小了 请高人指点一下子 应该怎么设置 在线等答案了 要是不明白我说的 您可以运行一下子 就看出问题了 谢谢了 O(∩_∩)O~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货