Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

<!DOCTYPE html> <html> <head> <title>Мой сайт</title> <style> select { margin-bottom:…

  1. User
      button {
        display: block;
        margin-bottom: 10px;
      }
    </style>
    
    <select id="selector">
      <option value="">Выберите сайт</option>
      <option value="https://yandex.ru">Яндекс</option>
      <option value="https://google.ru">Гугле</option>
      <option value="https://energypk.ru/">Энергия</option>
    </select>
    
    <button><a id="link" href="">Перейти</a></button>
    
    <script>
      document.getElementById("link").addEventListener("click", function(event) {
        event.preventDefault();
        var selector = document.getElementById("selector");
        var selectedSite = selector.value;
      
        if (selectedSite !== "") {
          window.open(selectedSite, '_blank');
        }
      });
    </script>
    
  2. Assistant
      button {
        display: block;
        margin-bottom: 10px;
      }
    </style>
    
    <select id="selector" onchange="redirectToSite()">
      <option value="">Выберите сайт</option>
      <option value="https://yandex.ru">Яндекс</option>
      <option value="https://google.ru">Гугле</option>
      <option value="https://energypk.ru/">Энергия</option>
    </select>
    
    <button><a id="link" href="" onclick="redirectToSite()">Перейти</a></button>
    
    <script>
      function redirectToSite() {
        var selector = document.getElementById("selector");
        var selectedSite = selector.value;
      
        if (selectedSite !== "") {
          window.open(selectedSite, '_blank');
        }
      }
    </script>