html js code example

Example 1: include script in html

<script type="text/javascript" src="/path/to/script.js"></script>

Example 2: script js

<script type="text/javascript" src="monscript.js"></script>

Example 3: javascript with html

// this how add javascript file in html !!


<script type="text/javascript" src="yourJavascript.js"></script>

Example 4: Javascript file in html angeben

<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="utf-8">
</head>
<body>
    <h1>Everything</h1>
    <script src="something.js"></script>
</body>
</html>

Example 5: how to use javascript in html

<!-- include an external javascript document -->
<script src="myJavaScript.js" charset="utf-8"></script>

<!-- JavaScript inside html element -->
<script>
  console.log("This is JavaScript");
</script>

Example 6: Javascript file in html angeben

<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="utf-8">
  <script src="something.js"></script>
</head>
<body>
</body>
</html>