JS动态实现:每个h2后添加top回到顶部
来源:互联网 发布:淘宝直播东西是真的吗 编辑:程序博客网 时间:2024/06/06 02:38
html:
<!DOCTYPE html><html><head><title>Char 12 test</title><meta charset="utf-8"><script src="after.js"></script><!--<script type="text/javascript">window.onload = insertAfter();</script>--></head><body><div id="top"></div><h2 id="hh">first</h2><p id="pp">123bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cook well]a person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur</p><h2>second</h2><p>erson who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cook well]a person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who dle running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Onoes something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only am</p><h2>third</h2><p>erson who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cook well]a person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who dle running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Onoes something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only amateurs make this kind of mistake.He's a mere amateur when it comes to cooking. [=he doesn't know how to cooka person who does something poorly : a person who is not skillful at a job or other activity.The people running that company are a bunch of amateurs.Only am</p><script type="text/javascript">// var n = document.createElement("a");// var text = document.createTextNode("link");// n.appendChild(text);// n.setAttribute("href","www.baidu.com");// n.setAttribute("value","链接");// var pV= document.getElementById("hh");//console.log(pV);//insertAfter(n,pV);window.onload= function(){// insertAfter(n,pV);Totop();}</script></body></html>JS文件:after.js
function insertAfter(newNode,ObjNode){ console.log(ObjNode);var parent = ObjNode.parentNode;console.log(parent);console.log(parent.lastChild);if(ObjNode == parent.lastChild){parent.appendChild(newNode);} else {console.log(ObjNode.nextSibling);parent.insertBefore(newNode,ObjNode.nextSibling);}}function Totop(){var h2s = document.getElementsByTagName("h2");for(var i=0 ; i<h2s.length ; i++){var a = document.createElement("a");var text = document.createTextNode("top");a.appendChild(text);a.setAttribute("href","#top");insertAfter(a,h2s[i]);}}window.onload = Totop;
阅读全文
0 0
- JS动态实现:每个h2后添加top回到顶部
- JS实现回到Top(顶部)--JavaScrip
- js+css实现回到顶部按钮(back to top)
- Back Top ①(回到顶部)原生JS实现
- js实现回到顶部
- js 回到顶部的实现
- JS实现回到顶部按钮
- js实现回到顶部效果
- JS实现回到顶部效果
- back to top 回到顶部按钮 css+js
- 百分百纯js实现回到顶部按钮
- js实现 回到网页顶部 效果
- 使用js实现回到页面顶部
- 源生JS实现回到顶部--缓冲效果
- JS平滑效果实现回到顶部
- JS回到顶部按钮实现源代码
- jQuery动态回到顶部
- jquery回到动态顶部
- tomcat7.x 点击\bin\tomcat7.exe一闪而过,点击tomcat7w.exe提示未安装服务
- 《所谓情商高就是会说话》
- vue的学习记录--环境配置
- HDU 4686(矩阵快速幂)
- TI DSP C64X 优化基本方法
- JS动态实现:每个h2后添加top回到顶部
- Css精灵图合成工具---CssSprite
- 35、不一样的C++系列--智能指针
- 将tableview中显示的内容导出到EXCEL中
- Python编程之安装
- C# 线程中更新界面控件
- JavaScript计时
- USACO-Section2.1 Ordered Fractions【递归算法】
- Spring AOP的实现原理详解及代码实例