You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const links = document.querySelectorAll('.nav-pills .nav-link');
|
|
// Get the current page path
|
|
const currentPath = window.location.pathname;
|
|
links.forEach(link => {
|
|
// Compare the link's href with the current path
|
|
if (link.href.endsWith(currentPath)) {
|
|
link.classList.add('active');
|
|
} else {
|
|
link.classList.remove('active');
|
|
}
|
|
});
|
|
});
|
|
|
|
function showModal(message) {
|
|
// 设置 Modal 中的消息
|
|
document.getElementById('modalMessage').innerText = message;
|
|
|
|
// 显示 Modal
|
|
const responseModal = new bootstrap.Modal(document.getElementById('responseModal'));
|
|
responseModal.show();
|
|
}
|
|
|
|
//动态填充select控件
|
|
function set_select_data(select_ele_id,datas){
|
|
const select_Ele = document.getElementById(select_ele_id);
|
|
//清空老数据
|
|
select_Ele.innerHTML = '';
|
|
//添加列表
|
|
datas.forEach(option => {
|
|
const optionElement = document.createElement('option');
|
|
optionElement.textContent = option;
|
|
select_Ele.appendChild(optionElement);
|
|
});
|
|
}
|
|
|
|
//设定选项选中状态
|
|
function set_select_selct(select_ele_id,option_str){
|
|
const select_Ele = document.getElementById(select_ele_id);
|
|
for(let i=0;i< select_Ele.options.length;i++){
|
|
if(select_Ele.options[i].value === option_str){
|
|
select_Ele.options[i].selected = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|