IE8 and the following browsers in 1.js do not support Getelementsbyclassname,
(1) JS native code AddClass Add class, with spaces
Example:
<div class= "Item1 item2" > </div>
The above is a div, the style of the DIV has two, so you add a class when you need a space and then add a new style.
Last get: <div class= "item1 item2 new" > </div>
(2) Remove class: Cannot directly let obj.classname= ""; Because an object can have many classes. Replace the regular expression you want to remove with the following space.
Obj.classname = Obj.className.replace (Reg, "");
2.var result = []; defines an empty array.
3.window.onscroll = function () {}; When the window scrolls, the following functions are executed. Without this line, the window scrolling does not trigger any function, which is equivalent to useless. Window.Scroll is the trigger window scrolling event.
The href attribute of the 4._menu can also be used directly with getattribute (' href ')_menu.getAttribute(‘href‘)
JS can be used SetAttribute (' class ', ' ClassName ')
Summary of JS related problems in Web Navigation in Mu-class network