var a1 = document.getElementById('a1');
a1.style['nav-index'] = /* somevalue */;
a1.style['nav-up'] = /* somevalue */;
// or (style properties with hypens must be converted
// to a camel case representation for use in 'dot notation')
a1.style.navIndex = /* somevalue */;
a1.style.navUp = /* somevalue */;
// and to retrieve the original values:
a1.style['nav-index'] = '';
a1.style['nav-up'] = '';
function changeClass (elementID, newClass) {
var element = document.getElementById(elementID);
element.setAttribute("class", newClass); //For Most Browsers
element.setAttribute("className", newClass); //For IE; harmless to other browsers.
}
4条答案
按热度按时间kmbjn2e31#
您可以使用jquery来更改nav-index和nav-up。
f5emj3cl2#
请注意,根据this和this,
nav-index
和nav-up
仅受Opera支持。2lpgd9683#
[2023年]查看此Stackblitz snippet
就像这样:
此外,建议将内联样式转移到css文件中的类中。
piv4azn74#
创建一个新的css并调用他们使用像这样