<p> How do i apply JavaScript to a webpage | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

<p> How do i apply JavaScript to a webpage

20th Apr 2019, 7:46 PM
Azure Brite
Azure Brite - avatar
8 Answers
20th Apr 2019, 7:50 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 6
Thanks
20th Apr 2019, 7:52 PM
Azure Brite
Azure Brite - avatar
+ 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.
20th Apr 2019, 7:48 PM
Aaron Stone
Aaron Stone - avatar
+ 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.
20th Apr 2019, 7:54 PM
Kartik
Kartik - avatar
+ 4
Can PHP go inside <script> tags with type attribute set to "text/php" or can it go only inside the special <?php ?> tags?
21st Apr 2019, 12:18 AM
Sonic
Sonic - avatar
+ 2
Script tags right before the closing body tag. You do this because you want the body to load first.
20th Apr 2019, 11:43 PM
Big Joe
Big Joe - avatar
0
write script code then you add document.write BLA BLA
21st Apr 2019, 11:05 AM
dzikrul akbar
dzikrul akbar - avatar
21st Jul 2020, 3:21 AM
shubham kumar
shubham kumar - avatar