Issue
I created a sample HTML file on my windows. I also have a script file in java.js file. I tried to link the file to html using tag. Still it doesn't display according to the JavaScript. The html doesn't get manipulated using java file. Am i missing something. here is what i have
The Java script file is in that location mentioned in the src file i am a beginner on this
Solution
Remember that JavaScript and Java are two different Programming languages. The rest below =>
alert("Now JavaScript is hooked and Working");
console.log("You can find JavaScript in console of Your browser");
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Html & JavaScript</title>
<script src="script.js" defer></script>
</head>
<body>
<a
target="_blank"
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript"
>JavaScript. Read More</a
>
<h3>
Please be Aware of that: <br />Java and JavaScript are two different
programming languages!
</h3>
<a
target="_blank"
href="https://www.java.com/en/download/help/whatis_java.html"
>Java. Read More</a
>
</body>
</html>
Create two files in the project directory on Your machine. For example, index.html
and script.js
. I have provided the code for each of them above.
Start the editor. For example VSCode with LiveServer in it and run index.html
.
That's all.
Good luck ;-)
Answered By - MarioG8
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.