now = new Date() if (now.getDay() == 0) div.innerHTML = '<p>пн</p>'; if (now.getDay() == 1) div.innerHTML = '<p>вт</p>'; if (now.getDay() == 2) div.innerHTML = '<p>ср</p>'; if (now.getDay() == 3) div.innerHTML = '<p>чт</p>'; if (now.getDay() == 4) div.innerHTML = '<p>пт</p>'; if (now.getDay() == 5) div.innerHTML = '<p>сб</p>'; if (now.getDay() == 6) div.innerHTML = '<p>вс</p>';
<!DOCTYPE html> <html> <head> <!-- <script src='https://code.jquery.com/jquery-latest.min.js'></script> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> <link rel="stylesheet" type="text/css" href="tmp.css" /> <script src='tmp.js'></script> --> <style> </style> <script> window.addEventListener('DOMContentLoaded', _ => { const a = ['пн', 'вт', 'ср', 'чт', 'пт', 'сб', 'вс'] let val = now = new Date() val = val.getDay() div.innerHTML = '<p>' + a[val] + '</p>'; }) </script> </head> <body> <p id='div'></p> </body> </html>