Loading

在slience皮肤下添加新文章

// 获取 ul 元素
var navList = document.getElementById("navList");

// 获取 "新随笔" 的 li 元素
var newPostLi = document.getElementById("blog_nav_newpost").parentElement;

// 创建新的 li 元素
var newLi = document.createElement("li");

// 创建新的 a 元素
var newLink = document.createElement("a");
newLink.id = "blog_nav_newitem";  // 设置新的 a 标签的 id
newLink.className = "menu";       // 设置 a 标签的 class
newLink.href = "https://i.cnblogs.com/articles/edit";  // 设置 a 标签的链接
newLink.textContent = "新文章";  // 设置 a 标签的文本内容

// 将新的 a 标签添加到新的 li 元素中
newLi.appendChild(newLink);

// 将新的 li 元素插入到 "新随笔" 后面
navList.insertBefore(newLi, newPostLi.nextSibling);
posted @ 2024-11-19 19:41  一只大学生  阅读(9)  评论(0编辑  收藏  举报