Показать сообщение отдельно
  #3 (permalink)  
Старый 07.12.2023, 09:39
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,075

alrosavilla,
<!DOCTYPE HTML>
<html>

<head>
    <title>Untitled</title>
    <meta charset="utf-8">
</head>

<body>
    <p data-name="gerAftPrep"></p>
    <p data-name="presPerf"></p>
    <p data-name="negatives"></p>
    <script>
        let tips = {
            gerAftPrep: "they normally put gerunds after prepositions",
            presPerf: "brace yourself, it's the Present Perfect",
            negatives: "need a special verb before not"
        };

        function showTips() {
            let elements = document.querySelectorAll('p[data-name]');
            elements.forEach(function(element) {
                let name = element.dataset.name;
                if (name in tips) element.textContent = tips[name];
            })
        }
        showTips()
    </script>
</body>

</html>
Ответить с цитированием