+ 1
Can you design JavaScript alert box?
Can you design JavaScript alert, prompt, etc using css or anything else?
4 odpowiedzi
+ 7
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Prompt</h2>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var txt;
var person = prompt("Please enter your name:", "Alert box");
if (person == null || person == "") {
txt = "User cancelled the prompt.";
} else {
txt = "Hello " + person + "🐍🐍🐍";
}
document.getElementById("demo").innerHTML = txt;
}</script>
</body>
</html>
+ 2
Amnehileisie hi,
If not, a solution would be to make your custom one using <dialog> tags in html, then styling it in CSS and controling it through js :
https://alligator.io/html/dialog-element/
https://blog.logrocket.com/the-dialog-element-the-way-to-create-tomorrows-modal-windows-f1d4ab14380b/
0
No you can't in sololearn.
You can use sweetalert alerts for designed alert.
https://code.sololearn.com/WORg3d1DiZ8I/?ref=app
0
Use Google sweet alert by looking at w3school Website for a better practical application.