<p> How do i apply JavaScript to a webpage

4/20/2019 7:46:36 PM

Azure Brite

7 Answers

New Answer


Here a reference: https://www.sololearn.com/learn/JavaScript/2752/




Use <script></script> tags Or make a .js file and include it in your website using the "src" attribute in the script tags. Script tags can be used in both head and body tags.


There are 2 ways. 1. Apply directly in HTML using script tag. 2. Create a file that contains JS code. Then, save it in the same location as the HTML file or in a folder in that location. Then add that path in the src of script which should be either inside head or at the end of body of HTML.


Can PHP go inside <script> tags with type attribute set to "text/php" or can it go only inside the special <?php ?> tags?


Script tags right before the closing body tag. You do this because you want the body to load first.


write script code then you add document.write BLA BLA