je veux un site web qui permet d'accéder aux datasheets de produits semiconducteur de la société microchip. la page principale présentera un systeme de selection ( famille, type ... ) .
3c90fc7 verified | document.addEventListener('DOMContentLoaded', function() { | |
| // Family and Type dropdown dependencies | |
| const familyDropdown = document.getElementById('family'); | |
| const typeDropdown = document.getElementById('type'); | |
| // Product type options based on family | |
| const productTypes = { | |
| mcu: ['8-bit AVR', '8-bit PIC', '16-bit PIC', '32-bit ARM Cortex-M', '32-bit ARM Cortex-A'], | |
| mpu: ['ARM-based', 'MIPS-based', 'RISC-V'], | |
| analog: ['Amplifiers', 'Comparators', 'Data Converters', 'Interface', 'Power Management'], | |
| memory: ['EEPROM', 'Flash', 'SRAM', 'FRAM'], | |
| wireless: ['Bluetooth', 'Wi-Fi', 'LoRa', 'Zigbee', 'NFC'] | |
| }; | |
| // Update type dropdown based on family selection | |
| familyDropdown.addEventListener('change', function() { | |
| const selectedFamily = this.value; | |
| typeDropdown.innerHTML = '<option value="">Select Type</option>'; | |
| typeDropdown.disabled = !selectedFamily; | |
| if (selectedFamily) { | |
| productTypes[selectedFamily].forEach(type => { | |
| const option = document.createElement('option'); | |
| option.value = type.toLowerCase().replace(/\s+/g, '-'); | |
| option.textContent = type; | |
| typeDropdown.appendChild(option); | |
| }); | |
| } | |
| }); | |
| // Search button functionality | |
| document.getElementById('search-btn').addEventListener('click', function() { | |
| const family = familyDropdown.value; | |
| const type = typeDropdown.value; | |
| const searchTerm = document.getElementById('search').value.trim(); | |
| if (!family && !searchTerm) { | |
| alert('Please select a product family or enter a part number'); | |
| return; | |
| } | |
| // In a real app, this would fetch data from Microchip's API | |
| console.log('Searching for:', { family, type, searchTerm }); | |
| alert('This would search Microchip\'s database in a real application'); | |
| }); | |
| // Responsive adjustments | |
| function handleResize() { | |
| // Add any responsive behaviors here | |
| } | |
| window.addEventListener('resize', handleResize); | |
| handleResize(); | |
| }); |