I just starte learning to code. I had a section of HTML, and tried to insert some JavaScript into it. It goes like this:
Whenever I run it, the prompt does not work. This is what appears:
Hello there.
I am the Matrix.
Helloundefined.
Other notes:
I am using notepad on Windows 8 to type the code.
Whenever I open the page, there is a pop up that asks me if I want to allow blocked content. I have to click this to allow the pop ups to run.
The file is saved as an HTML file, and around that script I have HTML.
If you can please help. Thank you
Code:
<script>
alert("Hello there");
alert("I am the Matrix");
var name = prompt("Enter your name");
alert("Hello" + name + ".");
</script>
Hello there.
I am the Matrix.
Helloundefined.
Other notes:
I am using notepad on Windows 8 to type the code.
Whenever I open the page, there is a pop up that asks me if I want to allow blocked content. I have to click this to allow the pop ups to run.
The file is saved as an HTML file, and around that script I have HTML.
If you can please help. Thank you
Comment