我试过了

<divid="a1">
<divid="top1">....................</div>
</div>

<divid="a2">
<divid="top2">....................</div>
</div>


vart1=document.getElementById("top1");
vart2=document.getElementById("top2");

document.getElementById("a1").appendChild(t2);
document.getElementById("a1").removeChild(t1);
document.getElementById("a2").appendChild(t1);
document.getElementById("a2").removeChild(t2);

此法错误
提示UncaughtError:NOT_FOUND_ERR:DOMException8

据我推测是document.getElementById("top1");等2个的引用失效了,怎么处理?

9 个解决方案

#1


我把最后一句注释掉就没有了
<body>
<divid="a1">
<divid="top1">1111</div>
</div>

<divid="a2">
<divid="top2">2222</div>
</div>


<script>
vart1=document.getElementById("top1");
vart2=document.getElementById("top2");

document.getElementById("a1").appendChild(t2);
document.getElementById("a1").removeChild(t1);
document.getElementById("a2").appendChild(t1);
//document.getElementById("a2").removeChild(t2);
</script>
</body>

更多相关文章

  1. html2canvas 识别 svg 解决方案
  2. 将我的代码中的JavaDoc注释转换为HTML
  3. HTML5用户身份认证源代码:注册、登录、会话保持的解决方案
  4. 用于在表中强制换行的PHP或HTML/CSS解决方案
  5. 如何实现分布式文件上传解决方案?
  6. 一套PHP做app接口的解决方案
  7. curl获取网页内容出现乱码或为空的解决方案,另附curl_getinfo函数
  8. PHP XAMPP配置PHP环境和Apache80端口被占用解决方案
  9. MySql 修改列的注释信息的方法

随机推荐

  1. excel 中设置下拉菜单,让其一直显示
  2. 这件正在发生的事,关乎所有的Python开发者
  3. python入门教程12-06 (python语法入门之进
  4. 如何使用visual studio 2017
  5. 最新进展|关于Python治理模式的投票
  6. IP及基本配置
  7. 为什么range不是迭代器?range到底是什么类
  8. 在excel 中添加表单控件
  9. Python对象的空间边界:独善其身与开放包容
  10. Spark Streaming 使用