Combining Js and Html


#1

Hey im trying to combine html and Javascript for the first time, but it is not working to well. Can someone tell me anyway to use html and js together to do the command alert? Thanks in advance.

<!DOCTYPE HTML>
<html>
<head>
 <title>JavaScript Hello World</title>
</head>
<body>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
 alert(“Hello World!”);
}
</script>
</body>
</html>

#2

that didnt work to well either how to i write html here without It using the html xD


#3

this line:

alert(“Hello World!”);

use quotation marks ("), not sure what you are using


#4

Thanks man, it worked! Mark it as solved now if you want


#5