Summary of JS related problems in Web Navigation in Mu-class network

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.