Skip to content

Commit

Permalink
Dodano skrypt by przeglądarka działa
Browse files Browse the repository at this point in the history
  • Loading branch information
Prawy126 committed Jan 20, 2024
1 parent 4da2d63 commit 51dbe59
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions projekt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,38 @@

<div class="prawy">
<div class="search-container">
<input type="text" name="search" placeholder="Search..." class="search-input">
<a href="#" class="search-btn">
<input type="text" id="search-input" placeholder="Search..." class="search-input">
<a href="#" id="search-btn" class="search-btn">
<i class="fas fa-search"></i>
</a>
</div>
</div>

</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
var searchInput = document.getElementById('search-input');
var searchButton = document.getElementById('search-btn');

function search() {
var query = searchInput.value;
var googleSearchUrl = 'https://www.google.com/search?q=' + encodeURIComponent(query);
window.open(googleSearchUrl, '_blank'); // Otwiera wyniki wyszukiwania w nowej karcie
var searchInput = document.getElementById('search-input');
var searchButton = document.getElementById('search-btn');

function search() {
var query = searchInput.value;
var googleSearchUrl = 'https://www.google.com/search?q=' + encodeURIComponent(query);
window.open(googleSearchUrl, '_blank'); // Otwiera wyniki wyszukiwania w nowej karcie
}

searchInput.addEventListener('keypress', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Zapobiega standardowej akcji formularza
search();
}

searchInput.addEventListener('keypress', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Zapobiega standardowej akcji formularza
search();
}
});

searchButton.addEventListener('click', function(event) {
event.preventDefault(); // Zapobiega standardowej akcji linku
search();
});
});

searchButton.addEventListener('click', function(event) {
event.preventDefault(); // Zapobiega standardowej akcji linku
search();
});
});
</script>
</script>


</header>

Expand Down

0 comments on commit 51dbe59

Please sign in to comment.