javscript为网站博客添加menu列表
来源:互联网 发布:网络大电影演员 编辑:程序博客网 时间:2024/05/19 19:29
All blogs(h1标记)
Blog1(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
Blog2(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
Blog3(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
Blog4(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
Blog5(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
Blog6(h2标记)
World contains all kinds of elements, in colour and form, just like the keyboard contains the notes of all music.For the artist is responsible to pick, and choose, and group with science, these elements, that the result may be magic.(p标记)
为网站博客添加menu列表,将Blog1 Blog2 Blog3标题排列在上方...
<script>
function makeMenu(){
var h2s=document.getElementsByTagName("h2");
var menu=document.createElement("div");
var menuUl=document.createElement("ul");
menu.appendChild(menuUl);
for(var i=0;i<h2s.length;i++){
var itemText=h2s[i].childNodes[0].nodeValue;
var menuLi=document.createElement("li");
menuUl.appendChild(menuLi);
var menuLiA=document.createElement("a");
menuLi.appendChild(menuLiA);
menuLiA.setAttribute("href","#item"+i);
var menuText=document.createTextNode(itemText);
menuLiA.appendChild(menuText);
var anc=document.createElement("a");
anc.setAttribute("name","item"+i);
document.body.insertBefore(anc,h2s[i]);
}
document.body.insertBefore(menu,document.body.firstChild);
}
window.onload=makeMenu;
</script>
- javscript为网站博客添加menu列表
- android 为Tab添加Menu
- Android为Menu添加item及响应函数
- iOS学习网站博客列表
- 为网站添加logo
- Octopress 搭建静态博客站点 --- 为站点侧边栏添加分类列表(Categories)
- 为博客添加在线聊天室
- 为博客添加silverlight应用
- 为android程序添加背景音乐和Menu菜单
- 为自己网站添加RSS
- 为网站添加业务层
- 为网站添加业务层
- 为网站图片添加水印
- 为网站添加分享按钮
- 网站模块——添加下拉列表
- 博客网站添加友情链接-SEO搜索引擎优化
- 为列表控件添加水平滚动条
- 为选择屏幕字段,添加下拉列表
- androidの手机Email学习总结
- Wireshark手机等移动设备抓包
- nginx启动配置加载性能分析(一)-作为http服务器
- javascript两种时间暂停
- cocos2dx物理引擎和碰撞检测(五)框架Fixtures
- javscript为网站博客添加menu列表
- 黑马程序员--Java基础之面向对象一
- 使用Intent跳转后清除以前所访问的页面
- C++类的成员函数(在类外定义成员函数、inline成员函数)
- Android开发过程中 R文件消失的5种解决办法
- Android Studio 1.0 安装遇到问题总结
- Python 正则表达式删除XML的注释
- AIX 磁盘使用高 诊断案例
- 类的各种成员函数在类中是如何分配的?