<div>技术部
<div>张</div>
<div>李</div>
<div>王</div>
</div>
<div>业务部
<div>百</div>
<div>钱</div>
<div>书</div>
</div>
<div>市场部
<div>了</div>
<div>的</div>
<div>他</div>
</div>
技术部 和市场部 这两个大类可以移动 就说市场部 可以移到技术部的上面
那市场部的 了,的,他 也可以互相移动但是只能在市场部这个层里移动 JS怎么实现急呀 老大们 帮帮我 拜托了
<div>张</div>
<div>李</div>
<div>王</div>
</div>
<div>业务部
<div>百</div>
<div>钱</div>
<div>书</div>
</div>
<div>市场部
<div>了</div>
<div>的</div>
<div>他</div>
</div>
技术部 和市场部 这两个大类可以移动 就说市场部 可以移到技术部的上面
那市场部的 了,的,他 也可以互相移动但是只能在市场部这个层里移动 JS怎么实现急呀 老大们 帮帮我 拜托了
解决方案 »
- IE attachEvent 的问题
- 新手求专家帮助 输入后显示字的个数问题
- 我现在有个网站需要美工修剪以下,希望可以帮忙!!
- js替换某一段的字符
- 请教一个简单的问题
- 一个奇怪的问题 jquery easyui datagrid 在IE下有时 无法接收到数据
- artDialog 如何使用?
- 如何判断是否点击了关闭按钮?!
- 从下拉框选出n个值付给n个动态生成的checkbox(即选几个值)生成几个checkbox并分别付值?
- 如何写个javascript能够,用按钮控制select选项
- 替换网页中的部分内容(正则表达式)
- 刚刚接触正则,问个小问题。希望给与解答。谢谢。对不起分用光了。只能拜托了。
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shawl.qiu template</title>
<style type="text/css">
/* <![CDATA[ */
div{border:1px solid blue; padding:5px; margin:2px 0px;}
/* ]]> */
</style>
<script type="text/javascript">
//<![CDATA[
if (navigator.appName=="Microsoft Internet Explorer") {
//最大化窗口
self.moveTo(-5,-5)
self.resizeTo(screen.availWidth +8,screen.availHeight+8)
//这个脚本定义的宽度其实比原窗口还要大那么一点.
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
onload=function(){
fAtchPrnt('div');
}
function fAtchPrnt(tag){
var j=0;
var o=document.getElementsByTagName(tag);
for(var i=0; i<o.length; i++){
if(o[i].parentNode.tagName=='BODY'){
if(navigator.appName=='Microsoft Internet Explorer')
o[i].id='parent_'+ j;
else o[i].setAttribute('id', 'parent_'+ j);
fAtchOpt('parent_order', j, o[i].firstChild.data, o[i].getAttribute('id'));
j++;
//alert(o[i].firstChild.data);
}
}
//alert(document.body.innerHTML);
}
function fAtchOpt(id, order, text, value){
var o=document.getElementById(id);
o.size=order+1;
if(order==0)
o.options[order]=new Option(text, value, true, true);
else o.options[order]=new Option(text, value);
}
function fMoveParent(id, move){
var o=document.getElementById(id)
var offset=0;
var over=o.size-1;
var curt=o.selectedIndex;
if(move=='up'){
if(curt>0){
var oTemp=document.getElementById(o.options[curt].value)
var oTemp_=document.getElementById(o.options[curt-1].value)
var oP=document.getElementById(o.options[curt].value).parentNode;
oP.insertBefore(oTemp, oTemp_)
var temp=o.options[curt];
o.insertBefore(temp, o.options[curt-1])
}
} else {
if(curt<over){
var oTemp=document.getElementById(o.options[curt].value)
var oTemp_=document.getElementById(o.options[curt+1].value)
var oP=document.getElementById(o.options[curt].value).parentNode;
oP.replaceChild(oTemp, oTemp_);
oP.insertBefore(oTemp_, oTemp);
var temp=o.options[curt];
var temp_=o.options[curt+1];
o.replaceChild(temp, o.options[curt+1]);
o.insertBefore(temp_, temp);
}
}
}
//]]>
</script>
</head>
<body>
<select multiple="multiple" id="parent_order">
</select>
<br /><button onclick="fMoveParent('parent_order', 'up')">上移</button>
<button onclick="fMoveParent('parent_order', 'down')">下移</button>
<div>技术部
<div>张</div>
<div>李</div>
<div>王</div>
</div>
<div>业务部
<div>百</div>
<div>钱</div>
<div>书</div>
</div>
<div>市场部
<div>了</div>
<div>的</div>
<div>他</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shawl.qiu template</title>
<style type="text/css">
/* <![CDATA[ */
div{border:1px solid blue; padding:5px; margin:2px 0px;}
/* ]]> */
</style>
<script type="text/javascript">
//<![CDATA[
if (navigator.appName=="Microsoft Internet Explorer") {
//最大化窗口
self.moveTo(-5,-5)
self.resizeTo(screen.availWidth +8,screen.availHeight+8)
//这个脚本定义的宽度其实比原窗口还要大那么一点.
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
onload=function(){
fAtchPrnt('main', 'div');
fChildren_ele('parent_order', 'children_order');
}
function fAtchPrnt(tagId, tag){
var j=0;
var o=document.getElementById(tagId).getElementsByTagName(tag);
for(var i=0; i<o.length; i++){
if(o[i].parentNode.id==tagId){
if(navigator.appName=='Microsoft Internet Explorer')
o[i].id='parent_'+ j;
else o[i].setAttribute('id', 'parent_'+ j);
fAtchOpt('parent_order', j, o[i].firstChild.data, o[i].getAttribute('id'));
j++;
//alert(o[i].firstChild.data);
}
}
//alert(document.body.innerHTML);
}
function fAtchOpt(id, order, text, value){
var o=document.getElementById(id);
o.size=order+1;
if(order==0)
o.options[order]=new Option(text, value, true, true);
else o.options[order]=new Option(text, value);
}
function fMoveParent(id, move){
var o=document.getElementById(id)
var offset=0;
var over=o.size-1;
var curt=o.selectedIndex;
if(move=='up'){
if(curt>0){
var oTemp=document.getElementById(o.options[curt].value)
var oTemp_=document.getElementById(o.options[curt-1].value)
var oP=document.getElementById(o.options[curt].value).parentNode;
oP.insertBefore(oTemp, oTemp_)
var temp=o.options[curt];
o.insertBefore(temp, o.options[curt-1])
}
} else {
if(curt<over){
var oTemp=document.getElementById(o.options[curt].value)
var oTemp_=document.getElementById(o.options[curt+1].value)
var oP=document.getElementById(o.options[curt].value).parentNode;
oP.replaceChild(oTemp, oTemp_);
oP.insertBefore(oTemp_, oTemp);
var temp=o.options[curt];
var temp_=o.options[curt+1];
o.replaceChild(temp, o.options[curt+1]);
o.insertBefore(temp_, temp);
}
}
}
function fChildren_ele(id, idCld){
var o=document.getElementById(id);
var oIndex=o.selectedIndex;
var oCld=document.getElementById(idCld)
oCld.length=0;
var obj=document.getElementById(o.options[o.selectedIndex].value)
var objCld=obj.getElementsByTagName('div');
for(var i=0; i<objCld.length; i++){
if(navigator.appName=='Microsoft Internet Explorer')
objCld[i].id=obj.id+'_'+i
else objCld[i].setAttribute('id', obj.id+'_'+i);
fAtchOpt('children_order', i, objCld[i].firstChild.data, objCld[i].getAttribute('id'));
}
//alert(document.body.innerHTML);
}
//]]>
</script>
</head>
<body><div id="inline">
<select multiple="multiple" id="parent_order" onchange="fChildren_ele('parent_order', 'children_order');">
</select>
<br /><button onclick="fMoveParent('parent_order', 'up')">上移</button>
<button onclick="fMoveParent('parent_order', 'down')">下移</button>
</div>
<div id="inline">
<select multiple="multiple" id="children_order">
</select>
<br /><button onclick="fMoveParent('children_order', 'up')">上移</button>
<button onclick="fMoveParent('children_order', 'down')">下移</button>
</div>
<div id="main">
<div>技术部
<div>张</div>
<div>李</div>
<div>王</div>
</div>
<div>业务部
<div>百</div>
<div>钱</div>
<div>书</div>
</div>
<div>市场部
<div>了</div>
<div>的</div>
<div>他</div>
</div>
</div>
</body>
</html>