I tried using alert() and confirm() in JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>
My Website
</title>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<h2 align=center>My Website</h2>
<p align=center> <button onclick=“myFunction()”>click to enter</button> </p>
<script type=text/javascript>
function myFunction() {
alert(“u sure?”);
}
</script>
</body>
</html>
Before you point it out, no, quotation marks glitch everything out on my website. I tried something similar to this on another computer and it worked. Is it just my computer?
The problem is likely with your double quotes. “
should be "
:
function myFunction() {
alert("u sure?");
}
<p align=center> <button onclick="myFunction()">click to enter</button> </p>