Kurtki skrypt w ja wyświetlający alert napisz
- User
Kurtki skrypt w ja wyświetlający alert napisz
Assistant
Oczywiście! Aby napisać skrypt w JavaScript, który wyświetla alert, możesz użyć funkcji
alert(). Poniżej znajduje się prosty przykład skryptu, który wyświetla alert z wiadomością "Witaj w świecie JavaScript!".<!DOCTYPE html> <html lang="pl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Przykład alertu</title> </head> <body> <h1>Witaj na stronie!</h1> <p>Kliknij przycisk, aby wyświetlić alert.</p> <button onclick="showAlert()">Pokaż alert</button> <script> function showAlert() { alert("Witaj w świecie JavaScript!"); } </script> </body> </html>W tym przykładzie:
- Tworzymy prostą stronę HTML z nagłówkiem i paragrafem.
- Dodajemy przycisk, który wywołuje funkcję
showAlert()przy kliknięciu.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.