diff --git a/WebNews/index.html b/WebNews/index.html index a55586f..d0ef914 100644 --- a/WebNews/index.html +++ b/WebNews/index.html @@ -8,6 +8,7 @@ web新闻网站 +
@@ -33,11 +34,6 @@

新闻的作用

@@ -55,22 +51,27 @@ let pro = (window.pageYOffset / totalHight) * 100 Prostick.style.width = pro + '%' }) - document.addEventListener("DOMContentLoaded",function(){ - let imgs =[]; + document.addEventListener("DOMContentLoaded", function () { + let imgs = []; const carouselImages = document.querySelector('.banner img'); const dotsContainer = document.querySelector('.dots-container'); let currentIndex = 0; - }) - document.addEventListener("DOMContentLoaded",function(){ - let newszyLis = []; - const liContent = document.querySelector('.newszy li'); - document.write(`
  • ${newszyLis.text}
  • `) - }) - document.addEventListener("DOMContentLoaded",function(){ - let newsInfo = []; - const pContent = document.querySelector('.newsinfo p'); - document.write(`

    ${newsInfo.text}

    `) - }) + + const newszyLis = [ + { text: "新闻示例1" }, + { text: "新闻示例2" }, + // ...更多新闻项 + ]; + const liContent = document.querySelector('.newszy ul'); + + newszyLis.forEach(item => { + const li = document.createElement('li'); + li.textContent = item.text; + liContent.appendChild(li); + }); + + }); +