相关疑难解决方法(0)

getElementById是否适用于javascript创建的元素?

当我点击链接时,我创建了两个函数来加载我博客存档部分中一个月的展开视图:

// Load open view of a month in the Archive section
function loadMonth(date) {
  // Remove other open month
     removeMonth();

  // Hide opening month's link
  // Define variable to hold month anchor tag
     var monthLink = document.getElementById(date); 
     monthLink.style.display = "none"; // Hide month anchor

  // Define new open month node and its attributes
     var openMonth = document.createElement("div");
     openMonth.setAttribute("id", "openMonth");
     openMonth.innerHTML = "Testing one, two, three.";

  // Insert open month
  // Define a variable to hold the archive Div node …
Run Code Online (Sandbox Code Playgroud)

html javascript dom

5
推荐指数
2
解决办法
7182
查看次数

标签 统计

dom ×1

html ×1

javascript ×1