zsydgithub 1 жил өмнө
parent
commit
eed48acd53

+ 9 - 0
Dom/3_选项卡.html

@@ -71,6 +71,9 @@
 
 
     for (var i = 0; i < btns.length; i++) {
     for (var i = 0; i < btns.length; i++) {
       btns[i].index = i
       btns[i].index = i
+      //时事.index = 0
+      //新闻.index = 1
+      //体育.index = 2
       console.log(btns[i].index)
       console.log(btns[i].index)
       btns[i].onclick = function () {
       btns[i].onclick = function () {
         for (var j = 0; j < btns.length; j++) {
         for (var j = 0; j < btns.length; j++) {
@@ -84,6 +87,12 @@
         this.className = 'selected'
         this.className = 'selected'
         //content[索引值] = content[btns点击谁的索引值] =content[this.index]
         //content[索引值] = content[btns点击谁的索引值] =content[this.index]
         content[this.index].className = 'active select'
         content[this.index].className = 'active select'
+
+        //想点击新闻  新闻.index = 1
+        //this.className = 新闻.className = 'selected'
+        //content[新闻.index].className = 'active select'
+        //content[1].className = 'active select'  新闻内容
+
       }
       }
     }
     }
   </script>
   </script>