JS笔记
获取当前时间
year = new Date().getFullYear(); //2024
document.write(year.toString()); //当前标签输出2024
date = new Date();
year = date.getFullYear(); //2024
month = date.getMonth() + 1; //2
day = date.getDate(); //22
date = Date(); //Thu Feb 22 2024 11:06:38 GMT+0800 (中国标准时间)
date = new Date().toLocaleDateString(); //2024/2/22
给HTML标签添加CSS
var mobileHeaderSvgButton = document.getElementById("mobileHeaderSvgButton");
mobileHeaderSvgButton.onclick = function () {
var domName = document.getElementById('mobileMenuWrapperID');
if (domName.style['max-height'] == 'none') {
domName.style['max-height'] = '0px';
} else {
domName.style['max-height'] = 'none';
}
}
Buy me a cup of coffee 🙂
觉得对你有帮助,就给我打赏吧,谢谢!