+10

<p> How do i apply JavaScript to a webpage

4/20/2019 7:46:36 PM

Bright Yeboah

7 Answers

New Answer

+4

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

+5

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.

+5

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

+5

+4

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.

+2

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

0

write script code then you add document.write BLA BLA