Skip to content

Instantly share code, notes, and snippets.

@alpgul
Created October 30, 2018 09:18
Show Gist options
  • Save alpgul/9571ad5301b6b4f34150b35f0b961025 to your computer and use it in GitHub Desktop.
Save alpgul/9571ad5301b6b4f34150b35f0b961025 to your computer and use it in GitHub Desktop.
JavaScript Where To
<--The <script> Tag-->
<script>
document.getElementById("demo").innerHTML = "My First JavaScript";
</script>
<--JavaScript in <head>-->
<head>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</head>
<--JavaScript in <body>-->
<body>
<h1>A Web Page</h1>
<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</body>
<--External JavaScript-->
<script src="myScript.js"></script>
<--External References-->
<script src="https://www.w3schools.com/js/myScript1.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment