Đăng ký lái thử
let imgCarBox = document.getElementsByClassName(“img-car-box”);
imgCarBox[0].style.display = “none”;
let imgCarE70 = document.getElementsByClassName(“img-car-e70”);
imgCarE70[0].style.display = “none”;
let imgCar007 = document.getElementsByClassName(“img-car-007”);
imgCar007[0].style.display = “none”;
let imgCarSky01 = document.getElementsByClassName(“img-car-sky01”);
imgCarSky01[0].style.display = “none”;
let imgCarMageHev = document.getElementsByClassName(“img-car-mage-hev”);
imgCarMageHev[0].style.display = “none”;
let imgCarHuge = document.getElementsByClassName(“img-car-huge”);
imgCarHuge[0].style.display = “none”;
const listCarName = [{
id: ‘.img-car-box’,
text: ‘Dongfeng BOX’
},{
id: ‘.img-car-e70’,
text: ‘Dongfeng E70’
},{
id: ‘.img-car-null-choice’,
text: ‘-Hãy lựa chọn loại xe-‘
},{
id: ‘.img-car-mage-hev’,
text: ‘Dongfeng MAGE’
},{
id: ‘.img-car-huge’,
text: ‘Dongfeng HUGE’
},{
idx: ‘.img-car-007’,
text: ‘Dongfeng EPI 007’
},{
id: ‘.img-car-sky01’,
text: ‘Dongfeng SKY 01’
}];
const selectElement = document.getElementById(‘loai-xe’);
// Add an event listener for the change event
selectElement.addEventListener(‘change’, function(event) {
// Get the value of the selected option
const selectedValue = event.target.value;
for (let i = 0; i < listCarName.length; i++) {
if (listCarName[i].text === selectedValue) {
let imgCarBox = document.querySelectorAll(listCarName[i].id);
imgCarBox[0].style.display = "block";
} else {
let imgCarBox = document.querySelectorAll(listCarName[i].id);
imgCarBox[0].style.display = "none";
}
}
});
